Repository navigation
fix: allow guests to notify owned child sessions - #162986
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. Reviewed October 1, 2026, 4:45 PM ET / 20:45 UTC. ClawSweeper reviewWhat this changesThe PR lets guests notify their authorized owned child sessions without broad write permission, preserves steering authorization, and adds boundary regressions and documentation. Merge readiness✅ Ready for maintainer review This repair remains necessary: current main still requires broad write authority for notifications. The patch uses the existing narrow session-send policy while preserving final authorization checks; no actionable introduced defect was found. Priority: P2 Review scores
Verification
How this fits togetherThe session-send tool lets agents coordinate with other sessions. Notification delivery passes through Gateway authorization before placing context in the target’s process-local queue without starting a run. flowchart TD
A[Agent notification request] --> B[Session visibility checks]
B --> C[Gateway session-send authorization]
C --> D[Current authority and target checks]
D --> E{Authorized existing target?}
E -->|Yes| F[Process-local notification queue]
E -->|No| G[Reject without enqueue]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +11, Tests +218, Docs +2. Total +231 across 6 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep notification admission with the existing session-send authorization owner and retain synchronous current-authority and target checks before enqueue. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the path: an operator holding only operator.sessions.write reaches notification delivery, which current main authorizes as agent and rejects for missing broad write scope. The reported failing Linux regression was not independently executed here. Is this the best way to solve the issue? Yes, selecting the existing session-send policy and translating its target field is a narrow repair; steering retains its previous authorization and queue custody. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d457b2c61131. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Fixed: guests can notify their owned child sessions while current authority and target checks remain enforced. |
Allow session-scoped operators to notify their owned sessions while preserving current authority and target checks. Fixes openclaw#162924.
What Problem This Solves
Operators limited to
operator.sessions.write, including guests, cannot notify their own child sessions withsessions_send(mode: "notify"). The child passes the tool's visibility checks, but the notification adapter then authorizes it as the broaderagentoperation and rejects it withmissing scope: operator.write.Fixes #162924.
User Impact
An authorized guest can queue context for an owned child without starting a new run or receiving broad write permission. The notification keeps its existing process-local lifetime. Foreign-owned sessions remain denied, and loss of the original source authority or a role change during preparation prevents enqueueing. Already-accepted input keeps its existing queue semantics.
This change requires no configuration, protocol or stored-data migration. It does not change guest roles, the general
agentRPC, active-run steering, shared publishing, or sandbox setup.Why This Change Was Made
The existing in-process mutation helper now takes the operation being authorized. Notifications select
sessions.send, which already supports narrow session-write authority. The adapter translates its session key to that operation'skeyfield, so admission and the final guard authorize the actual target. It retains the existing original/selected requester capture, current-authority assertions and session mutation fences. Local notification admission also requires an existing admitted target: the normal send RPC can create a session, but notifications cannot queue for a target removed during preparation.The helper's only other caller, active-run steering, explicitly retains
agentauthorization and its existing custody/settlement behavior. Keeping both callers on the same authorization owner avoids a second notification permission path. The session-tool documentation now describes the narrow notification behavior.Evidence
An isolated Linux regression uses the real session tool, in-process Gateway authorization, SQLite-backed ownership and system-event queue. With a fresh owned-child fixture, original production code at b66471a fails for missing
operator.write. A second comparison completes canonical target deletion and then demonstrates an incorrectly queued notification when only the admitted-target guard is removed. Restoring the guard makes the current six-case suite pass through the existing database-worker test route:pnpm test src/gateway/local-request-context.session-notify.test.ts --maxWorkers=1passed all six cases in 47.74 seconds wall time, including 16.58 seconds of worker preparation; the test bodies took 11.15 seconds. On the exact-head hosted CI job, all six cases passed with 6.118 seconds of test-body time; job setup is excluded from that figure. This boundary needs the real authorization and persistence owners: mocking either would miss the incorrect operation, target-field mapping or lifecycle admission. The test reuses the existing isolated Gateway fixture and broker-backed suite, with no per-test server process or real timer.Formatting, full lint, structural/generated-contract checks, documentation checks, security checks and production/test compiler coverage passed, retaining earlier results for unchanged inputs. Package-boundary compilation passed for all 127 plugins, and its negative canary passed. The full build passed in 9m 3s. The selected Gateway plan passed all 25 files and 364 tests, including notification, steering, authority and continuation coverage. The complete native affected run passed all 68 selected files and 2,369 tests (one existing skipped case), across 12 plans in 734.57 seconds. It also passed a real-Gateway initial-setup smoke covering exactly-once handling of queued browser and
sessions_sendinput. Independent source review and separate P0/P1 autoreview are clean. ClawSweeper reviewed the exact head at Platinum with no findings; all hosted checks passed on the same head. All runtime proof used isolated fixtures; no existing live Gateway was changed.