Skip to content

fix: show Waiting and Resumed for Claude CLI subagent handoffs - #206158

Merged
obviyus merged 4 commits into
mainfrom
bugloop-206107
Nov 26, 2026
Merged

obviyus merged 4 commits into
mainfrom
bugloop-206107

Conversation

@obviyus

@obviyus obviyus commented Nov 26, 2026 •

Copy link
Copy Markdown
Collaborator

Root cause: ui/src/pages/chat/chat-sessions-yield.ts:44 compares raw tool names with sessions_yield, which misses the mcp__openclaw__sessions_yield name that Claude CLI history keeps. src/gateway/cli-session-history-index-policy.ts mergeCliHistoryRow sends native Claude rows to chat.history with no run identity, even though the merge already links each local user turn (<runId>:user) to its native prompt.

Fixes #206107

Thanks @fubarfu for the report and the clear Codex comparison.

What changes for users

In Claude CLI sessions, Control UI now shows "Waiting for subagents" after sessions_yield while the child runs, and "Resumed · … later" after the child wakes the parent, the same as embedded and Codex sessions. The private Yield call no longer shows as a tool row.

The "Outcome unknown" rows in the report are already fixed on main by #203877. This PR doesn't touch them. On both main and this branch, tool rows show their real outcome, and a failed tool call shows as failed.

Why

  • Claude CLI calls OpenClaw tools over MCP, and its history keeps the bridged name on purpose (unwrapToolCallForDisplay). The yield handoff scanner was the one reader that compared raw names, so it never confirmed the yield. It now uses the existing stripOpenClawMcpToolPrefix. The paired, completed, non-error and yielded receipt checks are unchanged.
  • The waiting line and the Resumed rule both need the run that handed off. Embedded and Codex rows carry __openclaw.runId. Imported Claude rows carried none. The history merge now gives an unmatched native row the run of the local user turn whose native prompt it answers. The only link it uses is the one the merge already has: the prompt's external id matched to the local user row with <runId>:user. Synthetic (meta) wake prompts end a turn but stay hidden, so rows of a wake run never inherit the earlier run. The transient prompt anchor is removed at merge, and nothing is stored: the index is the in-memory display projection. There are no schema or transcript changes.

Evidence

Docker (secretless node:24.22.1) Gateway + Control UI built from each SHA. Agent on claude-cli with a stand-in claude that emits the Claude Code stream-json and project JSONL contract and calls the real OpenClaw MCP server as mcp__openclaw__session_status, mcp__openclaw__sessions_spawn and mcp__openclaw__sessions_yield. Real Chromium. Main and this branch were each run twice, with controls on an embedded-runtime session and a failed claude-cli tool call. Results and screenshots: #206158 (comment)

Regressions (each red on main, green here):

  • ui/src/pages/chat/chat-sessions-yield.test.ts: an imported Claude CLI call with its result is confirmed as a pending handoff.
  • src/gateway/cli-session-history.test.ts: native JSONL through the merge gives the turn's run to its tool rows, no run to rows after a meta wake, and no anchor in the output.

@clawsweeper

clawsweeper Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: S labels Nov 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. labels Nov 26, 2026
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Evidence at head 8b19c79 (main 9239eeb base). Docker Gateway and Control UI, claude-cli stand-in calling the real OpenClaw MCP tools under mcp__openclaw__ names, real Chromium. Main and head were each run twice.

case / side                         while child (live, reload)   after wake (live, reload)    Yield row   Outcome unknown
claude-cli yield  main run1         Waiting 0, 0                 Resumed 0, 0                 shown       0
claude-cli yield  main run2         Waiting 0, 0                 Resumed 0, 0                 shown       0
claude-cli yield  head 8b19c79b62 run1         Waiting 1, 1                 Resumed 1, 1 ("Resumed · 21s later · Agent finished")  hidden  0
claude-cli yield  head 8b19c79b62 run2         Waiting 1, 1                 Resumed 1, 1                 hidden      0
control embedded yield  main x2 / head x2   Waiting 1, 1         Resumed 1, 1                 hidden      0  (identical)
control claude-cli failed session_status (unknown sessionKey) main x2 / head x2: row "Check chat status ... TOOL ERROR Unknown sessionKey ... failed", reply "Status lookup failed."; never success, 0 unknown.
Runs: proofs/206107/runs/{base-1-20261127T014003,base-2-20261127T014203,final-1-20261127T021000,final-2-20261127T021156}/ (earlier head 73f7b7c117 gave the same table, runs/old/cand2-*) (drive.json, *.txt pane text, *.png, history-*.json, gateway.log).

main: claude-cli while child runs (no waiting, Yield row shown)

main: claude-cli after wake (no Resumed)

fix: claude-cli while child runs (Waiting for subagents)

fix: claude-cli after wake (Resumed 21s later)

control: embedded runtime unchanged

control: failed claude-cli tool shows failed

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 26, 2026
@obviyus
obviyus merged commit 6b3ccab into main Nov 26, 2026
182 of 184 checks passed
@obviyus
obviyus deleted the bugloop-206107 branch November 26, 2026 20:56
@obviyus

obviyus commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 6b3ccab. Control UI now shows "Waiting for subagents" and "Resumed" for Claude CLI sessions after sessions_yield, and hides the private Yield row, the same as other runtimes. The "Outcome unknown" part of #206107 was already fixed on main by #203877. Thanks @fubarfu for the clear report and the runtime comparison.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 27, 2026
…law#206158)

Root cause: ui/src/pages/chat/chat-sessions-yield.ts:44 compares raw tool names with `sessions_yield`, which misses the `mcp__openclaw__sessions_yield` name that Claude CLI history keeps. src/gateway/cli-session-history-index-policy.ts `mergeCliHistoryRow` sends native Claude rows to chat.history with no run identity, even though the merge already links each local user turn (`<runId>:user`) to its native prompt.

Fixes openclaw#206107

Thanks @fubarfu for the report and the clear Codex comparison.

## What changes for users

In Claude CLI sessions, Control UI now shows "Waiting for subagents" after `sessions_yield` while the child runs, and "Resumed · … later" after the child wakes the parent, the same as embedded and Codex sessions. The private Yield call no longer shows as a tool row.

The "Outcome unknown" rows in the report are already fixed on main by openclaw#203877. This PR doesn't touch them. On both main and this branch, tool rows show their real outcome, and a failed tool call shows as failed.

## Why

- Claude CLI calls OpenClaw tools over MCP, and its history keeps the bridged name on purpose (`unwrapToolCallForDisplay`). The yield handoff scanner was the one reader that compared raw names, so it never confirmed the yield. It now uses the existing `stripOpenClawMcpToolPrefix`. The paired, completed, non-error and `yielded` receipt checks are unchanged.
- The waiting line and the Resumed rule both need the run that handed off. Embedded and Codex rows carry `__openclaw.runId`. Imported Claude rows carried none. The history merge now gives an unmatched native row the run of the local user turn whose native prompt it answers. The only link it uses is the one the merge already has: the prompt's external id matched to the local user row with `<runId>:user`. Synthetic (meta) wake prompts end a turn but stay hidden, so rows of a wake run never inherit the earlier run. The transient prompt anchor is removed at merge, and nothing is stored: the index is the in-memory display projection. There are no schema or transcript changes.

## Evidence

Docker (secretless node:24.22.1) Gateway + Control UI built from each SHA. Agent on `claude-cli` with a stand-in `claude` that emits the Claude Code stream-json and project JSONL contract and calls the real OpenClaw MCP server as `mcp__openclaw__session_status`, `mcp__openclaw__sessions_spawn` and `mcp__openclaw__sessions_yield`. Real Chromium. Main and this branch were each run twice, with controls on an embedded-runtime session and a failed claude-cli tool call. Results and screenshots: openclaw#206158 (comment)

Regressions (each red on main, green here):
- `ui/src/pages/chat/chat-sessions-yield.test.ts`: an imported Claude CLI call with its result is confirmed as a pending handoff.
- `src/gateway/cli-session-history.test.ts`: native JSONL through the merge gives the turn's run to its tool rows, no run to rows after a meta wake, and no anchor in the output.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* fix: preserve completed Claude tool calls in chat history

* fix: preserve completed Claude tool calls in chat history

OpenClaw-Publication: d3a267f1-3ba5-4fc9-a4dd-3968148f8eb1
(cherry picked from commit a27b4e6)

Follow-ups: 49492d7 fix: align Control UI tooling and docs with task card removal (#207747) [not selected for this narrow backport]; cebbb78 fix: keep tagged silent replies out of chat (#207738) [not selected for this narrow backport]; d4e1305 fix: hide desktop Details when there is nothing to show (#205093) [not selected for this narrow backport]; 11b2cf0 fix: keep the selected Review file compact when the tree is open (#203825) [not selected for this narrow backport]; 4be636b feat(ui): offer Add to Home agent when Home sidebar is open (#207773) [not selected for this narrow backport]; f766de4 fix: surface favorites and recommended models in picker search (#201450) [not selected for this narrow backport]; 61a7661 improve(ui): remove suggested-task cards from Control UI (#199167) [not selected for this narrow backport]; 48cc039 fix: keep long process names compact above mobile output (#203767) [not selected for this narrow backport]; 9316f05 fix: show the first message when session naming fails (#205607) [not selected for this narrow backport]; aa4a68f fix(ui): show chat completions as activity rows (#201891) [not selected for this narrow backport]; ec209d0 fix(ui): link selection sessions to their source session (#206509) [not selected for this narrow backport]; 3f475cc fix(ui): keep pre-final assistant text visible after a completed turn (#140835) [not selected for this narrow backport]; 05ec989 fix: keep chat photo previews sharp within their byte limits (#206461) [not selected for this narrow backport]; b3bdfb5 feat(ui): preview CSV chat attachments as tables (#206148) [not selected for this narrow backport]; 6b3ccab fix: show Waiting and Resumed for Claude CLI subagent handoffs (#206158) [not selected for this narrow backport]; 762aa00 fix: keep dictation recording when switching tabs or applications [not selected for this narrow backport]; d3f9fca fix: keep similar subagent names distinct in compact rows (#203777) [not selected for this narrow backport]; 864efbb improve: keep composer error cards on one line (#204337) [not selected for this narrow backport]; d7ed2dd fix: stop replaying Claude progress updates in active chats (#203970) [not selected for this narrow backport]; 269f884 fix: show Claude CLI document uploads only once in chat (#203866) [not selected for this narrow backport]; 4708bac fix(ui): show Linear artwork in chat tool activity (#204414) [not selected for this narrow backport]

Co-authored-by: RomneyDa <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 30, 2026
* fix: show Claude CLI document uploads only once in chat

* fix: show Claude CLI document uploads only once in chat

OpenClaw-Publication: 4555cb04-bff2-43b3-aff8-ec271d6567b2

* fix: keep Claude document uploads on the message that sent them

* fix: preserve the released message queue result contract

Release adaptation: Use an optional accepted-input observer instead of widening
queueMessage's released Promise<void> contract. Reuse the stable steering and
transcript-rewrite handlers; leave source admission, native image steering,
config, and all SQLite schemas unchanged. The existing history index columns
also carry exact document correlation. Keep the released model-hook test layout.

Companion audit through be407a4: no later #203866 reference. PRs #208535
(Claude compacted fork summaries), #206158 (native subagent status), and
#205663 (image dimensions) are separate. PRs #208252 (Codex source), #207022
(embedded prompt dispatch), #206969 (fallback), #205963 (Copilot question
policy), and 50a7368 (snooze) do not own this path. SHA mentions in
#204700 and #204685 are update/qualification records, not follow-ups.

(cherry picked from commit 269f884)

Co-authored-by: RomneyDa <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. gateway Gateway runtime impact:ux-friction User-facing flow adds avoidable confusion or support burden without fully blocking progress. P2 Normal backlog priority with limited blast radius. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Control UI shows "Outcome unknown" for all claude-cli tool calls, so sessions_yield never shows "Waiting on…" / "Resumed"

1 participant