Skip to content

fix: let session-scoped operators steer their own sessions - #177565

Merged
shakkernerd merged 1 commit into
mainfrom
session-steering-scope
Oct 19, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
session-steering-scope

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #177539

What Problem This Solves

Operators with operator.sessions.write can start their own sandboxed work, but sessions_send steering rejects guidance to an admitted running session with missing 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 agent RPC 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 agent operation, whose broader scope is appropriate for that RPC but does not represent this session-message effect. The existing sessions.send authorization 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. Unbound agent calls 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=1 took 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, tree 1f9720b0494ae5a5e60790d98880ab2f06ef3063. 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, and src/gateway/session-sharing.creator-namespace.test.ts.

The executable assertions establish the final effects, rather than treating a queue receipt as success:

Scenario Recorded assertion reached by the passing run
Session-write creator, child and admitted nonchild Real discovery returns owner; broad agent RPC rejects; one steer enters the receiver; receiver.commit() succeeds; persisted transcript contains exactly one matching user message with receiver steerTargetRunId.
Explicitly shared noncreator and foreign child Real discovery returns member/viewer; sessions_send returns Session-scoped writes require your own session.; receiver pending count remains zero.
Source revoked after accepted input and sender completion Existing selected-participant custody remains retained; source revocation makes receiver.commit() reject with authority/access/revoked; pending count becomes zero; durable matching-message count is zero; retained custody is released exactly once.
Sender completed without revocation Receiver commit persists exactly one matching message and releases custody; the ended sending turn receives no fresh result.

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:

Test Files  3 passed (3)
     Tests  15 passed (15)
  Duration  56.54s
Test Files  1 passed (1)
     Tests  12 passed (12)
  Duration  18.86s
[test] passed 2 Vitest shards in 105.11s
[stage-3:coverage] {"partial":true,"passed":["node"],"failed":[],"unrun":[],"retry":null}

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 unchanged src/agents/tools/nodes-tool-media.ts; the aggregate gate reflects that failure. Reproduction on unchanged target dc81220e46b69e62c2131f0b53fef651ebd770c0 using CI=true pnpm format:check --no-error-on-unmatched-pattern -- src/agents/tools/nodes-tool-media.ts fails 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.

@clawsweeper

clawsweeper Bot commented Oct 19, 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: M labels Oct 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This 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.

  • Before: Steering fails with missing scope: operator.write.
  • After: The guidance persists once in the receiver transcript; visible noncreators remain denied.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, correct repair with sufficient final-effect authority evidence; confidence is grounded in an in-process production harness rather than a shipped-entry-point demonstration.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (terminal): The maintainer’s exact-head terminal evidence exercises an authorized production-path harness through the real session tool, Gateway mutation authorization, guarded receiver, and transcript writer: owned targets persist exactly once, visible noncreators never enter the queue, and revoked retained authority cannot persist accepted guidance. This satisfies the prior authority-proof request without claiming a deployed Gateway or live model run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Session-scoped operators cannot guide their own running sessions despite already being authorized to start that work.
Reason: The maintainer-authored direction restores the documented own-work contract without adding permissions, configuration, or a competing authorization path.

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
Reviewed head: 7b3416923fe1369c57a8c30e651f6e108ee3166a

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Steering operation selection changes intended behavior with a stated reason (d73741d: The notification repair parameterized the shared mutation helper but deliberately retained agent authorization for steering; this PR explains why the creator-bound session-message operation is appropriate here.)
  • Selected-requester custody and receiver settlement keeps the original intent (d0dcc9d: Retain the selected sender’s authority until the receiver commits or ends, and reject revoked authority before persistence.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Shakker: Raw commit d73741d adds src/agents/tools/sessions-send-tool.delivery.ts:71 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: d73741dbbdae; files: src/agents/tools/sessions-send-tool.delivery.ts)

PR surface

Source +5, Tests +177, Docs 0. Total +182 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 38 33 +5
Tests 1 178 1 +177
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 217 35 +182

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #177539
Summary: This PR supplies the focused repair for the linked session-scoped steering denial; the earlier notification repair addressed an adjacent operation.

Members:

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: The bug prevents session-scoped operators from coordinating their own running work without broader Gateway permissions.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-19T18:21:44.291Z sha 7b34169 :: needs real behavior proof before merge. :: none

Reviewed October 19, 2026, 2:30 PM ET / 18:30 UTC (Revision 2).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@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.

@clawsweeper

clawsweeper Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 19, 2026
@clawsweeper clawsweeper Bot removed the clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. label Oct 19, 2026
@shakkernerd shakkernerd self-assigned this Oct 19, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 19, 2026
@shakkernerd
shakkernerd merged commit 0db4b4b into main Oct 19, 2026
175 of 178 checks passed
@shakkernerd
shakkernerd deleted the session-steering-scope branch October 19, 2026 18:35
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: session-scoped operators can steer admitted sessions they created while creator, sandbox and current-authority checks remain enforced.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 20, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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.

[Bug]: Session-scoped operators cannot steer their own active sessions

1 participant