Skip to content

fix: agentic ask drops assistant turns when response persistence fails once#876

Closed
sam-saffron-jarvis wants to merge 1 commit into
SamSaffron:mainfrom
sam-saffron-jarvis:feat/codereview-8c2956ab
Closed

fix: agentic ask drops assistant turns when response persistence fails once#876
sam-saffron-jarvis wants to merge 1 commit into
SamSaffron:mainfrom
sam-saffron-jarvis:feat/codereview-8c2956ab

Conversation

@sam-saffron-jarvis

Copy link
Copy Markdown
Contributor

What changed

  • Return the store.AddMessage error from the term-llm ask response-completed persistence callback instead of reporting success after a failed assistant-message write.
  • Added a focused regression test with a fake store that fails the first assistant AddMessage: the engine now treats the response callback as unhandled and redelivers the assistant through TurnCompletedCallback alongside the tool result.

Why this is high-value

Agentic ask persists the assistant message before tool execution so sessions survive tool failures. When that write failed transiently, the callback still returned nil, causing the engine to omit the assistant from the later turn callback. That silently corrupted saved sessions by keeping tool results without the assistant/tool-call message that produced them.

Returning the write error preserves the existing engine recovery contract: a failed response callback means the assistant is included in the turn-completed messages and can be persisted on the retry path.

Validation

  • go test ./cmd -run TestAskPersistenceRetriesAssistantThroughTurnCallbackWhenResponsePersistenceFails -count=1
  • go build ./...
  • go test ./...
  • git diff --check

@sam-saffron-jarvis

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #877. The nightly parser has been updated to semantic-dedupe same-root-cause candidates before launching fix agents, including different titles/wrappers around the same failing callback contract.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant