Skip to content

fix(agents): keep private yield continuation out of the tool result - #139254

Closed
Colton-Harris wants to merge 2 commits into
openclaw:mainfrom
opspot-ai:fix/sessions-yield-private-result
Closed

Colton-Harris wants to merge 2 commits into
openclaw:mainfrom
opspot-ai:fix/sessions-yield-private-result

Conversation

@Colton-Harris

Copy link
Copy Markdown
Contributor

Related: #25592 (intermediate processing output appearing in messaging channels).
Follow-up to #125106 (separate private resume context from the public waiting acknowledgment).

What Problem This Solves

Fixes an issue where users waiting for background work could see private continuation context in their chat when full tool verbosity was enabled. The yield tool describes message as private, but its raw success result repeated that text.

Why This Change Was Made

Keep the private message solely on the existing onYield continuation path; omit it from the tool-visible JSON result at the producer. The public acknowledgment and status: "yielded" remain unchanged, so pause detection, waiting replies, and continuation behavior retain their existing contracts. No channel-specific filtering or verbosity configuration changes are needed.

This closes the raw-result path left after the tool-summary privacy change in #125106. It does not attempt to resolve all intermediate narration covered by #25592.

User Impact

Full verbosity can still show useful tool status and the explicitly public waiting acknowledgment without also forwarding the private resume message. Existing internal continuation context remains available.

Evidence

  • Synthetic pre-fix reproduction: the actual tool start → execute → end flow leaked SYNTHETIC_PRIVATE_CONTINUATION_MARKER through full-verbosity output; off/on controls passed. The producer tests also failed because the marker was included in both JSON content and result details.
  • Post-fix: 247 tests passed across 6 files, using:
node scripts/run-vitest.mjs \
  src/agents/tools/sessions-yield-tool.test.ts \
  src/agents/embedded-agent-subscribe.handlers.tools.test.ts \
  src/agents/embedded-agent-runner/run/attempt.sessions-yield.test.ts \
  src/agents/embedded-agent-runner/run/attempt-prompt-phase.test.ts \
  extensions/codex/src/app-server/event-projector.verbose-hooks.test.ts \
  extensions/codex/src/app-server/run-attempt-lifecycle-controller.test.ts \
  --reporter=dot
  • New coverage verifies the entire public result contains no private marker, with/without acknowledgment, and actual embedded tool progress with off/on/full verbosity. Existing sibling suites verify hidden continuation persistence, prompt settlement, and Codex verbosity/lifecycle handling.
  • Producer: src/agents/tools/sessions-yield-tool.ts; JSON envelope owner: src/agents/tools/tool-results.ts. The embedded runtime stores yieldMessage independently in attempt.ts; the Codex callback carries context independently in dynamic-tool-build.ts. Both consume the preserved status/callback, not the removed echo.
  • Codex dependency inspected directly at openai/codex@459a79eb85400af759e9220c7bafb4429ae07516: codex-rs/core/src/tools/handlers/dynamic.rs:153-164,219-233 and codex-rs/app-server/src/dynamic_tools.rs:37-53 forward returned content to model output and completed tool notifications. This is why the result producer is the correct boundary.
  • node scripts/check-changed.mjs -- src/agents/tools/sessions-yield-tool.ts src/agents/tools/sessions-yield-tool.test.ts src/agents/embedded-agent-subscribe.handlers.tools.test.ts: passed, including formatting, core/core-test typechecks, targeted lint, import/schema guards, and security guards.
  • Isolated autoreview completed scoped-clean, with no accepted/actionable P0/P1 findings.
  • Production delta: 0 added / 1 removed. Tests: 63 added / 41 removed, consolidating the prior custom-message/acknowledgment cases.
  • Live messaging proof was not run: this branch has not been deployed, and the active gateway was left untouched to avoid interrupting ongoing conversations. The regression instead exercises the real local producer and subscription handlers with a synthetic marker and captured output callbacks; this is not a live-channel or mock-gateway E2E claim.

No private transcripts, real continuation text, credentials, or live configuration are included.

Preserve continuation context through the existing callback without repeating it in the public tool result.

Co-Authored-By: Codex <[email protected]>
@clawsweeper

clawsweeper Bot commented Sep 5, 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 Sep 5, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. 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 Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed September 5, 2026, 2:11 PM ET / 18:11 UTC.

ClawSweeper review

What this changes

The PR removes private continuation text from the yield tool’s public result and updates tests while preserving the continuation callback and public waiting acknowledgment.

Merge readiness

⛔ Blocked before merge - 2 items remain

This remains a useful fix for a privacy leak present on current main and v2026.9.1. No blocking patch defects were found; the previous requirement for real channel-behavior proof remains unmet.

Priority: P2
Reviewed head: 4f73bce6e33b7da58133742c232fd984d049fcb8

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) A focused, source-supported repair with useful regression coverage remains blocked by missing real channel-behavior proof.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The real yield producer and embedded handlers are exercised with mocked output callbacks. The captured body explicitly reports no running-channel or authorized mock-gateway E2E evidence showing private text absent while acknowledgment and continuation still work. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The real yield producer and embedded handlers are exercised with mocked output callbacks. The captured body explicitly reports no running-channel or authorized mock-gateway E2E evidence showing private text absent while acknowledgment and continuation still work. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 12 items Producer preserves the private callback: The schema describes message as private. Execution still passes message and acknowledgment to onYield before returning status and the optional acknowledgment; only the duplicate result field is removed.
Current main still contains the leak: Fetched main still includes message in the successful jsonResult payload at line 59. The shared JSON helper copies that payload into both text content and details.
Latest release remains affected: The v2026.9.1 producer also returns the private message, so the requested correction is not already supplied by the latest release.
Findings None None.
Security None None.

How this fits together

The yield tool pauses an agent while background children finish. Its callback carries continuation context, while its result can appear in chat when full tool verbosity is enabled.

flowchart TD
  A[Agent requests a pause] --> B[Yield tool]
  B --> C{Pending child completion owned?}
  C -->|No| D[Actionable error]
  C -->|Yes| E[Private continuation callback]
  E --> F[Pause and resume lifecycle]
  E --> G[Public status and acknowledgment]
  G --> H[Verbose chat output]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The real yield producer and embedded handlers are exercised with mocked output callbacks. The captured body explicitly reports no running-channel or authorized mock-gateway E2E evidence showing private text absent while acknowledgment and continuation still work. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step (P2) - Add redacted channel proof covering private-marker exclusion, public acknowledgment, and continuation. Screenshots or video are preferred when useful; runtime logs or the authorized mock-gateway verdict also count. Remove credentials and private identifiers. Updating the PR body should trigger review automatically; otherwise ask a maintainer to comment @clawsweeper re-review.
Agent review details

Security

None.

PR surface

Source -1, Tests +21. Total +20 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 0 1 -1
Tests 4 66 45 +21
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 66 46 +20

Review metrics

Metric Value Why it matters
Production versus test LOC Production net -1; tests net +21 The repair removes the duplicate data at its producer; all growth is regression coverage and updated consumer expectations.

Technical review

Best possible solution:

Keep private continuation context on the existing callback path and return only public yield status and acknowledgment, backed by changed-path channel evidence.

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

Yes, from source: an accepted yield with private message text serializes that text into the result, which full verbosity forwards to chat. This read-only review did not execute the reproduction.

Is this the best way to solve the issue?

Yes. Removing the duplicate field at its producer preserves the callback contract; channel filters or disabling verbosity would leave other result consumers exposed.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f8d63c5dc08a.

Labels

Label justifications:

  • P2: This fixes private continuation text appearing through the optional full-verbosity output path without changing default delivery.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The real yield producer and embedded handlers are exercised with mocked output callbacks. The captured body explicitly reports no running-channel or authorized mock-gateway E2E evidence showing private text absent while acknowledgment and continuation still work. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. The shared result change affects visible Telegram tool-output messages under full verbosity and can be demonstrated on Telegram’s Test Server.

Evidence

What I checked:

  • Producer preserves the private callback: The schema describes message as private. Execution still passes message and acknowledgment to onYield before returning status and the optional acknowledgment; only the duplicate result field is removed. (src/agents/tools/sessions-yield-tool.ts:56, 4f73bce6e33b)
  • Current main still contains the leak: Fetched main still includes message in the successful jsonResult payload at line 59. The shared JSON helper copies that payload into both text content and details. (src/agents/tools/sessions-yield-tool.ts:59, f8d63c5dc08a)
  • Latest release remains affected: The v2026.9.1 producer also returns the private message, so the requested correction is not already supplied by the latest release. (src/agents/tools/sessions-yield-tool.ts:59, ad6fe23aecb9)
  • Public output path and existing contract: The completion handler calls emitToolResultOutput, which extracts result text and forwards it through emitToolOutput when full verbosity is enabled. The subscription then emits an onToolResult reply payload. docs/tools/subagents.md:327 defines private message versus public acknowledgment, and docs/tools/thinking.md:95 documents forwarding completed tool output. (src/agents/embedded-agent-subscribe.handlers.tools.results.ts:703, 4f73bce6e33b)
  • Continuation and sibling consumers: openclaw-tools.ts:603 constructs the shared producer. The embedded callback stores yieldMessage independently at attempt.ts:214, and attempt-prompt-submit.ts:286 persists it as hidden continuation context. Codex records acknowledgment through its callback and detects yield from details.status at dynamic-tools.ts:1327; Copilot also receives callback arguments independently. (src/agents/embedded-agent-runner/run/attempt.ts:212, 4f73bce6e33b)
  • Affirmative Codex dependency signal: The PR explicitly claims Codex lifecycle compatibility, and this runtime builds the shared tool with an onYield callback. Its result projection forwards protocol contentItems, making the Codex dynamic-tool response contract relevant to this review. (extensions/codex/src/app-server/dynamic-tool-build.ts:411, 4f73bce6e33b)

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Add changed-path channel evidence showing full-verbosity output excludes the synthetic private marker while acknowledgment and continuation still work.

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 (1 earlier review cycle)
  • reviewed 2026-09-05T17:57:33.661Z sha cf028a3 :: needs real behavior proof before merge. :: none

Two consumer suites pinned the old sessions_yield result shape and failed CI after the private message field was removed. Both keep their real assertions: the runtime test still proves the abort wrapper preserves a successful yield, and the gateway test still proves onYield receives the private message. The result-shape expectations now also assert the private field is absent.
@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Sep 5, 2026
@obviyus obviyus self-assigned this Sep 6, 2026
@obviyus

obviyus commented Sep 6, 2026

Copy link
Copy Markdown
Collaborator

Thanks @Colton-Harris. Your producer fix is preserved and credited in the merged replacement #139801 (f04aa558115bd754fc4cd558958b36877f08a982). The fork rejected the maintainer push, so the repair landed through that replacement.

Real Telegram Test Server and native child/yield/resume proof verified private-output exclusion, hidden continuation, public acknowledgment, and preserved original private input records. Independent acceptance and the final local review passed. The replacement's landing comment records the single proven unrelated CI failure and guarded exception.

Closing this PR as superseded by the verified landed repair.

@obviyus obviyus closed this Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants