Skip to content

fix(acp): recover saved sessions on the execution host - #4030

Merged
wgqqqqq merged 2 commits into
openBitFun:mainfrom
guantw:fix/acp-saved-session-recovery
Nov 23, 2026
Merged

wgqqqqq merged 2 commits into
openBitFun:mainfrom
guantw:fix/acp-saved-session-recovery

Conversation

@guantw

@guantw guantw commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

This fixes the remaining session recovery problems reported in #3923, which is already closed. A running ACP turn could already reappear when switching back to its view. Output accepted while the view was detached could still be missing from saved history, and reconnecting could leave those gaps in place.

The executing host now keeps each admitted turn across view switches, journals its text, thoughts and tool events, and retains them until the terminal turn is saved to conversation history. Reopening reads the saved transcript and the host's execution state. When history has a gap, the host loads the original agent session and assigns replayed replies by message ID or, for older sessions, by a unique ordered match against the prompts actually sent. Ambiguous replies leave the gap open. Releasing the session during agent startup or history loading prevents an admitted prompt from being sent.

Verification

  • 54 ACP client tests passed. The 28 cases in client::manager::recovery_tests exercise legacy reopen, interrupted history, reply ownership for repeated prompts and release before send.
  • 18 session event journal tests and the turn catalog restore test passed, covering retention until a history checkpoint succeeds and reconstruction of the saved turn catalog.
  • 662 Web UI tests across nine suites passed, covering ACP options, session hydration, queue recovery and checkpoint ownership. Web UI type checking and the localization audit also passed.
  • The macOS Desktop workload node tests/e2e/scripts/run-acp-queue-recovery.mjs passed all 10 scenarios with a controlled ACP agent over stdio. It verified that a view switch preserves the running prompt, a reload drains its queue once, and an agent exit reconnects and drains the follow-up.

guantw and others added 2 commits November 23, 2026 16:37
Keep admitted turns and their output on the host until terminal history
is saved. Reopen the original agent session to repair missing history,
using message IDs or a unique alignment of saved prompts to place replies.

Retire an admitted turn on release before its prompt can reach the agent.
@wgqqqqq
wgqqqqq merged commit e9c6675 into openBitFun:main Nov 23, 2026
13 checks passed
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.

2 participants