Repository navigation
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Approach: sound — persist committed transcript checkpoints and terminal-failure closure while avoiding failure writes on retryable errors.
Reviewed changes The initial PR diff was reviewed across all 18 changed files:
- Progress and failure persistence:
AgentRunsaves model/tool progress, accepted steering, and terminal failure histories;messagesOf(error)exposes history for callers usingmessages. - Conversation protocol:
LazyStateConversationand validation support appends that leave calls open, live reads and compaction over those histories, and recovery of calls left open by a killed invocation. - Coverage and docs: tests exercise progress visibility, cancellation and failure, recovery, compaction, and replay; examples and skill references document the behavior and retry implications.
Important
This run used your free trial credits ($9.08 of $10 left) on GPT Luna, a fast, lightweight model. Connect a provider → to run the model you choose.
gpt-6-luna (free trial credits) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes This run reviewed the invocation-scoped state-read cache added since the prior Pullfrog review.
- Journal-read caching: Added a
contextLocalcache shared acrossLazyStateConversationinstances using the same store, and updated it after writes to avoid re-reading journaled state keys during loads, compaction, and saves. - Snapshot behavior: Added coverage for cache reuse within an invocation and refresh in a later invocation, and documented that repeated reads within one invocation use the first-read snapshot.
Important
This run used your free trial credits ($8.93 of $10 left) on GPT Luna, a fast, lightweight model. Connect a provider → to run the model you choose.
gpt-6-luna (free trial credits) | 𝕏

Save the conversation while a run is active, and when it fails
run(input, {conversation})saved once, infinish(), and a failed run saved nothing. An application with a live UI, such as the Restate reference agent (restatedev/agent), needs two things this didn't provide:LazyStateConversation.page().With this change, a run saves as it goes and saves on failure.
When a run saves
afterRunaccepts it.Each save appends the new part of the committed transcript, so the stored conversation stays the full, uncompacted record. Error notes, rejected answers and in-run compaction views are never saved. A run with one tool step makes three appends. A run that answers in one step makes two.
When a run fails
When a terminal error fails the run, such as an
AgentTerminalError, a terminal model error or a cancelled invocation, the run:cancelledresult with the messageRun failed: <reason>.run-cancelledfor a cancelled invocation:{"source": "agent-runtime", "type": "run-failed", "message": "model unavailable"}Some failures save nothing:
beforeRunaccepts its input records nothing. ThrowingAgentTerminalErrorfrombeforeRunstill keeps the input out of the history, as documented.ConversationConflictErrorskips the failure save, because saving would conflict again.The gen SDK allows journal calls after a caught
CancelledError, so a cancelled run saves too. An integration test cancels a real invocation mid-tool.New export:
messagesOf(error)returns the failed run's history, with the closed calls and the note, for every run. It works likeusageOf(error). A run that usesmessagescan pass this history to the next run.Tool calls without results in storage
A batch's calls are saved before their results, so while a batch runs, the stored history ends with calls that have no results:
LazyStateConversation.load(),prepareCompaction()andapplyCompaction()accept that history. The compaction boundary already stays before calls without results.append()accepts messages that start with results for the calls the previous append left open. The metadata records those calls in a new optionalopenfield. Conversations saved before this change don't have the field, which is correct because they always end complete.checkProtocolreturns the unfinished calls instead of throwing.history()throws a newUnfinishedToolCallsError, aRunInputError, unless{unfinished: true}allows them.Only a killed invocation leaves such a history behind: a retry replays and finishes the batch, and a failed run closes its calls. The next run closes them with a
cancelledresult saying that the call may have taken effect, and its first save stores those results. The repair runs only whencheckProtocolreports unfinished calls. A comment oncontinuedHistoryexplains how to replace the full-history check with a check of the last assistant message.Behavior changes for callers
conversationnow leaves its turn in the conversation.steeringprogress event is emitted after its note is saved.Tests
conversation-progress.test.ts:messagesOffor amessagesrun, and the number of appends.conversation-replay.test.ts: a completed run and a failed run, resumed from every journal entry with a store that journals its reads and writes. The output and the stored conversation are identical every time.runtime.integration.ts, with always-replay:errors.test.ts: anAgentTerminalErrorfrom any site now leaves a loadable conversation that ends with the failure note. The exception isbeforeRun, which still records nothing.pnpm build, the 353 unit tests, and the runtime, AG-UI, examples and coding-agent integration suites pass.Docs
CONTEXT.md("Conversation").conversations-and-controls.md,error-handling.md,approvals-and-guardrails.mdandagent-basics.md.🤖 Generated with Claude Code