Skip to content

fix(agents): preserve tool restrictions across session sends - #144269

Closed
pgondhi987 wants to merge 15 commits into
openclaw:mainfrom
pgondhi987:fix/fix-910-v3
Closed

pgondhi987 wants to merge 15 commits into
openclaw:mainfrom
pgondhi987:fix/fix-910-v3

Conversation

@pgondhi987

@pgondhi987 pgondhi987 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Delegated agent work could regain tools that had already been removed from the sending turn when a message crossed session, scheduled-run, worker, or mediated CLI/MCP boundaries. A receiving turn could therefore exceed the sender's current tool restrictions.

Why This Change Was Made

The sender's final exact-name tool restriction is captured in host-owned context and intersected with the receiver's own policy at admission. The restriction follows fresh turns, scheduled fallback, chained sends, direct command paths, workers, and mediated CLI/MCP grants without modifying the target session's persistent policy. Host-bound execution tools remain available at their source but are excluded from transferable session, child, and scheduled-run authority. Detached follow-ups retain both source-run and individual-request cancellation.

Active or out-of-process targets whose compatible authority cannot be proven fail closed with retry guidance. If a Gateway restart discards the process-bound exact cap, recovery pages backward through durable source provenance and stops delegated work before constructing tools instead of substituting the target's generic recovery catalog. If transcript or provenance inspection itself fails while replaying a pending final, recovery now retains the established restart-safe tool fence instead of clearing it.

User Impact

Delegated turns can no longer gain tools unavailable to their caller. Allowed delegation continues to work, receiver-side restrictions still narrow the result, and incompatible active targets return an actionable error instead of accepting an unrestricted handoff. A delegated turn interrupted by a Gateway restart now fails visibly when its exact sender cap cannot be reconstructed; direct-user and completion-only recovery retain their existing behavior. A pending-final recovery whose transcript cannot be inspected continues only with restart-safe tools. No config, schema, dependency, or protocol changes are introduced.

Evidence

Validated on Linux with Node v24.20.0 at exact head c898d7da78c10f77ce1411ed3c315754c380a538, after merging main at 29ed7e3b810a3b62fd9e5b5778e1db02fc8266a3.

  • node scripts/run-vitest.mjs src/agents/main-session-recovery/main-session-restart-recovery.test.ts src/agents/tools/in-process-gateway.test.ts src/agents/cli-runner/prepare.test.ts src/agents/embedded-agent-runner/run/attempt-bundle-tools.test.ts src/gateway/server.sessions-send.test.ts src/gateway/tool-resolution.exclude.test.ts — 534/534 tests passed across recovery, CLI preparation, embedded tool policy, in-process Gateway transport, real Gateway session-send, and Gateway tool projection.
  • The five-case recovery proof injects recent-transcript and full-provenance read failures with the safe-tool marker both present and absent. All four failure cases retain only the real read tool, read a real allowed file, persist the safe-tool marker, and leave the forbidden effect file absent. The no-failure unrestricted control reaches the same real write sink and creates the expected file.
  • Sensitivity check: temporarily removing only the three-line production fix caused all four read-failure cases to fail because the forbidden 31-byte file was created; the unrestricted control still passed. The production fix was restored immediately.
  • pnpm tsgo:core and the canonical selected agents-other and agents-tools test-type graphs passed.
  • Focused type-aware oxlint, focused oxfmt check, commit hooks, and scoped diff checks passed.
  • The final exact-head follow-up only consolidates duplicate imports reported by CI; it has no behavior change. At this head, pnpm tsgo:core, focused lint/format, and the 32-case sessions-send-tool.a2a.test.ts suite pass.
  • Current main stores task-resume authority in a process-private carrier. The merged sessions_send cancellation wrapper now preserves that carrier when copying a request to attach its signal. The exact failing CI file was reproduced at 3 failures before the fix and passes 6/6 after it; the four-file aggregate covering task resume, Gateway session send, requester policy, and in-process dispatch passes 65/65. Core types, the canonical Gateway test-type graph, focused lint/format, and diff checks also pass at the exact head.

This recovery proof enters through the production restart-recovery store and dispatch seam, creates a real admitted run, performs real embedded tool preparation, and exercises concrete filesystem read and write tools. It intentionally does not claim to reconstruct a lost exact delegated cap: when provenance is unreadable, it proves the conservative restart-safe catalog prevents broader mutation authority. Successful empty or missing transcript reads retain the existing unrestricted direct-recovery contract.

The prior exact-head integration proof at ffe945cdd6be6927af39e5b67d2f110405091fbe remains relevant to unchanged session-send boundaries:

  • node scripts/run-vitest.mjs src/gateway/server.sessions-send.test.ts src/gateway/client-callsites.guard.test.ts — 24/24 passed across the full 23-case Gateway suite and the unchanged production-callsite guard.
  • The direct-announcement pair sends through the real Gateway, closes the primary receiver normally, admits a distinct announcement turn, and proves individual-request cancellation prevents final file I/O while the live control writes the file.
  • The node-authority pair uses an authenticated in-process node handler over a real local WebSocket. Node-only exec remains available at its source but is absent after delegation; an unrelated transferable write remains available, and the generic-exec control produces both expected files.

Sanitized observed output from that retained integration proof:

sessions_send node-only exec proof: source command completed; Gateway receiver admitted; local exec file absent; transferable write file written
sessions_send generic exec proof: source command completed; Gateway receiver admitted; local exec file written; transferable write file written
sessions_send announce proof: primary completed; distinct direct target admitted; source completed; request live; file written
sessions_send announce proof: primary completed; distinct direct target admitted; source completed; request cancelled; file absent
Test Files  1 passed (1)
     Tests  23 passed (23)

This is focused local adapter and integration proof. The command/model seams are deterministic, while admission, recovery dispatch, continuation authority, policy projection, tool preparation, exec/write implementations, node command handling, local WebSocket transport, process I/O, and filesystem sinks are real. It does not claim an external physical-node, live-provider, or external-channel test. Exact-head CI is running.

Before Merge

Maintainer acceptance is still needed for the intentional fail-closed behavior on unsupported handoffs and delegated restart recovery. The older overlapping implementation in #125844 is closed unmerged, so no consolidation action remains for this PR.

@pgondhi987
pgondhi987 requested a review from a team as a code owner September 10, 2026 18:15
@clawsweeper

clawsweeper Bot commented Sep 10, 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 gateway Gateway runtime agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Sep 10, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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 10, 2026
@clawsweeper

clawsweeper Bot commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 3:13 AM ET / 07:13 UTC (Revision 13).

ClawSweeper review

What this changes

Preserves a sender’s tool restrictions across delegated session turns, follow-ups, workers, and mediated CLI tools, and rejects handoffs or recovery that cannot enforce them.

Merge readiness

⛔ Blocked before merge - 3 items remain

This PR remains necessary: current main lacks the sender-cap handoff. The recovery finding is resolved, the resume-carrier follow-up is sound, and the supplied boundary proof is sufficient. No new actionable defect was found.

Priority: P0
Reviewed head: c898d7da78c10f77ce1411ed3c315754c380a538
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent repair with strong boundary proof and no remaining actionable finding; compatibility acceptance is a separate merge decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The captured Linux proof connects production session-send admission and tool assembly to real Gateway/node transport and filesystem sinks, showing allowed effects and rejection after denial or cancellation. Recovery proof exercises real embedded tools under injected transcript failures, including an unrestricted control and reported red/green sensitivity; model and command seams remain deterministic.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The captured Linux proof connects production session-send admission and tool assembly to real Gateway/node transport and filesystem sinks, showing allowed effects and rejection after denial or cancellation. Recovery proof exercises real embedded tools under injected transcript failures, including an unrestricted control and reported red/green sensitivity; model and command seams remain deterministic.
Evidence reviewed 12 items Exact-head follow-up: GitHub confirms the pinned head has parent 2259599. Its production change preserves the existing private resume binding when copying the request to attach cancellation; the accompanying regression covers resume with and without an execution signal.
Resume authority remains privately owned: The carrier is a process-owned WeakMap binding. The existing resume owner checks the calling parent, paused task, child incarnation, and generation, then revalidates immediately before atomic adoption; the new wrapper preserves that contract.
Previous recovery finding resolved: The pending-final transcript-error path now explicitly retains restart-safe tools. Successful provenance lookup also rejects delegated recovery when its process-bound authority is unavailable.
Findings None None.
Security None None.

How this fits together

Session sends let one OpenClaw agent request work in another session. The Gateway admits that work, assembles its permitted tools, and manages replies, cancellation, and restart recovery.

flowchart TD
  A[Sender's permitted tools] --> B[Capture exact tool cap]
  B --> C[Gateway admission]
  D[Target policy and live authority] --> C
  C --> E{Can restrictions be enforced?}
  E -->|Yes| F[Restricted delegated turn]
  E -->|No| G[Visible rejection]
  F --> H[Guarded tools and follow-ups]
Loading

Decision needed

Question Recommendation
Should unsupported session handoffs and delegated restart recovery fail closed when OpenClaw cannot preserve the sender's exact tool authority? Accept the documented restrictions: Accept fail-closed enforcement and the documented supported-target retry path, subject to the applicable security-owner review.

Why: The proof establishes enforcement, but accepting interruptions to existing delegation and recovery workflows requires owner judgment.

Before merge

  • Resolve merge risk (P1) - Existing ACP, unsupported remote transport, and incompatible active-target handoffs can now fail; delegated work can also stop after restart when its exact authority is unavailable. Explicit owner acceptance of these operator-visible restrictions remains unrecorded.
  • Complete next step (P2) - Record explicit owner acceptance of unsupported-handoff and delegated-restart failures, with the applicable security-owner review.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
Agent review details

Security

None.

PR surface

Source +524, Tests +1583, Docs +4. Total +2111 across 52 files.

View PR surface stats
Area Files Added Removed Net
Source 28 648 124 +524
Tests 23 1722 139 +1583
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 52 2374 263 +2111

Review metrics

Metric Value Why it matters
Production versus test growth Production net +524; tests and test support net +1583 Production growth has a stated cross-runtime authority-preservation purpose, with most added code devoted to boundary validation.

Root-cause cluster

Relationship: canonical
Canonical: #144269
Summary: This remains the active sender-restriction implementation; the older overlapping branch is closed unmerged, and automatic-reset lifetime work is distinct.

Members:

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

Merge-risk options

Maintainer options:

  1. Accept bounded delegation failures (recommended)
    Explicitly accept errors for unsupported handoffs and unreconstructible delegated recovery while retaining the documented retry guidance.
  2. Hold for broader adapter support
    Pause the PR while extending exact-authority enforcement to any unsupported workflows the owner requires.

Technical review

Best possible solution:

Keep one exact, transient sender cap across supported adapters, with owner-approved visible rejection and recovery guidance wherever enforcement is unavailable.

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

Yes, there is a high-confidence source-backed path: a restricted sender delegates to a broader target, while current main lacks the exact-cap handoff. Supplied boundary fixtures exercise this mechanism; this review did not execute target code.

Is this the best way to solve the issue?

Yes, the transient cap and existing admission owners provide a coherent repair without changing persistent target policy; the intentional unsupported-path failures still require acceptance.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P0: The central defect allows delegated work to regain tools excluded from its sender's authority.
  • merge-risk: 🚨 compatibility: Enforcement intentionally rejects previously accepted unsupported handoffs and some delegated restart recovery.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The captured Linux proof connects production session-send admission and tool assembly to real Gateway/node transport and filesystem sinks, showing allowed effects and rejection after denial or cancellation. Recovery proof exercises real embedded tools under injected transcript failures, including an unrestricted control and reported red/green sensitivity; model and command seams remain deterministic.
  • proof: sufficient: Contributor real behavior proof is sufficient. The captured Linux proof connects production session-send admission and tool assembly to real Gateway/node transport and filesystem sinks, showing allowed effects and rejection after denial or cancellation. Recovery proof exercises real embedded tools under injected transcript failures, including an unrestricted control and reported red/green sensitivity; model and command seams remain deterministic.

Evidence

What I checked:

  • Exact-head follow-up: GitHub confirms the pinned head has parent 2259599. Its production change preserves the existing private resume binding when copying the request to attach cancellation; the accompanying regression covers resume with and without an execution signal. (src/agents/tools/sessions-send-tool.ts:589, c898d7da78c1)
  • Resume authority remains privately owned: The carrier is a process-owned WeakMap binding. The existing resume owner checks the calling parent, paused task, child incarnation, and generation, then revalidates immediately before atomic adoption; the new wrapper preserves that contract. (src/gateway/session-subagent-resume.ts:130, c898d7da78c1)
  • Previous recovery finding resolved: The pending-final transcript-error path now explicitly retains restart-safe tools. Successful provenance lookup also rejects delegated recovery when its process-bound authority is unavailable. (src/agents/main-session-recovery/main-session-restart-recovery-store.ts:545, c898d7da78c1)
  • Recovery final-effect proof: The supplied body reports four injected read-failure cases retaining only read, preserving the safe-tool marker, and leaving the forbidden file absent; the unrestricted control writes the file. Inspection confirms the fixture connects the production recovery dispatch seam to real admission, embedded tool preparation, and filesystem tools. The reported red/green sensitivity was not rerun during this read-only review. (src/agents/main-session-recovery/restart-recovery-tool-effects.test-support.ts:10, c898d7da78c1)
  • Delegation and cancellation proof: The captured PR body retains terminal observations at ffe945c: node-bound exec works at its source but cannot become receiver-local exec, transferable write succeeds, and request cancellation after distinct announcement admission prevents final file I/O. Inspected harnesses use real Gateway routing, local WebSocket/node handling, admission, execution guards, and filesystem sinks with deterministic command/model seams. (src/gateway/server.sessions-send-authority.test-support.ts:116, c898d7da78c1)
  • Current main still needs the repair: At fetched main, sessions_send uses its original Gateway caller without the exact sender-cap wrapper. The recovery transcript-error branch also resumes a pending final without the explicit safe-tool fence. This is behavioral context, not evidence that merging the PR removes main changes. (src/agents/main-session-recovery/main-session-restart-recovery-store.ts:526, 25ae7a5b5377)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • jalehman: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • openclaw/openclaw-secops: 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 (12 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-10T20:47:28.345Z sha fcf3765 :: needs real behavior proof before merge. :: [P1] Preserve request cancellation when admitting detached follow-ups | [P1] Resolve delegated provenance beyond the recent transcript window | [P1] Exclude node-only exec from transferable session-send authority
  • reviewed 2026-09-10T21:11:33.620Z sha 6bf2d54 :: needs real behavior proof before merge. :: [P1] Preserve request cancellation when admitting detached follow-ups | [P1] Exclude node-only exec from transferable session-send authority
  • reviewed 2026-09-10T22:03:45.392Z sha 4a1a923 :: needs real behavior proof before merge. :: [P1] Preserve request cancellation when admitting detached follow-ups | [P1] Exclude node-only exec from transferable session-send authority
  • reviewed 2026-09-10T22:24:10.428Z sha 633921d :: needs real behavior proof before merge. :: [P1] Preserve request cancellation when admitting detached follow-ups | [P1] Exclude node-only exec from transferable session-send authority
  • reviewed 2026-09-10T23:12:50.792Z sha 08e5e5e :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-11T07:23:30.604Z sha ffe945c :: blocked before merge. :: none
  • reviewed 2026-09-15T23:14:26.463Z sha 8c45405 :: needs real behavior proof before merge. :: [P1] Preserve recovery restrictions when transcript inspection fails
  • reviewed 2026-09-16T06:23:57.329Z sha 2259599 :: blocked before merge. :: none

@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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 10, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 10, 2026
@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Sep 10, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 15, 2026
@pgondhi987

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR now resolves the current main conflicts and addresses the recovery read-failure finding at exact head 28d019950249bf5c6cd9abb08d938a7b1fcc1d00. The Evidence section documents the five-case real-filesystem proof, including red/green sensitivity and the unrestricted control.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@pgondhi987

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR now resolves the current main conflicts and addresses the recovery read-failure finding at exact head 2259599a22283f786c333b00920c24852814263a. The Evidence section documents the five-case real-filesystem proof, including red/green sensitivity and the unrestricted control. The only change after that proof is a behavior-neutral duplicate-import consolidation required by CI.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

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: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 16, 2026
@pgondhi987

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The PR now resolves the current main conflicts and addresses the recovery read-failure finding at exact head c898d7da78c10f77ce1411ed3c315754c380a538. The Evidence section documents the five-case real-filesystem proof, including red/green sensitivity and the unrestricted control. Follow-ups consolidate duplicate imports and preserve main's process-private task-resume carrier through the sessions_send signal wrapper; the originally failing CI file and the 65-case authority aggregate now pass.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc vincentkoc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secops review found two fail-open authority paths; changes required.

  • src/agents/main-session-recovery/main-session-restart-recovery-store.ts assigns forceRestartSafeTools: true when transcript/provenance recovery throws. That tool set includes read, so restart can resurrect a delegated run whose source cap denied read.
  • src/agents/embedded-agent-runner/runs.ts treats a missing operational caller instance as sufficient closure evidence when a requester cap exists. A copied cap must not survive closure without authoritative live identity.

Keep every absent, corrupt, or stale authority input fail-closed. Split this into sender cap capture/intersection, transport adoption, closure-bound active/detached authority, and restart recovery. At 52 files and multiple lifecycle boundaries, this head is not landable.

@vincentkoc

Copy link
Copy Markdown
Member

Split into the narrower security stack:

Both replacements credit @pgondhi987 for the original diagnosis and implementation context. The rewrite deliberately omits the broad compatibility, detached-continuation, and active-queue machinery: unsupported handoffs fail closed instead of carrying bearer-like authority or preserving restart-safe tools that may exceed the sender cap.

@vincentkoc vincentkoc closed this Sep 17, 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 docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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.

2 participants