Skip to content

fix: keep subagent reports out of operator CLI messaging - #150520

Merged
steipete merged 2 commits into
mainfrom
codex/subagent-cli-provenance
Sep 17, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/subagent-cli-provenance

Conversation

@steipete

@steipete steipete commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #150487

What Problem This Solves

Fixes subagents using shell-launched CLI session messages when their messaging tools are intentionally unavailable, causing worker reports to appear as ordinary user input.

User Impact

Hidden and visible workers keep results on their accepted task completion path, including later turns. Ordinary operator CLI messaging and read-only child CLI commands continue to work. This prevents accidental misrouting; it does not turn an unrestricted shell into an authorization boundary.

Why This Change Was Made

The runtime carries child execution context into Gateway and node subprocesses, and the CLI rejects session send/steer calls before transport. Full and minimal prompts now explain that missing tools are not a CLI fallback, and parents own coordination between workers. Existing messaging rules and tests move into focused siblings without changing budgets or introducing a new configuration option.

Evidence

  • Regression tests failed on the original behavior: three CLI dispatch cases, four hidden/visible subprocess cases, and full/minimal messaging guidance.
  • Focused CLI, subprocess, environment, prompt, and completion-envelope checks pass. Final changed-file checks, core/test typechecking, lint, formatting, import cycles, and existing ratchets pass.
  • Real OpenAI inference (openai/gpt-5.6-sol) with an isolated Gateway: hidden and visible children each attempted the candidate CLI on their initial and later turns. All four attempts returned the task-completion rejection and left the target transcript unchanged. Both ordinary operator CLI controls succeeded, and each initial child result reached its parent once.
  • Live setup uses an empty source home and the existing CLI test-output opt-in; it does not migrate or modify an operator Gateway.
  • Independent Codex reviews through P2: no accepted/actionable findings.
  • Hosted CI exposed two stale test expectations; prompt and partial-module mocks are corrected. A pre-existing Qwen video clock flake was fixed independently on main in fix(qwen): prevent elapsed-time flakes in video generation tests #150523; this branch retains that upstream repair. The production patch is unchanged after resolving that rebase conflict.

Peer reply-loop and chat-visibility fixes are tracked separately in #150488.

@steipete
steipete marked this pull request as ready for review September 17, 2026 02:41
@clawsweeper

clawsweeper Bot commented Sep 17, 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 cli CLI command changes agents Agent runtime and tooling size: L maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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 Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 11:31 PM ET / September 17, 2026, 03:31 UTC (Revision 3).

ClawSweeper review

What this changes

The PR carries subagent context into shell commands, rejects their CLI session messaging, and updates prompts, documentation, and regression coverage to keep worker reports on the task completion path.

Merge readiness

✅ Ready for maintainer review

This remains a useful fix for the linked issue: current main lacks the child-CLI guard. No blocking correctness or security findings were identified, and the maintainer-authored PR should remain open for normal landing.

Priority: P2
Reviewed head: 1408a3891bec190d12d1f1fb07d93afc4f2adf06

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with relevant regression coverage and reported live validation; no actionable introduced defect was found.
Proof confidence 🌊 off-meta tidepool Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Its captured body reports an isolated real-inference Gateway run covering four child CLI rejections, untouched target transcripts, and successful operator controls; the inspected fixture exercises the changed exec and CLI owners.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Its captured body reports an isolated real-inference Gateway run covering four child CLI rejections, untouched target transcripts, and successful operator controls; the inspected fixture exercises the changed exec and CLI owners.
Evidence reviewed 8 items Current main still needs the fix: The fetched main revision dispatches CLI RPC calls without checking child execution context. No merged replacement fixing this behavior is established by the supplied related-item context.
Introduced guard and environment propagation: The pinned introduced diff rejects sessions.send, sessions.steer, and chat.send before transport when child context is present. Exec derives that context from the executing session and forwards it through both local and node environments; the node shell-wrapper filter preserves the marker.
Existing behavior contract: Subagent documentation states that workers lack session and message tools by default. The linked issue specifies completion-path reporting while retaining operator messaging and read-only child CLI commands: #150487.
Findings None None.
Security None None.

How this fits together

OpenClaw subagents execute delegated tasks and return results to their parent. The exec environment and CLI dispatch layer determine whether shell-launched messages can enter another session as ordinary operator input.

flowchart TD
  A[Stored child session context] --> B[Exec environment]
  B --> C[Shell launches CLI]
  C --> D{Child session messaging?}
  D -->|Yes| E[Reject with completion guidance]
  D -->|No| F[Existing Gateway transport]
  E --> G[Child completes task for parent]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +48, Tests +282, Docs +3. Total +333 across 22 files.

View PR surface stats
Area Files Added Removed Net
Source 11 159 111 +48
Tests 10 308 26 +282
Docs 1 6 3 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 22 473 140 +333

Review metrics

Metric Value Why it matters
Production versus regression coverage Net production +48 lines; tests and test support +282 lines Production growth adds the routing guard and shared prompt guidance; most growth exercises child propagation and completion behavior.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #150487
Summary: This PR is the candidate repair for child CLI report misattribution; peer-loop and visibility work has a separate scope.

Members:

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

Technical review

Best possible solution:

Keep child reports on the existing completion path while preserving operator CLI messaging, read-only child commands, and normal authentication.

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

Yes, from source: current main forwards child-launched session messaging through ordinary CLI transport without the proposed guard. The report supplies the concrete command path; this review did not execute it.

Is this the best way to solve the issue?

Yes. The patch reuses existing session-depth and completion owners, places rejection before CLI transport, and preserves operator and read-only paths without introducing a parallel messaging implementation.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This repairs a bounded subagent report-routing defect without evidence of an urgent system-wide outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The external-contributor proof gate does not apply to this MEMBER-authored PR. Its captured body reports an isolated real-inference Gateway run covering four child CLI rejections, untouched target transcripts, and successful operator controls; the inspected fixture exercises the changed exec and CLI owners.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Dallin Romney: 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 (2 earlier review cycles)
  • reviewed 2026-09-17T02:50:08.105Z sha d35be0415616f83c4314cbc4ebd88afa661f9646 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-17T03:09:01.530Z sha 3f3440a6bf101ab79dc6170d02d6625560c8292e :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/subagent-cli-provenance branch from 3f3440a to 1408a38 Compare September 17, 2026 03:21
@steipete
steipete merged commit 35feb4c into main Sep 17, 2026
211 of 213 checks passed
@steipete
steipete deleted the codex/subagent-cli-provenance branch September 17, 2026 03:47
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes docs Improvements or additions to documentation maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

Subagents bypass unavailable messaging tools through the CLI

1 participant