Skip to content

fix(agents): answer replaced by a restated blocker after the plan completion check - #164896

Merged
obviyus merged 1 commit into
mainfrom
fix/plan-check-no-restatement
Oct 5, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/plan-check-no-restatement

Conversation

@obviyus

@obviyus obviyus commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes: after a multi-step turn that ends by asking the user for approval, the answer is replaced (or followed) by a short restatement of the blocker when the run's progress card still has a pending step.

On our setup (Telegram forum topic, openai/gpt-6-astra) the topic showed the answer and then a second bubble: "The remaining step is getting the seller's confirmation and quote. That requires your permission to contact them; I haven't sent an enquiry or placed an order." On a Telegram Test Server DM with origin/main, the same shape delivers only the restatement. The answer with the actual results never arrives.

User Impact

A reply that already explains why work stopped (approval, user input, an external dependency) stays the turn's only reply. A plan that the agent genuinely abandoned early still gets the completion check and the agent keeps working. No new messages, notices, or settings.

Why This Change Was Made

Root cause, with provenance:

  • fix: recheck unfinished plans before an agent stops #160297 (3ba0a0b) added one completion self-check before a run ends with an unfinished saved plan. Its rationale: "an agent can end its reply while its newly saved plan still lists unfinished, authorized work, leaving the session idle. … The built-in agent gets one chance to reconsider that stop: continue feasible work, reconcile the plan, or explain a concrete blocker. This can add one model response."
  • The injected check (attempt-stream-prepare.ts, openclaw.plan-completion-check) tells the model: "If user input, approval, an external dependency, or an explicit pause prevents further work, report that concrete limitation." When the stop was legitimate and the reply already asked for approval, the model obeys and writes a fresh report.
  • That fresh text becomes the run's final answer (the check continues the same run, and the payload owner uses the latest answer). Non-streamed delivery loses the original answer. When the original was already visible, the user gets a second bubble.
  • The gate can't tell a legitimate stop from a premature one. Only the model can, so the decision stays with the model.

Fix: one bounded edit to the existing check text: "…report that concrete limitation; if your previous reply already reported it, end with only NO_REPLY." With #164774 (now on main), an answer followed by a NO_REPLY stop keeps the earlier answer as the reply. The check's follow-up is a custom message, not user input, so it doesn't reset that answer. Continuing, reconciling, and reporting a blocker that wasn't mentioned all work as before.

Not changed (decisions kept from #160297): the check's gates, its once-per-run budget, cancellation/steering/approval/child/media precedence, and "a checkpoint already shown in chat stays in the conversation".

Rejected alternative: skipping the check when an answer was already delivered or kept. Without deferred terminal delivery the stop answer is already visible on streaming channels, so that would turn the check off there. It also depends on the response's split shape, not on whether the work is done.

Evidence

Live: Telegram Test Server DM, isolated gateway, real openai/gpt-6-astra over openai-responses through a forwarding proxy (forwards and logs only), Telegram streaming.progress with toolProgress + commentary (as on our setup). Prompt: "tidy your workspace with a three-step progress card: list files, report sizes, delete the largest; do steps 1–2, ask me before deleting." Bubble counts are the recorder's SUT message rows after the sent message, excluding the progress draft that is deleted when the answer lands.

origin/main d7f9ebd (includes #164774) this PR 807e2cb
Model answer (transcript) file table (23 files, sizes) + "Do you explicitly approve deleting BOOTSTRAP.md?" file table (23 files, sizes) + "Do you explicitly approve deleting BOOTSTRAP.md?"
openclaw.plan-completion-check injected yes yes
Model reply to the check "Step 3 remains pending: deleting BOOTSTRAP.md (7,479 bytes) requires your explicit approval. Your latest message does not grant it, so nothing has been deleted. Do you approve deleting BOOTSTRAP.md?" (53 output tokens) NO_REPLY (6 output tokens)
SUT messages in Telegram after the progress draft retires 1: the restatement only (199 chars), no file table 1: the original answer (1,396 chars) with the file table and the approval question
gpt-6-astra requests 8 8

#164774 alone doesn't fix this: current main includes it and still delivers only the restatement, because the check's reply is a real answer, not NO_REPLY.

#160297's intent still holds, live on this PR head 807e2cb. Prompt: three file steps, "do the work yourself, without subagents. Do step 1 only, then end this reply with a one-line checkpoint; steps 2 and 3 are authorized and required". The model stopped with "Checkpoint: 1/3 complete—notes/a.txt contains exactly alpha (5 bytes)…; steps 2 and 3 remain pending." The check was injected. The model then read, wrote notes/b.txt, verified, completed the card (3/3), and answered "All 3 steps complete and committed … Total file content in notes/: 9 bytes". Telegram showed exactly one SUT message: that final answer. The checkpoint never reached chat on its own.

Regression (attempt-plan-completion.test.ts, real session loop + real progress-card tool + payload builder): the stand-in model restates the blocker unless the check text offers silence, which matches the live behavior above. It fails without this change (payload is the restatement) and passes with it (payload is the original answer). pnpm test src/agents/embedded-agent-runner/run/attempt-plan-completion.test.ts --maxWorkers=1 on 807e2cb: 21 passed, 34.5 s local.

LOC vs origin/main: production +1/−2 (one string, reformatted), docs +3/−2, tests +66.

Review: a fresh adversarial reviewer pass (gpt-6-astra) on 807e2cb, after the rebase onto main, returned VERDICT: LAND with no findings.

Bounded cost

  • Same request count as before: the check still costs exactly one follow-up model response per run. In the live runs above both sides made 8 gpt-6-astra requests; the check's reply dropped from 53 to 6 output tokens.
  • No new requests, timers, state, or settings; the check text grows by one clause (~15 tokens) only on runs that already get the check.
Not the progress narrator

The stray text is the main model's reply to the injected check (transcript seq after openclaw.plan-completion-check, plus its delivery-mirror row). Telegram never wires onNarrationUpdate, so the utility-model narrator can't post there. A separate burst of ~40 utility-model calls after a reply in an earlier proof run was the gateway Activity recap paging a seeded backlog (src/gateway/session-activity-summaries.ts, MAX_CALLS_PER_HOUR = 40). It is unrelated to this PR.

@clawsweeper

clawsweeper Bot commented Oct 4, 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 docs Improvements or additions to documentation agents Agent runtime and tooling size: S labels Oct 4, 2026
@obviyus

obviyus commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 4, 2026
@clawsweeper

clawsweeper Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 3:03 AM ET / 07:03 UTC (Revision 4).

ClawSweeper review

What this changes

The agent’s plan completion check can end silently when the preceding answer already explains the blocker, with updated documentation and regression coverage.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main still requests a fresh blocker report, while the proposed bounded prompt change preserves an already-complete answer. No actionable introduced defect was found, and the supplied live evidence covers both legitimate stopping and continued authorized work.

Priority: P1
Reviewed head: 807e2cbcb45ee0f51d5009444bf251b5e0657094

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A narrow owner-level repair with relevant live before/after evidence, a continuation control, and focused regression coverage.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The captured live Telegram Test Server comparison exercises the changed completion-check prompt through a real provider, isolated Gateway, and final message delivery: the original answer survives once after NO_REPLY. A second head scenario confirms unfinished authorized work still continues. No stored-data contract changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The captured live Telegram Test Server comparison exercises the changed completion-check prompt through a real provider, isolated Gateway, and final message delivery: the original answer survives once after NO_REPLY. A second head scenario confirms unfinished authorized work still continues. No stored-data contract changes.
Evidence reviewed 9 items Pinned introduced change: The verified merge-base-to-head diff changes only completion-check wording, its documentation, and one regression. Runtime gates, check budget, registration validation, and cancellation precedence are unchanged.
Current main still needs the change: Fetched main retains the instruction to report a concrete limitation without the conditional silent-reply clause. The central behavior is therefore not already implemented.
Existing answer-retention owner: The subscriber retains the completed answer when a subsequent stop adds no text, attachment, or speech; actual user input clears that state. The completion check is a custom follow-up, so it does not cross that reset boundary. Payload construction consumes the retained answer. This supporting behavior landed in #164774.
Findings None None.
Security None None.

How this fits together

The built-in agent checks unfinished progress-card plans before ending a run. Its follow-up response passes through the existing answer-retention and reply-payload owners to determine what reaches the user.

flowchart TD
  A[Saved unfinished plan] --> B[Agent produces answer]
  B --> C[One completion check]
  C --> D[Authorized work remains]
  D --> E[Continue work]
  C --> F[Blocker already explained]
  F --> G[Silent follow-up]
  G --> H[Deliver retained answer]
  E --> H
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -1, Tests +66, Docs +1. Total +66 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 2 -1
Tests 1 66 0 +66
Docs 1 3 2 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 70 4 +66

Review metrics

Metric Value Why it matters
Completion-check cost 8 provider requests before and after; check output 53 → 6 tokens The supplied live comparison preserves the existing request budget while avoiding the redundant blocker response.

Technical review

Best possible solution:

Keep the existing bounded completion check and let its silent follow-up preserve an answer that already explains why work cannot proceed.

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

Yes: an unfinished saved plan followed by an answer requesting approval triggers the completion check, whose fresh blocker response replaces the answer. Source inspection and the supplied live base/head comparison establish this path; the reviewer did not execute it.

Is this the best way to solve the issue?

Yes: the change repairs the existing prompt owner and reuses merged answer retention without bypassing completion checks or adding competing state.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P1: The live comparison shows a complete agent answer being replaced by a blocker restatement in a real channel workflow.
  • 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. Sufficient (live_output): The captured live Telegram Test Server comparison exercises the changed completion-check prompt through a real provider, isolated Gateway, and final message delivery: the original answer survives once after NO_REPLY. A second head scenario confirms unfinished authorized work still continues. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured live Telegram Test Server comparison exercises the changed completion-check prompt through a real provider, isolated Gateway, and final message delivery: the original answer survives once after NO_REPLY. A second head scenario confirms unfinished authorized work still continues. No stored-data contract changes.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The change affects which answer Telegram users receive; the supplied Test Server proof demonstrates that visible behavior.

Evidence

What I checked:

Likely related people:

  • Ayaan Zaidi: Raw commit 83e6cb9 adds src/agents/embedded-agent-subscribe.handlers.messages.lifecycle.ts:307 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 83e6cb99d307; files: src/agents/embedded-agent-subscribe.handlers.messages.lifecycle.ts)
  • VACInc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-04T11:53:11.226Z sha bdb8e05 :: needs changes before merge. :: none
  • reviewed 2026-10-04T12:24:27.283Z sha bdb8e05 :: needs changes before merge. :: none
  • reviewed 2026-10-05T06:34:33.453Z sha 807e2cb :: needs maintainer review before merge. :: none

@obviyus
obviyus force-pushed the fix/dropped-final-answer branch from 25dc7e4 to 69b4a7b Compare October 4, 2026 13:14
Base automatically changed from fix/dropped-final-answer to main October 5, 2026 06:25
@obviyus
obviyus force-pushed the fix/plan-check-no-restatement branch from bdb8e05 to 807e2cb Compare October 5, 2026 06:29
@obviyus
obviyus marked this pull request as ready for review October 5, 2026 06:29
@obviyus

obviyus commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 5, 2026
@obviyus
obviyus merged commit 4af2bb9 into main Oct 5, 2026
203 of 205 checks passed
@obviyus
obviyus deleted the fix/plan-check-no-restatement branch October 5, 2026 07:17
@obviyus

obviyus commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Landed as 4af2bb9.

Checked on the exact head 807e2cb: fresh gpt-6-astra reviewer LAND, ClawSweeper ready, CI green, and live before/after proof in the body.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 6, 2026
…pletion check (openclaw#164896)

The plan-completion check now lets the model end with NO_REPLY when its previous reply already reported the blocker, so the original answer stays the only reply instead of a restatement bubble. Unfinished plans still get their check and continue working.

Co-authored-by: Ayaan Zaidi <[email protected]>
RomneyDa pushed a commit that referenced this pull request Oct 6, 2026
…pletion check (#164896)

The plan-completion check now lets the model end with NO_REPLY when its previous reply already reported the blocker, so the original answer stays the only reply instead of a restatement bubble. Unfinished plans still get their check and continue working.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 4af2bb9)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Oct 22, 2026
…pletion check (openclaw#164896)

The plan-completion check now lets the model end with NO_REPLY when its previous reply already reported the blocker, so the original answer stays the only reply instead of a restatement bubble. Unfinished plans still get their check and continue working.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 4af2bb9)
(cherry picked from commit 07c6e42)
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

agents Agent runtime and tooling docs Improvements or additions to documentation P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. 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

Development

Successfully merging this pull request may close these issues.

1 participant