Checkpoint live session updates during prompt turns#314
Open
AndroidPoet wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #304.
Summary
This makes the persisted session record track live prompt progress instead of only the prompt submission and final turn state.
The change adds a small debounced checkpoint helper and wires it into both prompt execution paths:
src/cli/session/runtime.tssrc/runtime/engine/manager.tsWhen ACP
session/updateevents arrive, the in-memory conversation is still updated first, but now a live checkpoint is scheduled after that mutation. The checkpoint also flushes pending ACP wire messages before saving, so the event stream and session record move forward together.There is also an immediate checkpoint after reconnect/load resolution. That makes fields like
agentSessionIdvisible before the prompt finishes, instead of waiting for the turn close path.Why this shape
I avoided reading Codex rollout JSONL files. That would fix the reported Codex case, but it would make
acpxdepend on one adapter's private logs. This stays inside the ACP runtime and applies to any adapter that emitssession/updatenotifications.The live saves are debounced at 500ms so token-by-token streams do not write the session JSON file for every chunk. Boundary saves still flush immediately where it matters: after session resolution and on close/finalization.
Tests
pnpm run typecheckpnpm run lintpnpm run testAdded integration coverage for:
sessions readseeing assistant output while a foreground prompt is still sleeping--no-wait --file -stdin prompts checkpointing assistant output before the detached turn finishes