Repository navigation
fix: let session-scoped operators steer their own sessions - #177565
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: needs maintainer review before merge. What this changesThis PR authorizes session steering through the existing creator-bound sessions.send operation. Example: A sandboxed operator with operator.sessions.read and operator.sessions.write sends “Use the updated requirements” to an owned running child.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current creator-session steering bug without introducing a concrete correctness or security defect. The unrelated formatter failure still prevents a green CI gate. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe session-send tool passes guidance through Gateway authorization and retained caller custody into the running session’s guarded queue and transcript writer. flowchart TD
A[Session send tool] --> B[Requester selection]
B --> C[Creator bound Gateway authorization]
C --> D[Retained source authority]
D --> E[Guarded receiver queue]
E --> F[Transcript persistence]
Technical reviewBest possible solution: Use the existing creator-bound session-message authorization while retaining receiver persistence and live-authority guards. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the incorrect broad-scope admission, and the author records owned-child and owned-nonchild failures on the pinned base; no target code was executed during this review. Is this the best way to solve the issue? This is the smallest complete repair: reuse the existing mutation authorization owner, align its caller assertions, and extend the existing production-boundary fixture with distinct creator and noncreator cases. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ea16ec5335c2. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +5, Tests +177, Docs 0. Total +182 across 4 files. Added test files: 0. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel 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 HistoryReview history (1 earlier review cycle)
Reviewed October 19, 2026, 2:30 PM ET / 18:30 UTC (Revision 2). |
|
@clawsweeper re-review The PR body now includes the existing exact-head final-effect results and assertions for owned persistence, visible noncreator rejection, and source revocation after accepted custody, plus a reproduced unrelated formatter failure on the current target. No source change. |
|
🦞👀 Re-review progress:
|
|
Fixed: session-scoped operators can steer admitted sessions they created while creator, sandbox and current-authority checks remain enforced. |
…177565) Allow session-scoped operators to steer creator-owned sessions through existing session-message authorization while retaining visibility, sandbox, current-authority and receiver-custody checks. Fixes openclaw#177539.
Fixes #177539
What Problem This Solves
Operators with
operator.sessions.writecan start their own sandboxed work, butsessions_sendsteering rejects guidance to an admitted running session withmissing scope: operator.write. This includes a parent guiding its own delegated child. The error occurs before the Gateway reaches the existing creator-bound session authorization.User Impact
Session-scoped operators can steer sessions they created when the existing visibility, communication, sandbox and receiver-permission checks admit the target. Shared visibility or explicit membership does not let a noncreator use this narrow grant, and foreign children remain denied even when their recorded parent matches the sending session.
Public
agentRPC calls retain their broader scope requirement. Steering keeps its current persistence acknowledgment, exact receiver identity, cancellation and accepted-input custody behavior. No configuration or migration is required.Why This Change Was Made
The steering custody helper was authorizing an unbound
agentoperation, whose broader scope is appropriate for that RPC but does not represent this session-message effect. The existingsessions.sendauthorization already accepts the session-write grant and binds it to the current creator and target lifecycle. Steering now uses that owner and names the same operation in its caller assertions.The regression extends the existing production-path fixture through the real tool, in-process authorization, guarded queue and transcript persistence. It also runs the sender with an active transcript-write context and checks the receiver's saved run metadata; that path needs no additional context wrapper.
Evidence
On base
9b8cac3879e16d484a20b4f33196b9e507ffe7b6, creator-child and creator-nonchild steering both failed at the broad write gate. The corrected path persists exactly one steer in each case. An explicitly admitted shared member and a foreign child are denied by the creator policy before injection, after real session discovery identifies their member/viewer roles. Unboundagentcalls remain denied.Remote changed-file formatting/lint and the native selected production and consumer type checks passed. The full steering fixture passed 11 tests, including sender completion, source revocation, receiver cancellation, run replacement and custody settlement; five related files passed another 58 tests. The final four strengthened cases also passed with sender transcript ownership and receiver metadata assertions. No authorization or mutation owner was mocked away.
pnpm test src/gateway/local-request-context.session-tools-steering.test.ts --maxWorkers=1took 87.40 seconds including cold preparation; its test cases took 40.82 seconds. The final four-case refinement took 37.88 seconds including preparation, with 9.49 seconds in cases. These integration checks exercise the actual authorization and persistence boundary. No live model or deployment verification is claimed.Final-effect authority evidence
Exact tested source:
7b3416923fe1369c57a8c30e651f6e108ee3166a, tree1f9720b0494ae5a5e60790d98880ab2f06ef3063. The recorded remote run selected these four files through the repository test runner:src/gateway/local-request-context.session-tools-steering.test.ts,src/agents/tools/sessions-send-tool.queue-authority.test.ts,src/gateway/session-sharing.sandbox.test.ts, andsrc/gateway/session-sharing.creator-namespace.test.ts.The executable assertions establish the final effects, rather than treating a queue receipt as success:
agentRPC rejects; one steer enters the receiver;receiver.commit()succeeds; persisted transcript contains exactly one matching user message with receiversteerTargetRunId.sessions_sendreturnsSession-scoped writes require your own session.; receiver pending count remains zero.receiver.commit()reject with authority/access/revoked; pending count becomes zero; durable matching-message count is zero; retained custody is released exactly once.The owned/noncreator assertions and accepted-custody/revocation assertions execute the real session tool, mutation authorization, guarded receiver and transcript owner. The revocation control reuses the existing selected-participant authority fixture; the new creator cases explicitly constrain scopes to session read/write. The custody-release spy delegates to the real capture and release operations.
Recorded terminal excerpt, with terminal color codes removed:
The native execution settled with exit code 0. This is isolated production-path harness evidence; it does not claim a live model or deployed Gateway.
CI run 39299845462 completed all selected tests, types, lint, architecture and boundary jobs. Its only underlying failure is
check-docs' global formatter on unchangedsrc/agents/tools/nodes-tool-media.ts; the aggregate gate reflects that failure. Reproduction on unchanged targetdc81220e46b69e62c2131f0b53fef651ebd770c0usingCI=true pnpm format:check --no-error-on-unmatched-pattern -- src/agents/tools/nodes-tool-media.tsfails on the same file with Oxfmt/Bun parity confirmed. The failing file, formatter configuration, dependency lock and formatter runner match CI's merge base; this PR changes none of them. The formatter repair is independent of this steering change.