Skip to content

fix(agents): completion relays report spurious failures on tool-free turns - #198633

Open
LiuwqGit wants to merge 3 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-198584-capability-matched-announce
Open

LiuwqGit wants to merge 3 commits into
openclaw:mainfrom
LiuwqGit:feat/issue-198584-capability-matched-announce

Conversation

@LiuwqGit

@LiuwqGit LiuwqGit commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

AI-assisted: yes

Closes #198584

What Problem This Solves

  • Fixes an issue where users would receive "the task failed / I'm blocked" reports for subagent work that actually completed, whenever the completion was relayed on a degraded path (unverified handoff envelope, restart recovery, CLI execution provider, or raw-model run). On those turns every execution tool is disabled by design, yet the announce prompt still instructed the model to "require continued work or a follow-up in the kept child session" — so the model burned tokens on blocked tool attempts and then escalated the relay's own authority loss as a child task failure.
  • Related: [Bug]: Tool-free completion relay turns receive continuation instructions and report spurious task failures #198584 (this issue); fix(subagents): completion review no longer repeats a result the user already saw #198204 touched the same instruction builder for a different defect (duplicate delivery) — complementary, no overlap. clawsweeper labels on the issue: queueable-fix / fix-shape-clear / source-repro; its Codex review asked to "qualify shared completion guidance by available tools", which is exactly this change.

Why This Change Was Made

  • Intended outcome: the completion guidance a relay turn receives matches the tool surface that turn actually resolved. Restricted relays (tools disabled, or allowlist collapsed to ["message"]) now get relay-only wording: preserve the child outcome, relay it truthfully, state any needed follow-up for a subsequent normal turn, and do not report the turn's own tool restrictions as a task failure. Trusted in-process handoffs that retain the requester's tools keep the existing continuation guidance unchanged.
  • The instruction is frozen into the announce prompt at compose time, while the tool-surface decision (resolveCompletionToolPolicy) is only made later at run time — so the rewrite is applied at the run seam in runAgentAttempt, the single place that authoritatively knows the surface. One condition (isSubagentAnnounceHandoff && !completionRetainsRequesterTools) covers both the disableTools and message-only cases, for the CLI and embedded paths, across the prompt text and the task-completion internal events (which feed runtime-context fragments).
  • Out of scope: the tool restriction itself (intentional privilege separation, unchanged); model-free relay for unverified paths (issue's costlier option 2); persisting the capability envelope across restarts (option 3); the settle-into-busy-parent and sessions_send A2A paths, which run with tools and keep the original instruction.
  • Highest-risk area: prompt text substitution on completion handoff turns.
  • How is that risk mitigated? The rewrite is an exact-match replaceAll of one frozen constant; text that does not contain it is byte-identical. The trusted-handoff regression test asserts the continuation guidance survives untouched when tools are retained.

User Impact

  • Success criteria: on a restricted completion relay turn, the model-facing prompt and runtime-context fragments contain the relay-only instruction and no longer contain the "require continued work or a follow-up" continuation clause; users stop receiving spurious failure reports for completed child work, and tokens are no longer wasted on blocked tool attempts. Trusted completion handoffs behave exactly as before.
  • What should reviewers focus on? src/agents/command/attempt-execution.helpers.ts (resolveCompletionToolPolicy now takes the attempt prompt and returns the rescoped relay.prompt / relay.internalEvents alongside the tool policy it already resolved), src/agents/command/attempt-execution.ts (the three relay.* consumption points), src/agents/subagents/completion/subagent-completion-instructions.ts (new relay-only constant + rewrite helpers), and the regressions in src/agents/command/attempt-execution.completion-relay.test.ts ("rewrites completion guidance to relay-only on a restricted relay turn", "keeps continuation guidance on a trusted completion handoff turn").

Evidence

  • Real environment tested: isolated worktree at origin/main + patch, Node v26.12.1, isolated OPENCLAW_STATE_DIR, and a real model provider (zte/co-claw, api: openai-completions, internal MaaS endpoint; API key read from the local machine config at runtime, never written into any artifact). Two independent levels: (1) a real-model run of the restricted relay turn through the shipped gateway RPC surface, (2) behavioral regressions through the real runAgentAttempt seam.

  • Exact steps or commands run after this patch:

    # 1) real-model proof: isolated gateway + real provider, driven through the shipped
    #    `agent` RPC with the unverified-completion-handoff payload. The driver script
    #    lives outside the repository (evidence dir); OPENCLAW_CACHE_TRACE=1 records the
    #    composed prompt, and a loopback passthrough recorder captures the real request
    #    bodies on their way to the real endpoint.
    OPENCLAW_CACHE_TRACE=1 OPENCLAW_CACHE_TRACE_FILE=<evidence>/cache-trace-head-lint.jsonl \
      PROOF_LABEL=head-lint PROOF_SCENARIO=lint PROOF_WIRE=1 \
      node --import ./scripts/tsx.mjs <evidence>/restricted-relay-live.mts      # patched head
    git checkout HEAD~1 -- src/agents/command/attempt-execution.ts \
      src/agents/subagents/completion/subagent-completion-instructions.ts        # pre-patch sources
    PROOF_LABEL=main-lint … node --import ./scripts/tsx.mjs <evidence>/restricted-relay-live.mts
    git checkout HEAD -- <the two files above>                                   # restore
    
    # 2) regressions + hygiene
    node scripts/run-vitest.mjs run src/agents/command/attempt-execution.completion-relay.test.ts \
      src/agents/subagents/completion/subagent-completion-instructions.test.ts
    pnpm exec oxfmt --check <changed files> && pnpm exec oxlint <changed files>
  • Evidence after fix:

    # real model, patched head, restricted relay turn (run-head-lint.json)
    wire request → https://<internal-maas>/model-cop/co-claw/v1/chat/completions  status 200
    wire request keys: model, messages, stream, stream_options, max_completion_tokens, reasoning_effort
    wire request "tools": <absent>          # the turn really had no execution surface
    prompt sent (OPENCLAW_CACHE_TRACE): "…This turn is a restricted relay: it has no execution,
      file, or session tools and cannot continue work or spawn follow-ups here. Relay the frozen
      child result truthfully and do not report this turn's tool restrictions as a task failure…"
      · contains continuation clause "require continued work or a follow-up": false
    model reply (1 provider call, no tool attempt):
      The lint gate finished: 41 of 44 files are clean. Three in-scope fixable lint errors remain:
      - `src/report/format.ts` — unused import
      - `src/report/summary.ts` — unused import
      - `src/report/csv.ts` — missing return type
      No new authority or user decision is required to fix them. Next step is to clean up those
      three files and re-run the lint gate to confirm everything passes.
    gateway response: status ok · summary completed · durationMs 11438 · provider zte · model co-claw
    
    # regressions through the real run seam (only the CLI/embedded runners mocked)
    ✓ attempt-execution.completion-relay.test.ts > rewrites completion guidance to relay-only on a restricted relay turn
    ✓ attempt-execution.completion-relay.test.ts > keeps continuation guidance on a trusted completion handoff turn
    ✓ subagent-completion-instructions.test.ts (3 tests)
    Test Files  2 passed (2) · Tests  5 passed (5) · oxfmt --check clean · oxlint clean
    
  • Observed result after fix: on the restricted (unverified-handoff) completion relay turn the real model relayed the frozen child outcome verbatim in its own words, recorded the follow-up work for a subsequent normal turn, made no tool call, and needed a single provider call. A second scenario (migration dry-run, same harness) shows the same shape: pre-patch the tool-free relay claimed execution it cannot perform (Once you decide, I can apply it and run the real migration.), patched it defers (Let me know your preference and the next normal turn can pick that up and proceed.).

  • Before evidence (real model, pre-patch sources, same scenario/provider): the relay turn received the unconditional continuation clause and produced two real provider calls, both attempting an execution tool that the turn does not have:

    wire request "tools": <absent>   # same restricted surface as the patched run
    model call 1 → "The lint gate finished with 3 in-scope fixable errors left, so I'll fix them now.
                    Let me inspect the three files.
                    [tool call id=chatcmpltoolb3960701a335ca71 name=exec] {"command":"cd …/workspace && sed -n '1,20p' src/report/format.ts && …"}
                    [tool result id=chatcmpltoolb3960701a335ca71 name=exec] Tool exec not found"
    model call 2 → user-visible payload:
                    Let me check which tools are available for editing and inspect the lint configuration.
                    [tool call id=chatcmpltool96a01a3x56bd1f8d name=exec] {"command":"cd …/workspace && ls -la && cat package.json …","interactive":true}
                    [tool result id=chatcmpltool96a01a3x56bd1f8d name=exec
                    ⚠️ Reply truncated at the model's output token limit. The text above is partial — ask to continue it.
    

    The completed child result was never relayed to the user. RED at the seam, same defect: AssertionError: expected '[Inter-session message] …' to contain 'This completion ends one child run, n…' — the received prompt still carried the continuation clause while disableTools: true.

  • How the restricted turn was produced: the driver sent the shipped agent RPC the exact payload sendSubagentAnnounceDirectly() dispatches for an unverified completion handoff — inputProvenance = {kind: "inter_session", sourceTool: "subagent_announce"}, one task_completion internal event, message: "Continue the OpenClaw runtime event.", and no in-process delegated tool-policy capability (the shape a gateway restart or missing persisted child lineage produces). The agent config deliberately allowed bash, read, write, message, sessions_spawn, subagents, so the empty tool surface can only come from resolveCompletionToolPolicy().

  • Proof boundaries (explicit): the child's completion event is injected as the agent request payload instead of being produced by a live child run; the loopback recorder only observes and forwards every byte unmodified to the real endpoint, so the model call is real; one real-model sample per run, not a statistical claim.

  • Review-driven test trim: per the ClawSweeper "low-value test" notes, subagent-completion-instructions.test.ts dropped the constant-substitution and literal-wording assertions already made at the attempt boundary plus the undefined passthrough case, and in this follow-up also the toRelayOnlyCompletionInternalEvents event-rewrite case the review flagged as repeating the replacement already checked through runAgentAttempt with a single task-completion event (so no distinct selectivity boundary). It keeps only what that seam cannot show: non-matching text stays byte-identical, and the private-completion composer output is rewritable. The production helper stays covered at the run seam.

  • Line-budget note (rebase follow-up): rebasing onto current main pushed src/agents/command/attempt-execution.ts past the oxlint max-lines budget (711 counted lines against the 700 cap; pristine main counts 699 and lints clean, so the overage was this PR's). config/max-lines-baseline.txt may only shrink, so rather than registering the file, the relay-only rescoping moved into resolveCompletionToolPolicy — the existing owner that already derives completionRetainsRequesterTools from the same handoff facts — and attempt-execution.ts is left one parameter line heavier (739 total, oxlint clean). Behavior is unchanged: the rewrite still happens exactly where the tool policy is resolved.

  • What was not tested: no gateway-restart orchestration — the restricted branch is entered through the same unverified-envelope shape a restart recovery produces, asserted at the wire instead of by killing a live process. Two earlier host limitations no longer apply on the rebased head: pnpm tsgo:core now runs here (exit 0; the tsrs/GLIBC_2.32 blocker recorded in the previous round is gone), and attempt-execution.cli.test.ts — including "restricts completion tools for a capability without persisted child lineage", which previously failed identically on untouched origin/main — is green in this round's run. Repository CI lanes have not executed for this PR yet: the CI workflow run is action_required (fork PR awaiting maintainer approval), which is why openclaw/ci-gate currently reports failure.

  • Proof tier: L3 (real-model behavior through the shipped gateway RPC surface, wire-captured tool surface and prompt, before/after contrast on the same scenario and provider) plus L2 regressions through the real run seam.

  • Proof limitations: the child completion event is injected rather than produced by a live child run (see Proof boundaries); single real-model sample per run.

  • Review state: third round. Rebased onto current main (1e6d3f9bd9e, head b16d7f0317a, no textual conflicts); the review's optional low-value-test cleanup is applied; the max-lines overage the rebase exposed is resolved by moving the rescoping into the existing tool-policy owner (see Line-budget note). Verification on the rebased head: subagent-completion-instructions.test.ts + attempt-execution.completion-relay.test.ts + attempt-execution.cli.test.ts + attempt-execution.test.ts → 2 vitest shards passed, 112 tests passed; oxfmt --check clean; oxlint clean; pnpm tsgo:core exit 0. Real behavior proof supplied earlier (L3 real-model run through the shipped gateway RPC surface) is unchanged by the rebase; awaiting CI approval + maintainer review.

@clawsweeper

clawsweeper Bot commented Nov 14, 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: M labels Nov 14, 2026
@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. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR gives restricted completion relays guidance that matches their available tools while preserving continuation instructions for capable handoffs.

Example: A tool-free relay receives a completed lint run reporting 41 of 44 files clean.

  • Before: The relay attempts unavailable execution tools instead of reporting the three remaining errors.
  • After: The relay reports the three errors and identifies the follow-up needed on a normal turn.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A worthwhile, focused repair with sufficient real-model RPC evidence and no discrete correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (logs): Author-supplied logs exercise an injected unverified completion through the shipped Gateway agent RPC with a real provider, showing no tools on the wire and a truthful after-fix report without attempted execution; child creation and restart orchestration were outside that scenario, and current-head focused tests and typechecking are separately reported passing.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A completion relay can attempt unavailable tools and misrepresent its own restrictions as a problem with the child's work.
Reason: Accurate capability guidance repairs contradictory runtime instructions without adding configuration, changing tool permissions, or weakening follow-through on capable turns.

Merge readiness

⛔ Blocked before merge - 1 item remains

This PR addresses a current completion-guidance mismatch with a focused fix and no actionable code findings; current-head workflows await maintainer approval.

Reviewed head: b16d7f0317ae7420c4c8fe40172098b6759d9a20

Before merge

Findings

None.

Agent review details

How this fits together

Subagent completion events enter the requester attempt, where completion policy determines tools and guidance before CLI or embedded execution produces the requester response.

flowchart TD
  A[Child completion] --> B[Announce event]
  B --> C[Requester attempt]
  C --> D[Completion tool policy]
  D --> E[Capability matched guidance]
  E --> F[CLI or embedded runtime]
  F --> G[Requester response]
Loading

Technical review

Best possible solution:

Match completion guidance to the existing resolved tool policy while retaining child outcomes and normal continuation ownership.

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

Current-main source confirms that restricted requester attempts receive unconditional continuation guidance, and the supplied real-model Gateway comparison demonstrates blocked attempts before the repair.

Is this the best way to solve the issue?

The repair is proportionate: it uses the existing completion-policy decision, updates both model-facing instruction paths, and preserves the intentional tool boundary.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Delegated outcome ownership keeps the original intent (b90cc02: Keep the requester responsible for completing the user goal after a child ends, including ordinary fixable findings.)
  • Completion tool restrictions keeps the original intent (72f5840: Restore captured requester tools only where the verified handoff and runtime enforce the bounded tool surface.)
  • Private completion delivery guidance keeps the original intent (c891026: Avoid target-less messaging attempts while preserving delivery instructions for requesters with a conversation target.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Jason (Json): Raw commit b90cc02 adds src/agents/subagents/completion/subagent-completion-instructions.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b90cc020cada; files: src/agents/subagents/completion/subagent-completion-instructions.ts)
  • Stronggenetics: Raw commit 72f5840 adds src/agents/command/attempt-execution.helpers.ts:516 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 72f5840c1192; files: src/agents/command/attempt-execution.helpers.ts)

PR surface

Source +54, Tests +252. Total +306 across 5 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 3 61 7 +54
Tests 2 252 0 +252
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 313 7 +306

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #198584
Summary: The canonical issue describes the same instruction/tool mismatch; this PR and an alternative open PR propose repairs.

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:

  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • 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-11-14T04:14:59.574Z sha 48182d9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-14T05:50:20.504Z sha 0dac77b :: blocked before merge. :: none

Reviewed November 27, 2026, 2:31 AM ET / 07:31 UTC (Revision 3).

@LiuwqGit
LiuwqGit force-pushed the feat/issue-198584-capability-matched-announce branch from 48182d9 to 0dac77b Compare November 14, 2026 05:40
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Real-model behavior proof added for the restricted completion relay (requested in the ClawSweeper review), plus the low-value test trim.

What ran. An isolated gateway from this branch's source (real startGatewayServer, real session store, real prompt composition, real resolveCompletionToolPolicy, real provider transport — nothing in the runtime mocked) was driven through the shipped agent RPC with the exact payload sendSubagentAnnounceDirectly() dispatches for an unverified completion handoff: inputProvenance = {kind: "inter_session", sourceTool: "subagent_announce"}, one task_completion internal event, message: "Continue the OpenClaw runtime event.", and no in-process delegated tool-policy capability — the shape a gateway restart or missing persisted child lineage produces. Provider: a real openai-completions endpoint (zte/co-claw), key read from the local machine config at runtime, never written into an artifact. Agent config deliberately allowed bash, read, write, message, sessions_spawn, subagents, so any narrowing on this turn can only come from the completion tool policy.

Frozen child result relayed in both runs: Lint gate finished …: 41 of 44 files clean. 3 in-scope fixable lint errors remain (unused import in src/report/format.ts, unused import in src/report/summary.ts, missing return type in src/report/csv.ts). No user decision and no new authority is needed to fix them.

Wire-level tool surface. A loopback passthrough recorder forwarded every byte unmodified to the real endpoint and captured the request bodies. Both runs sent no tools field (model, messages, stream, stream_options, max_completion_tokens, reasoning_effort only) — the relay turn really had no execution surface. Shipped OPENCLAW_CACHE_TRACE diagnostics show the composed prompt: pre-patch it carried …in-scope fixable blockers require continued work or a follow-up in the kept child session…; patched it carried This turn is a restricted relay: it has no execution, file, or session tools … Relay the frozen child result truthfully and do not report this turn's tool restrictions as a task failure… with no continuation clause.

BEFORE (pre-patch sources, real model, 2 provider calls).

model call 1 → "The lint gate finished with 3 in-scope fixable errors left, so I'll fix them now.
                Let me inspect the three files.
                [tool call id=chatcmpltoolb3960701a335ca71 name=exec] {"command":"cd …/workspace && sed -n '1,20p' src/report/format.ts && …"}
                [tool result id=chatcmpltoolb3960701a335ca71 name=exec] Tool exec not found"
model call 2 → user-visible payload:
                Let me check which tools are available for editing and inspect the lint configuration.
                [tool call id=chatcmpltool96a01a3x56bd1f8d name=exec] {"command":"cd …/workspace && ls -la && cat package.json …","interactive":true}
                [tool result id=chatcmpltool96a01a3x56bd1f8d name=exec
                ⚠️ Reply truncated at the model's output token limit. The text above is partial — ask to continue it.

The completed child result was never relayed; the turn burned two real model calls on blocked exec attempts.

AFTER (this head, same scenario, same provider/model, 1 provider call, no tool attempt).

The lint gate finished: 41 of 44 files are clean. Three in-scope fixable lint errors remain:

- `src/report/format.ts` — unused import
- `src/report/summary.ts` — unused import
- `src/report/csv.ts` — missing return type

No new authority or user decision is required to fix them. Next step is to clean up those three files and re-run the lint gate to confirm everything passes.

Gateway response: status ok · summary completed · durationMs 11438 · provider zte · model co-claw. A second scenario (migration dry-run, same harness) shows the same contrast: pre-patch the tool-free relay claimed execution it cannot perform (Once you decide, I can apply it and run the real migration.), patched it defers to a normal turn (…the next normal turn can pick that up and proceed.).

Boundaries, stated plainly. The child's completion event is injected as the agent request payload rather than produced by a live child run (wire shape identical to the unverified-handoff dispatch); the loopback recorder only observes and forwards, so the model call is real; one real-model sample per run, not a statistical claim. No gateway-restart orchestration was run — the same resolveCompletionToolPolicy branch is entered through the unverified envelope and asserted at the wire.

Test trim (review note). subagent-completion-instructions.test.ts dropped the constant-substitution and literal-wording assertions already made at the attempt boundary, plus the undefined passthrough case. It keeps only what that seam cannot show: non-matching text stays byte-identical, the private-completion composer output is rewritable, task-completion event mapping is selective. node scripts/run-vitest.mjs run on both test files: 2 files / 5 tests passed; oxfmt --check and oxlint clean. Amended into the single PR commit (head 0dac77b).

About openclaw/ci-gate. The repository CI workflow run for this PR is in action_required (fork PR awaiting maintainer approval), so no CI lane has executed yet and the gate reports failure; nothing in the current red state is a failing test. pnpm tsgo:core cannot run on this host (its tsrs native binary needs GLIBC_2.32+, host has 2.31), so type checking is left to CI.

PR body Evidence section updated with all of the above.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 14, 2026
…turns

Restricted completion relay turns (unverified handoff, restart recovery,
CLI execution provider, or raw-model run) run with execution tools
disabled, yet the announce prompt still demanded continued work or a
follow-up in the kept child session. Models followed that literally:
blocked tool attempts burned tokens and the relay's own authority loss
was reported to users as a child task failure.

Rescope the shared completion guidance to the tool surface the run
actually resolved: relay-only wording on restricted turns, unchanged
continuation guidance on trusted handoffs that retain tools.

Fixes openclaw#198584
…lready asserts

ClawSweeper's review of 0dac77b flagged the
toRelayOnlyCompletionInternalEvents case in
subagent-completion-instructions.test.ts as low-value coverage: it repeats the
replacement already checked through runAgentAttempt in
attempt-execution.completion-relay.test.ts and injects a single task-completion
event, so it proves no distinct selectivity boundary. The production helper
stays covered at the run seam; this removes the duplicated helper-level case and
its now-unused fixture.
…policy owner

Rebasing onto current main pushed src/agents/command/attempt-execution.ts past
the oxlint max-lines budget (711 counted lines against a 700 cap; pristine main
sits at 699 and lints clean). config/max-lines-baseline.txt may only shrink, so
instead of registering the file, the relay-only rescoping moves into
resolveCompletionToolPolicy - the existing owner that already decides
completionRetainsRequesterTools from the same handoff facts. It now takes the
attempt prompt and returns the rescoped prompt and task-completion events as
`relay`, leaving attempt-execution.ts one parameter line heavier (739 total).
Behavior is unchanged: the rewrite still happens exactly where the tool policy
is resolved, and trusted handoffs still pass both values through untouched.
@LiuwqGit
LiuwqGit force-pushed the feat/issue-198584-capability-matched-announce branch from 0dac77b to b16d7f0 Compare November 27, 2026 07:25
@LiuwqGit

Copy link
Copy Markdown
Contributor Author

Third round: rebased onto current main (1e6d3f9bd9e, no textual conflicts) — head is now b16d7f0317a.

1. The review's optional low-value-test cleanup is applied. subagent-completion-instructions.test.ts no longer carries the toRelayOnlyCompletionInternalEvents event-rewrite case: as the review said, it repeated the replacement already checked through runAgentAttempt in attempt-execution.completion-relay.test.ts and injected a single task-completion event, so it proved no distinct selectivity boundary. Its now-unused completionEvent fixture and imports went with it. The file keeps only what the run seam cannot show (non-matching text stays byte-identical; the private-completion composer output is rewritable), and the production helper stays covered at the seam — both seam regressions ("rewrites completion guidance to relay-only on a restricted relay turn", "keeps continuation guidance on a trusted completion handoff turn") pass unchanged.

2. The rebase exposed a max-lines overage, fixed by moving the seam instead of registering it. With main's current attempt-execution.ts, this PR's inline relay block pushed the file to 711 counted lines against the 700 cap (pristine main counts 699 and lints clean, so the overage was ours). config/max-lines-baseline.txt states it may only shrink, so the relay-only rescoping moved into resolveCompletionToolPolicy — the existing owner that already derives completionRetainsRequesterTools from the same handoff facts. It now takes the attempt prompt and returns relay.prompt / relay.internalEvents next to the policy it already returned; attempt-execution.ts keeps one extra parameter line (739 total, oxlint clean). Behavior is identical: the rewrite still happens exactly where the tool policy is resolved, and trusted handoffs still pass both values through untouched.

3. Verification on the rebased head: subagent-completion-instructions.test.ts + attempt-execution.completion-relay.test.ts + attempt-execution.cli.test.ts + attempt-execution.test.ts → 2 vitest shards passed, 112 tests passed. oxfmt --check clean, oxlint clean, pnpm tsgo:core exit 0. CI lanes stay with Actions.

4. Two earlier host limitations in the body were stale and are now corrected. pnpm tsgo:core does run on this host now (exit 0; the tsrs/GLIBC_2.32 blocker I recorded in the first round is gone), and attempt-execution.cli.test.ts is green in this round's run — including "restricts completion tools for a capability without persisted child lineage", which I had reported as failing identically on untouched origin/main. The real-model L3 evidence from the earlier round is unchanged by the rebase (no provider-facing code moved).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

This branch has not been deployed

No deployments
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: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tool-free completion relay turns receive continuation instructions and report spurious task failures

1 participant