Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis 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.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete 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: Before merge
FindingsNone. Agent review detailsHow this fits togetherSubagent 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]
Technical reviewBest 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
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +54, Tests +252. Total +306 across 5 files. Added test files: 2. View PR surface stats
Preflight sourceSource 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 clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed November 27, 2026, 2:31 AM ET / 07:31 UTC (Revision 3). |
48182d9 to
0dac77b
Compare
|
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 Frozen child result relayed in both runs: 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 BEFORE (pre-patch sources, real model, 2 provider calls). The completed child result was never relayed; the turn burned two real model calls on blocked AFTER (this head, same scenario, same provider/model, 1 provider call, no tool attempt). Gateway response: Boundaries, stated plainly. The child's completion event is injected as the Test trim (review note). About PR body Evidence section updated with all of the above. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…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.
0dac77b to
b16d7f0
Compare
|
Third round: rebased onto current 1. The review's optional low-value-test cleanup is applied. 2. The rebase exposed a 3. Verification on the rebased head: 4. Two earlier host limitations in the body were stale and are now corrected. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Closes #198584
What Problem This Solves
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
["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.resolveCompletionToolPolicy) is only made later at run time — so the rewrite is applied at the run seam inrunAgentAttempt, the single place that authoritatively knows the surface. One condition (isSubagentAnnounceHandoff && !completionRetainsRequesterTools) covers both thedisableToolsand message-only cases, for the CLI and embedded paths, across the prompt text and the task-completion internal events (which feed runtime-context fragments).sessions_sendA2A paths, which run with tools and keep the original instruction.replaceAllof 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
src/agents/command/attempt-execution.helpers.ts(resolveCompletionToolPolicynow takes the attempt prompt and returns the rescopedrelay.prompt/relay.internalEventsalongside the tool policy it already resolved),src/agents/command/attempt-execution.ts(the threerelay.*consumption points),src/agents/subagents/completion/subagent-completion-instructions.ts(new relay-only constant + rewrite helpers), and the regressions insrc/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, isolatedOPENCLAW_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 realrunAgentAttemptseam.Exact steps or commands run after this patch:
Evidence after fix:
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:
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 whiledisableTools: true.How the restricted turn was produced: the driver sent the shipped
agentRPC the exact payloadsendSubagentAnnounceDirectly()dispatches for an unverified completion handoff —inputProvenance = {kind: "inter_session", sourceTool: "subagent_announce"}, onetask_completioninternal 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 allowedbash, read, write, message, sessions_spawn, subagents, so the empty tool surface can only come fromresolveCompletionToolPolicy().Proof boundaries (explicit): the child's completion event is injected as the
agentrequest 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.tsdropped the constant-substitution and literal-wording assertions already made at the attempt boundary plus theundefinedpassthrough case, and in this follow-up also thetoRelayOnlyCompletionInternalEventsevent-rewrite case the review flagged as repeating the replacement already checked throughrunAgentAttemptwith 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
mainpushedsrc/agents/command/attempt-execution.tspast the oxlintmax-linesbudget (711 counted lines against the 700 cap; pristinemaincounts 699 and lints clean, so the overage was this PR's).config/max-lines-baseline.txtmay only shrink, so rather than registering the file, the relay-only rescoping moved intoresolveCompletionToolPolicy— the existing owner that already derivescompletionRetainsRequesterToolsfrom the same handoff facts — andattempt-execution.tsis left one parameter line heavier (739 total,oxlintclean). 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:corenow runs here (exit 0; thetsrs/GLIBC_2.32blocker recorded in the previous round is gone), andattempt-execution.cli.test.ts— including "restricts completion tools for a capability without persisted child lineage", which previously failed identically on untouchedorigin/main— is green in this round's run. Repository CI lanes have not executed for this PR yet: theCIworkflow run isaction_required(fork PR awaiting maintainer approval), which is whyopenclaw/ci-gatecurrently 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, headb16d7f0317a, no textual conflicts); the review's optional low-value-test cleanup is applied; themax-linesoverage 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 --checkclean;oxlintclean;pnpm tsgo:coreexit 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.