agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

Orchestrator won't switch from Terminal to Chat UI: "native submission attachment not flushed", then "resume chat: context deadline exceeded" on retry

Open GabrielGoncalvesICE opened this issue 1 month ago • 1 comments

The orchestrator session of my project (a Claude Code session in Terminal UI) will not switch to Chat UI. The first attempt failed with:

Interface switch failed switch interface smarthow-gtm-12: resume chat: wait for native checkpoint: claude native checkpoint: native submission attachment not flushed: chat conversation history is not settled: checkpoint mismatches [unsettled_turn_boundary]: context deadline exceeded

I clicked Retry switch to Chat UI and it failed again, this time with:

switch interface smarthow-gtm-12: resume chat: context deadline exceeded

The session stays in Terminal UI. Environment: AO desktop 0.14.3-nightly.202610161732 on macOS 26.5.

Agent-collected evidence (including a structural reproduction of the checkpoint check against the real transcript) is in the first comment.

GabrielGoncalvesICE avatar Oct 17 '26 08:10 GabrielGoncalvesICE

Agent-collected evidence

Collected by a local Claude Code agent on 2026-10-17 around 08:25–08:40 UTC, using read-only queries against the reporter's installation. Message text is redacted throughout; only structure, IDs, and lengths are shown.

Installation

  • App bundle 0.14.3-nightly.202610161732; ao --version reports dev (bundled binary at /Applications/Agent Orchestrator.app/Contents/Resources/daemon/ao). ao status --json: state ready, port 3001, data dir ~/.ao/data.
  • I read the source at main fb6497f (2026-10-17). It can't be matched exactly to the nightly build, so treat line references as approximate.
  • Affected session: smarthow-gtm-12, kind orchestrator, harness claude-code, session_mode=tui, conversation_checkpoint_unsettled=1.

Transitions (session_interface_transitions, read-only)

created_at (UTC) dir phase error_code duration
08:08:16 chat→tui completed 7s
08:19:34 tui→chat failed TARGET_HISTORY_UNSETTLED (native submission attachment not flushed) 5.1s
08:23:52 tui→chat failed TARGET_RESUME_FAILED (resume chat: context deadline exceeded) 6.6s

The same install has older tui→chat failures on other Claude sessions with the sub-reasons observed native turn not completed (covered by #6700 / #6216), ambiguous native prompt ID (#5661), and missing or invalid owned observations. Each of those runs also has a nearby bare TARGET_RESUME_FAILED … context deadline exceeded.

What the checkpoint evidence contains. sessions.native_checkpoint_evidence holds 10 observations. Three are submissions that share one promptId:

event 0 submission 1f060611… promptId 6b9dcf9a
event 1 submission 6212507e… promptId 6b9dcf9a
event 2 submission def249b3… promptId 6b9dcf9a
event 3 Stop                  promptId 6b9dcf9a
... (later prompts 43dca11a, 514a3e36, cbe81fe9: one submission + one Stop each)

How Claude wrote them in the transcript. Events 1 and 2 were AO deliveries that arrived while Claude was mid-turn on prompt 6b9dcf9a. Claude Code did not write a new user record for them. It queued them, and each got a queued_command attachment followed by the UserPromptSubmit hook_additional_context attachment that carries the AO correlation ID:

678  user                                   promptId 6b9dcf9a   08:09:13   <- turn start
684  attachment hook_additional_context (UserPromptSubmit)      <- event 0 correlation
782  queue-operation                                            08:09:29
788  attachment queued_command                                  <- event 1 text
789  attachment hook_additional_context (UserPromptSubmit)      <- event 1 correlation
800  queue-operation                                            08:11:51
804  attachment queued_command                                  <- event 2 text
805  attachment hook_additional_context (UserPromptSubmit)      <- event 2 correlation
...  assistant … stop_reason end_turn
885  user                                   promptId 43dca11a   <- next real turn

All six correlation IDs are present on the main chain (578 of 581 records; no compact_boundary).

Structural reproduction of verifyCheckpointTranscript. Go was not available, so I ported the function's chain walk, turn grouping, and submission matching to Python. I ran the port against a copy of the evidence and the real transcript:

event 0 1f060611 -> turn line 678  textMatch True   obsLen 155 turnLen 155
event 1 6212507e -> turn line 678  textMatch False  obsLen 62  turnLen 155
event 2 def249b3 -> turn line 678  textMatch False  obsLen 468 turnLen 155
event 4 e8f3982f -> turn line 885  textMatch True
event 6 1e303254 -> turn line 939  textMatch True
event 8 3009986c -> turn line 986  textMatch True

In backend/internal/adapters/chatdriver/claudeacp/checkpoint.go, a hook_additional_context attachment is mapped to turns[len(turns)-1], the turn currently in progress. Only type == "user" records open a turn, so queued submissions 1 and 2 are matched against the text of prompt 6b9dcf9a. That fails NativeCheckpointTextMatches, and the check returns checkpointUnsettled("native submission attachment not flushed").

What this supports, and its limits

  • The failure is not a flush race. Both queued attachments were written about 10 minutes before the switch, so the transcript was already complete. AppendNativeCheckpoint keeps unresolved observations, so retries should keep failing the same way. That fits the reporter's repeated failures. The 3s budget in service/chat/native_checkpoint.go is not the cause here; it only adds context deadline exceeded to the end of the message.
  • Hypothesis, not verified: the retry's bare resume chat: context deadline exceeded (TARGET_RESUME_FAILED) may be the same blocker. If the 3s context expires while verifyCheckpointTranscript is still scanning (this transcript is 3 MB), it returns raw ctx.Err() without the unsettled wrapper. session_manager/interface_transition.go then maps it to TARGET_RESUME_FAILED. No daemon log was available to confirm this; daemon stderr is not persisted on this install.
  • This looks like the same class of problem as the queued ao send case in #6200 / PR #6216 ("two queued prompts answered in one end_turn reply"). That PR covers observed native turn not completed. This is the native submission attachment not flushed branch. Here Claude Code writes the queued input as a queued_command attachment, not as consecutive user records. I did not check whether #6216 would also fix this case.

Duplicate search (OrchestratorInc/agent-orchestrator, issues and PRs, all states): searched native submission attachment not flushed (no hits), chat conversation history is not settled, unsettled_turn_boundary, Interface switch failed, resume chat: context deadline exceeded, switch to Chat UI, native checkpoint. I read #6700, #6200, #5661, #6216, and #6387. None covers this sub-reason.

Not done: no session restart, no switch retries beyond the reporter's own, no live data changes, no full transcript or DB attached. The port script and redacted evidence are stored locally on the reporter's machine (not attached).

GabrielGoncalvesICE avatar Oct 17 '26 08:10 GabrielGoncalvesICE