Repository navigation
fix(gateway): keep session access and Stop bound to the original caller - #154991
Conversation
Admit narrow session operations through verified caller and canonical row ownership, preserving shared reads and independently granted broad authority. Retain the original request through aliases and exact creation handoffs. Fence Stop against replacement queued, active, pending and worker registrations while preserving accepted partials. Keep global model and agent catalogs behind broad read. Source-reviewed checkpoint. Targeted oxfmt 0.67.0, Node syntax checks and diff checks passed. Runtime and type qualification remain pending in the owned proof controller. Commit hooks skipped under the documented code-only workflow after equivalent formatting and privacy checks; configured content-guard state was preserved.
|
🦞👀 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. |
|
Move queued Stop ownership selection into its authorization owner, split sharing read projections and session creation contracts, and isolate pure worker frame helpers. Preserve the existing sharing facade, original creation COMMIT handoff, and exact worker registration cancellation bodies. Move Stop currentness cases and persistence assertions without removing coverage. Root and independent source review accepted the extraction. Line-cap and max-lines ratchets passed on the exact proof copy; the moved suggestion assertion now documents its typed producer. Qualified oxfmt 0.67.0, syntax and diff checks passed. Runtime/type qualification remains pending. Documented code-only hook bypass follows equivalent formatting/privacy checks; staged-content guard configuration remains unchanged.
Correct test ownership and direct-call outcome assertions without changing authorization. Preserve exact queued registration snapshots while applying mechanical lint corrections, and remove the earned obsolete session-sharing assertion baseline entry. Root and independent source review accepted the exact 13-path repair. Qualified oxfmt 0.67.0, syntax, diff and three cheap ratchet checks passed. Runtime and type qualification remain pending. Use the documented code-only formatting hook route; staged-content guard configuration remains unchanged.
|
Codex review: needs maintainer review before merge. Reviewed September 21, 2026, 8:46 PM ET / September 22, 2026, 00:46 UTC (Revision 10). ClawSweeper reviewWhat this changesThe PR preserves the original caller’s permissions and session identity through session access, child creation, queued work, and Stop cancellation. Merge readiness✅ Ready for maintainer review The PR remains necessary and has no actionable findings in the pinned diff. The earlier Stop-adapter finding is fixed, and the supplied boundary proof covers original, foreign, replaced, and revoked authority. Maintainer authorship also excludes automatic closure. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway authorizes requests from connected clients and hosted agent tools before passing them to session, queue, and worker owners. These changes keep delayed reads, writes, and cancellation tied to the caller and session originally authorized. flowchart TD
A[Client or agent tool] --> B[Gateway scope admission]
B --> C[Original caller and session binding]
C --> D[Session reads and writes]
C --> E[Queued work and accepted children]
C --> F[Stop target capture]
E --> G[Current authority check]
F --> G
G --> H[Commit or cancel original work]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +1070, Tests +4103, Other -1. Total +5172 across 70 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep authorization and cancellation with the existing Gateway and lifecycle owners, preserving broad grants while binding narrow operations to the original person and session. Do we have a high-confidence way to reproduce the issue? Yes, from source: current main rejects session-only grants where these methods require broad read/write scopes. The cancellation regressions have concrete production-boundary fixtures, but this read-only review did not execute them. Is this the best way to solve the issue? Yes. The patch extends existing admission, persistence, and cancellation owners rather than introducing competing authority state, and preserves independently granted broad access. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 000a635e3423. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Updated head: Both prior rank-up moves are covered: Observed boundary outcomes: an allowed original target stops; foreign and previous-incarnation targets remain untouched; a successor created by an earlier callback remains untouched for narrow Stop; source revocation prevents subsequent Stop effects; detached cleanup still settles and unrelated queued work remains runnable. These are runtime fixture results, not a production deployment claim. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Updated head: Both prior rank-up moves are covered: Observed boundary outcomes: an allowed original target stops; foreign and previous-incarnation targets remain untouched; a successor created by an earlier callback remains untouched for narrow Stop; source revocation prevents subsequent Stop effects; detached cleanup still settles and unrelated queued work remains runnable. Accepted children survive normal parent closure but reject inherited invocation or authorization-policy revocation. These are runtime fixture results, not a production deployment claim. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…er (openclaw#154991) * fix(gateway): bind narrow session authority to exact Stop targets Admit narrow session operations through verified caller and canonical row ownership, preserving shared reads and independently granted broad authority. Retain the original request through aliases and exact creation handoffs. Fence Stop against replacement queued, active, pending and worker registrations while preserving accepted partials. Keep global model and agent catalogs behind broad read. Source-reviewed checkpoint. Targeted oxfmt 0.67.0, Node syntax checks and diff checks passed. Runtime and type qualification remain pending in the owned proof controller. Commit hooks skipped under the documented code-only workflow after equivalent formatting and privacy checks; configured content-guard state was preserved. * refactor(gateway): split session authority owner modules Move queued Stop ownership selection into its authorization owner, split sharing read projections and session creation contracts, and isolate pure worker frame helpers. Preserve the existing sharing facade, original creation COMMIT handoff, and exact worker registration cancellation bodies. Move Stop currentness cases and persistence assertions without removing coverage. Root and independent source review accepted the extraction. Line-cap and max-lines ratchets passed on the exact proof copy; the moved suggestion assertion now documents its typed producer. Qualified oxfmt 0.67.0, syntax and diff checks passed. Runtime/type qualification remains pending. Documented code-only hook bypass follows equivalent formatting/privacy checks; staged-content guard configuration remains unchanged. * test(gateway): align session authority regression fixtures Correct test ownership and direct-call outcome assertions without changing authorization. Preserve exact queued registration snapshots while applying mechanical lint corrections, and remove the earned obsolete session-sharing assertion baseline entry. Root and independent source review accepted the exact 13-path repair. Qualified oxfmt 0.67.0, syntax, diff and three cheap ratchet checks passed. Runtime and type qualification remain pending. Use the documented code-only formatting hook route; staged-content guard configuration remains unchanged. * fix(gateway): retain accepted child input authority beyond spawning calls * fix(gateway): preserve exact session authority through Stop aliases * fix(gateway): preserve narrow session grants in hosted dispatch * fix(gateway): narrow captured Stop owner before key checks * test(gateway): type the child custody message hook * test(gateway): await retained descendant scheduler start * test(gateway): assert committed child admission failure * test(gateway): align abort fixtures with bound session targets * fix(gateway): preserve successor receipts during session abort * test(e2e): prepare survivor fixtures for release cohorts
What Problem This Solves
Session-scoped operators can be blocked from their own conversations, and delayed Stop work can cancel a replacement run after the original target or caller authority changes. Accepted child creation can also lose its source authority when the parent request finishes.
User Impact
Session-only callers can read permitted conversations, create and modify their own sessions, and stop their original work without gaining global configuration or catalog access. Shared viewing and existing broad operator, administrator and trusted internal behavior remain supported.
This is an authorization foundation. Question access, filtered catalogs and optional model/action restrictions are separate follow-ups. No new configuration, protocol or storage schema is introduced. Deployment, native sandbox and recovery qualification remain separate.
Why This Change Was Made
Request and cancellation owners retain the original caller, admitted scope, exact session incarnation and captured run entries through delayed work and commit boundaries. Accepted children survive normal parent closure while source revocation still denies later effects. Stop preserves successor runs and queued work, completes already-detached cleanup, and cannot overwrite a replacement run's outcome.
The integration preserves main's asynchronous worker inventory, committed state publication, continuation source lifetime and final release. Its continuation caller uses the canonical three-argument resolver so synthetic scopes, system-source classification and the Gateway resolver remain intact. Shared read/frame/type helpers replace duplicated ownership checks.
Related contributor work by @shakkernerd: #153987
Evidence
1da6fe2c4cdc373e1a1158b5c5189492f369870e, treef07086c10238666d7f0062ab07d69e9a4f9009ca, integrates frozen main73f058a4e653471383c473a93571f043ddc05587. Native source transport verifies every selected file and binds source, tree, comparison base and carrier before execution.73f058apassed: startup JavaScript 369,888 B under the unchanged 370,876 B limit; CSS 51,165 B → 51,165 B, no growth. The CSS advisory target remains a warning; hard limits are unchanged. All 1,016 finalized sidecars were verified. Exact-source native Testbox run: command exit 0 and owned lease stopped; workflow lifecycle status is separate from required PR CI.Production: 39 files, +2220/-1150 (net +1070); tests/helpers: 30 files, +4260/-157 (net +4103); baseline: -1 line. Test classification includes test/support/helper paths and test/spec/suite files. Production growth supplies original-authority, exact-session lifetime and receipt-identity checks across existing request and cancellation owners; no second registry or public worker API is added.