Skip to content

fix(cli-runner): credit final WebChat internal-sink sends as the source reply - #167736

Merged
obviyus merged 2 commits into
openclaw:mainfrom
Oldrich333:fix/cli-internal-ui-final-credit
Oct 12, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
Oldrich333:fix/cli-internal-ui-final-credit

Conversation

@Oldrich333

@Oldrich333 Oldrich333 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Closes #167709

What Problem This Solves

A Claude CLI WebChat turn can deliver its final answer with message(action=send, final=true) and then return NO_REPLY. The answer reaches the conversation, but the CLI runner still marks the turn as an empty response and WebChat adds an error underneath it.

Credit a confirmed final internal-sink delivery as the source reply without changing automatic final-text selection or replaying the send. Progress sends and transcript-only inter-session sends remain insufficient to complete a required reply. Thanks to @Oldrich333 for reporting the bug and contributing the fix.

Current-main integration

Merged current main before re-proving because the Claude CLI runtime changed substantially since the original contribution. Candidate: 3e1966656ea0fb7c4d528ab0bb4f8962e09e179d. Baseline: exact main parent 232083d2c835b93736e2ef437b8c36a509e6dcf0. The original pinned baseline c3d6aa1aa41a2ae480ce4c05aef4016b92340ad9 was also built and showed the same results.

No overlap with Pash/Sarah changes in either changed file.

Evidence

Built both source snapshots in secretless Docker. Started separate isolated Gateways with explicit profiles, state/config/database paths, and drove the same chat.send RPC used by Control UI. The fake Claude CLI replaces only the CLI process: Gateway startup, MCP HTTP transport, the real message tool, internal WebChat delivery, persistence, and terminal completion are exercised.

The replay emits a real message-tool call with final: true, executes it over MCP, and returns terminal NO_REPLY. Controls emit an actually empty result or normal final text.

Scenario Baseline Candidate
Final message send, then NO_REPLY Answer delivered; terminal error, empty disposition Answer delivered; terminal final, no error
Empty result, no delivery CLI backend returned an empty response. Same error
Normal text FAKE-OK turn 1 Identical text

Focused cli-runner.reliability.test.ts: 59/59 passed, Vitest 28.22 s, complete command 43.17 s. Changed-file oxfmt --check and oxlint passed. Both builds passed. The focused cases include final, progress, and inter-session internal-sink sends.

Observed WebChat excerpts

Identifiers and timestamps omitted; message text and terminal states are unchanged.

BASE chat.history:
  user:      FAKE:delivered
  assistant: DELIVERED-ANSWER-167736
  custom:    Your request couldn't be completed: Agent run failed
BASE agent lifecycle:
  phase=error terminalReply.disposition=empty error="Agent run failed"
BASE chat event:
  state=error errorMessage="Agent run failed" stopReason=error
BASE Gateway:
  cli empty response diagnostics: backend=claude-cli reason=exit exitCode=0

CANDIDATE chat.history:
  user:      FAKE:delivered
  assistant: DELIVERED-ANSWER-167736
CANDIDATE chat event:
  state=final

Each history contains exactly one copy of DELIVERED-ANSWER-167736; neither replays the send. Both actual-empty controls emit state=error with errorMessage="CLI backend returned an empty response.". Both normal-text controls emit state=final with FAKE-OK turn 1.

Additional real-provider check on the built candidate returned LIVE_OK_167736 from OpenAI gpt-5-mini (2,731 input / 23 output tokens). The CLI printed its complete result but remained alive until the harness's 120-second process timeout; this is not reported as a clean process-exit pass.

Merge risk

Two-way door: reverting restores the old completion accounting without a data/config migration. Blast radius is CLI-backed turns with confirmed final internal-sink delivery; ordinary text selection and send execution are unchanged.

…ce reply

claude-cli WebChat turns run in automatic reply mode while targetless message
sends always use the internal-ui sink. The CLI tracker only credited such a send
as the source reply in message_tool_only runs, so message(final=true) followed
by NO_REPLY failed as an empty response after the answer was delivered. The
embedded runner already credits these sends.

Fixes openclaw#167709
@clawsweeper

clawsweeper Bot commented Oct 9, 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 agents Agent runtime and tooling size: S labels Oct 9, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 9, 2026
@clawsweeper

clawsweeper Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

The CLI runner credits a confirmed final internal WebChat send as the completed source reply.

Example: Claude CLI sends DELIVERED-ANSWER-167736 using message(action=send, final=true), then returns NO_REPLY.

  • Before: WebChat displays the answer followed by a failure row.
  • After: WebChat displays the answer once and completes the turn successfully.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused contract-restoring fix with directly relevant Gateway proof, meaningful negative controls, and no open findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (logs): The supplied candidate Gateway trace exercises chat.send, real MCP transport, message execution, internal WebChat delivery, persistence, and finalization with the CLI process substituted; final send followed by NO_REPLY completes without an error or duplicate answer, while empty and normal-text controls retain their outcomes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A WebChat user receives the answer and then sees a false failure row on the answered turn.
Reason: Confirmed delivery of the final current-conversation answer should satisfy the existing required-reply contract.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a concrete WebChat completion-accounting bug that remains on current main; no actionable patch defect was found.

Priority: P2
Reviewed head: 3e1966656ea0fb7c4d528ab0bb4f8962e09e179d

Before merge

None.

Findings

None.

Agent review details

How this fits together

The CLI runner combines captured message-tool delivery results with terminal model output to determine whether the source conversation received its required reply.

flowchart TD
 A[WebChat user turn] --> B[Claude CLI]
 B --> C[Message tool over MCP]
 C --> D[Internal WebChat sink]
 D --> E[CLI delivery tracking]
 B --> F[Terminal NO_REPLY]
 E --> G[Reply completion]
 F --> G
Loading

Technical review

Best possible solution:

Land the focused completion-accounting repair while preserving automatic text selection and the progress and inter-session exclusions.

Do we have a high-confidence way to reproduce the issue?

Current-main source and the supplied baseline trace establish the automatic-mode delivery-credit gap followed by required NO_REPLY rejection; this read-only review did not execute a reproduction.

Is this the best way to solve the issue?

The patch corrects the CLI evidence consumer using the existing internal-sink delivery contract, without replaying delivery or replacing automatic final text.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 81ad3bf71935.

Provenance checked

  • CLI message-tool finality keeps the original intent (cd7b7f6: Allow progress before the final source reply while keeping automatic reply selection unchanged.)
  • Required-reply completion coverage keeps the original intent (4f0541e: Prevent unfinished internal work from ending silently while preserving verified message-tool replies and owned continuations.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +80. Total +80 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 80 0 +80
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 80 0 +80

Review metrics

Metric Value Why it matters
Production versus test growth Production +11 lines; tests +69 lines A small accounting correction and three distinct completion cases justify the growth without adding configuration or another delivery owner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #167709
Summary: This PR fixes the linked delivered-answer accounting report; scheduler silence without a send has a separate cause.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A bounded Claude CLI reply pattern records failure after successfully delivering a WebChat answer.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-09T09:07:22.733Z sha af1dec7 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-10T05:18:17.826Z sha af1dec7 :: needs maintainer review before merge. :: none

Reviewed October 12, 2026, 7:00 PM ET / 23:00 UTC (Revision 3).

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 10, 2026
@obviyus

obviyus commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Oct 12, 2026
@obviyus
obviyus merged commit a2fd4c5 into openclaw:main Oct 12, 2026
134 of 136 checks passed
@obviyus

obviyus commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

Landed in a2fd4c5. Thanks @Oldrich333, delivered Claude CLI answers no longer show an empty-response error.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…ce reply (openclaw#167736)

In WebChat, a Claude CLI turn that delivered its final answer through the message tool and then ended with NO_REPLY was also reported as an empty-response failure, so chat history showed the answer followed by an error. Tool tracking now records that delivery, so the turn counts as answered. A genuinely empty turn still fails, and the answer isn't duplicated. Proof: built candidate and main parent 454a12c in Docker; WebChat chat.send through the real MCP message tool, then NO_REPLY. On main, history held one answer followed by an error; with the PR, one answer and no error. An empty-result control errored on both, and a normal text answer was identical. Excerpts are in the PR description. Fixes openclaw#167709. Thanks @Oldrich333.

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

Labels

agents Agent runtime and tooling P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

2 participants