gateway: replay and redelivery lose tool activity, showing duplicate answers without tools #1385

Closed
opened 2026-10-27 13:40:11 +00:00 by sam · 0 comments
Owner

The replay paths (TurnClaimCompleted, prior-reply) emit stream.Delta(ResponseText) only — never stream.ToolCall — and neither the ledger (TurnRecord) nor the session store persists tool activity. A completed-duplicate delivery (NATS redelivery, restart RecoverTurns re-delivery) finalizes a fresh liveReply with empty toolLines and sends the bare reply as a new message: the transcript shows the original (with tools) and the duplicate (without) side by side, disagreeing about what ran. Web history has the same gap — stored assistant messages render text only.

Failure: a chat message is redelivered or re-queued after restart; the user sees the same answer twice, the second copy lacking the tool block that explains it.

Design

Decide whether tool activity should be persisted (ledger/session store) and replayed, or whether replays simply should not re-narrate tools. If persisting, add a tool-activity record to the turn/message and replay it; if not, make the replay path explicitly consistent and document the choice.

Acceptance criteria

A redelivered/restarted turn does not show a tool-less duplicate disagreeing with the original; the behavior is explicitly decided and tested.

Close reason

Fixed: TurnRecord now persists tool-call activity alongside ResponseText; the completed-duplicate replay path replays it via stream.ToolCall before the text. Prior-reply fallback documented as deliberately text-only (crash race with no persisted tool record). Commit 86a9731, task check clean, adversarial review clean (0 findings). [Closure restored 2026-08-24: originally closed 2026-08-22, lost when the beads DB was rebuilt (.beads.backup-pre-recovery).]


Imported from beads archie-core-ippu · GitHub #488 · type bug · priority P2 · created 2026-08-14 · closed 2026-08-24

The replay paths (TurnClaimCompleted, prior-reply) emit stream.Delta(ResponseText) only — never stream.ToolCall — and neither the ledger (TurnRecord) nor the session store persists tool activity. A completed-duplicate delivery (NATS redelivery, restart RecoverTurns re-delivery) finalizes a fresh liveReply with empty toolLines and sends the bare reply as a new message: the transcript shows the original (with tools) and the duplicate (without) side by side, disagreeing about what ran. Web history has the same gap — stored assistant messages render text only. Failure: a chat message is redelivered or re-queued after restart; the user sees the same answer twice, the second copy lacking the tool block that explains it. ### Design Decide whether tool activity should be persisted (ledger/session store) and replayed, or whether replays simply should not re-narrate tools. If persisting, add a tool-activity record to the turn/message and replay it; if not, make the replay path explicitly consistent and document the choice. ### Acceptance criteria A redelivered/restarted turn does not show a tool-less duplicate disagreeing with the original; the behavior is explicitly decided and tested. ### Close reason Fixed: TurnRecord now persists tool-call activity alongside ResponseText; the completed-duplicate replay path replays it via stream.ToolCall before the text. Prior-reply fallback documented as deliberately text-only (crash race with no persisted tool record). Commit 86a9731, task check clean, adversarial review clean (0 findings). [Closure restored 2026-08-24: originally closed 2026-08-22, lost when the beads DB was rebuilt (.beads.backup-pre-recovery).] --- _Imported from beads `archie-core-ippu` · GitHub #488 · type bug · priority P2 · created 2026-08-14 · closed 2026-08-24_
sam added the mediumbug labels 2026-10-27 13:40:11 +00:00
sam self-assigned this 2026-10-27 13:40:11 +00:00
sam closed this issue 2026-10-27 13:40:11 +00:00
sam added a new dependency 2026-10-27 13:42:09 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Reference: sam/archie#1385