Skip to content

Feat/issue 297/conversation session - #325

Merged
theantichris merged 8 commits into
mainfrom
feat/issue-297/conversation-session
Aug 31, 2026
Merged

theantichris merged 8 commits into
mainfrom
feat/issue-297/conversation-session

Conversation

@theantichris

Copy link
Copy Markdown
Owner

Closes #297

@theantichris theantichris self-assigned this Aug 31, 2026
Copilot AI lite review requested due to automatic review settings August 31, 2026 12:54
@theantichris theantichris added the enhancement New feature or request label Aug 31, 2026
@github-project-automation github-project-automation Bot moved this to Backlog in theantichris Aug 31, 2026
@theantichris theantichris moved this from Backlog to In review in theantichris Aug 31, 2026
@theantichris
theantichris merged commit a7a1ec0 into main Aug 31, 2026
5 checks passed
@theantichris
theantichris deleted the feat/issue-297/conversation-session branch August 31, 2026 12:55
@github-project-automation github-project-automation Bot moved this from In review to Done in theantichris Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are cohesive, well-covered by tests, and introduce the session abstraction with safe history ownership while keeping Ollama details isolated.

Pull request overview

Introduces a new in-memory conversation session abstraction to own ordered chat history and updates the CLI + Ollama client to use the shared canonical message/role types.

Changes:

  • Added internal/conversation.Session with append operations and history copy/alias safety.
  • Refactored internal/ollama.Client.Chat to accept/return conversation.Message, mapping to Ollama’s wire format internally.
  • Updated CLI flow and tests to build requests via a session and pass immutable history into chat calls.
File summaries
File Description
main.go Builds the initial user turn using a conversation.Session and passes session history to chat.
main_test.go Updates run() tests to assert the new conversation.Message history shape.
internal/ollama/client.go Removes exported Ollama-specific message types; converts conversation.Message to/from request/response JSON.
internal/ollama/client_test.go Adjusts tests to validate wire-format payloads and returned conversation.Message.
internal/conversation/session.go Adds the new session type, canonical roles/messages, and safe Messages() cloning.
internal/conversation/session_test.go Adds table-driven coverage for initialization, append ordering, and copy/alias safety.
Review details
  • Files reviewed: 6/6 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread internal/ollama/client.go
Comment on lines 103 to +107
if decodeErr != nil || strings.TrimSpace(apiError.Error) == "" {
return Message{}, fmt.Errorf("Ollama chat request failed: %s", response.Status)
return conversation.Message{}, fmt.Errorf("ollama chat request failed: %s", response.Status)
}

return Message{}, fmt.Errorf("Ollama chat request failed: %s: %s", response.Status, apiError.Error)
return conversation.Message{}, fmt.Errorf("ollama chat request failed: %s: %s", response.Status, apiError.Error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

M2.C1: Add an in-memory conversation session

2 participants