Repository navigation
fix(gateway): retain question requester authority through settlement - #155335
Conversation
|
@clawsweeper review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 22, 2026, 11:04 AM ET / 15:04 UTC (Revision 13). ClawSweeper reviewWhat this changesThe PR retains question requester and session authority through delayed answers, joins terminal publication during shutdown, and updates regression coverage and test routing. Merge readiness✅ Ready for maintainer review The remaining hardening is distinct from the guest-question support already merged on main. No actionable introduced defect was found, and the final cleanup preserves the relevant parent proof. Priority: P2 Review scores
Verification
How this fits togetherGateway questions let an agent pause for a human answer. The Gateway checks requester and session permissions before registering questions, returning answers, and publishing events to connected clients. flowchart TD
A[Agent requests question] --> B[Capture requester authority]
B --> C[Read exact session in worker]
C --> D[Retain question and session identity]
E[Human answers or reconnects] --> D
D --> F[Recheck current authority]
F --> G[Deliver answer and authorized events]
G --> H[Join publication and release resources]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +893, Tests +2269, Docs 0. Total +3162 across 39 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep question settlement bound to the original authority and exact session while preserving committed answers, broad permissions, and compatible callback behavior. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the current-main reentrant-entry and detached-publication paths, and focused regressions exercise them. This read-only review did not execute a failing current-main run. Is this the best way to solve the issue? Yes. The patch extends the existing question, authority, and worker owners, preserves broad and privileged contracts, and removes the superseded internal wrapper. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 739e2410702e. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (12 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review blockedAutomated review did not run, so no review verdict was produced. Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here. ClawSweeper will not retry this unchanged revision. Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it. |
Security-sensitive guard clearedCurrent revision: This PR no longer changes files in the maintainer security-review tier. Separate CODEOWNERS requirements still apply to security policy and enforcement files. |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review exact current head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Please review exact head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* commit 'f3327bde3c6052a4ed6d487bb09fbe1e11c0cd35': (25 commits) fix(test): pass the fixture lifetime to launcher fixtures (#155825) fix(test): prepare history benchmark before child deadlines (#155780) refactor(config): derive tool contracts from schemas (#155484) chore(deps): update fs-safe to 0.18.1 (#155771) fix(doctor): allow repair with retained deleted-agent sessions (#155752) fix(setup): await inference probe cleanup (#155407) fix(mcp): recover expired SSE sessions and speed up parsing (#155497) fix(release): forward the stable soak waiver through the candidate helper (#155798) feat: calibrate Gateway plugin resources through retirement (#155792) fix: preserve the invoked launcher when restarting Node (#147621) fix(sessions): stop repeated failed worker exit cleanup (#154720) fix(ui): preserve active replies and tools after failed steering (#155746) fix(ci): retain missing-load-path baseline diagnostics (#154861) fix(gateway): keep session lists responsive during activity updates (#155767) fix: keep plugin queues bound to their selected session (#155714) chore(i18n): refresh native locales (#155571) fix(ci): wait for reset hook entry and join fixture cleanup (#155770) test: move subagent fixtures to module boundaries (#155727) fix(gateway): retain question requester authority through settlement (#155335) perf(gateway): move progress-card reads off the main thread (#153857) ...
…penclaw#155335) * fix(gateway): bind question access to session authority * test(gateway): align question scope admission expectations * fix(gateway): prepare question session access in workers * fix(gateway): preserve question publication and observer lifetimes * test(gateway): isolate question shutdown publication fixtures * fix(gateway): use canonical question sharing type imports * test(gateway): align question fixtures with canonical types * merge: integrate main into question authority * fix(gateway): break question access type cycles * fix(gateway): preserve question callback return compatibility * test(gateway): keep Telegram question config snapshot stable * test(gateway): infer asynchronous question callback fixtures * fix(gateway): preserve awaited question callback inference * fix(gateway): integrate shared session worker projections * fix(plugins): use explicit awaited inspection cleanup * fix(plugins): adopt canonical inspection cleanup * fix(ci): rebalance Gateway worker test roots * fix(gateway): integrate session row fact readers * fix(tooling): retain SQLite maintenance helper in PR wrappers * merge: integrate canonical gateway prerequisites * fix(gateway): retain requester question authority through publication * test(gateway): preserve question delivery after rejected creator restamps * chore: merge main session worker hydration updates * fix(gateway): remove unused sharing authorization wrapper Co-authored-by: Vincent Koc <[email protected]>
Related: #154991
Related: #155521 (kept open).
What Problem This Solves
Questions must retain the authority of the original requester through delayed answers, session replacement, revoked access, and Gateway shutdown.
User Impact
A requester can answer their own ordinary agent question from another authenticated connection. Foreign viewers and members cannot read or settle it. A fresh access grant cannot adopt a question created under a revoked grant, and stale work cannot cancel a replacement question that reused its ID.
Main already provides requester-only question selection and the session-write scope alternative for all five question RPCs. This PR hardens those existing rules; privileged questions retain their separate checks. No configuration, schema-version, migration, or deployment changes are introduced.
Why This Change Was Made
Retain the original caller authority, exact session/database identity, and worker resource until the question entry retires. Prepare reads through the canonical worker, then revalidate their authority before consuming the result. Confirmed source loss cancels the captured pending observation without looking up a possibly different entry by public ID.
The manager preserves committed terminal truth while joining asynchronous publication, retention grace, and shutdown. Recipient authorization reuses prepared facts. The public callback keeps its ignored-return
voidcontract; the owner joins actual returned promises.This replaces duplicated inline checks and detached publication ownership with reusable session-read, original-source, and resource-lifetime owners. Main's initial session reads were already worker-based. The bounded Gateway test-graph rebalance keeps unchanged caps, assertions, and concurrency. The final cleanup removes the now-unused internal
authorizeSessionSharingwrapper and barrel export; its existing group-authorization test now calls the canonical resolver and target authorizer directly.Production: 14 files, +1489/-596 (net +893). The growth establishes original-source authority, worker/resource lifetime, and joined publication ownership. Tests/support and runner configuration: 24 files, +2524/-255; documentation: one file, +1/-1. Total: 39 files against frozen main
0a5b5381a26b8480021005dc0145524ba6181cdb.Main owns the superseded requester feature, Doctor, wrapper-inventory, CLI declaration, and QuickJS prerequisites. Credit to @shakkernerd's original visitor work in #153987 and the foundation in #154991.
Evidence
Current signed source
4b8e265dc2debabbbf271745044ca3a72753faab, treecb71fa9a5af5858c4655ac754249f5b7fa554d52, adds only the reviewed three-file dead-wrapper cleanup to4fd2c022eb0acceb61ce7e1f60b1c1607f15fbe8.src/gateway/session-sharing-groups.test.tspassed 10/10 tests through the canonical wrapper with one worker: Vitest 33.33 seconds, wrapper 35.58 seconds. The existing positive shared-store and ambiguous-target denial controls remain.The following completed component proof belongs to parent
4fd2c022eb0acceb61ce7e1f60b1c1607f15fbe8, tree51ca6eeda01897c5431d4f425608733a8e1e0b58, normally merged with frozen main0a5b5381a26b8480021005dc0145524ba6181cdb. It is retained through the cleanup, not presented as a repeated build or authenticated run on the new head:c77760a9d590b6495ffb5949834cb2514953535dwas attested separately from signed source before and after proof. All 48,477 non-overlay entries matched. The owned worker stopped successfully, the wrapper exited zero, the exact temporary overlay was removed, and the signed development checkout is clean.56a8cb95e30057f59d098cfc4b1fb7672675d35fpassed 203 cases across 11 owner files, six type graphs, SDK declarations, and its authenticated flow. Earlier manager 48, own-run 18, and shard-guard 24 checks remain tied to6c08a76aff9c00b40fb406e1828faff0b2621fcb. These are component receipts, not additional unique current-head tests or a claim that failed earlier whole runs passed.Parent CI run 35742146267 failed its Knip production scan because the refactor removed the wrapper's last production caller. That failure is preserved; the new head removes both unused exports and retains the fixture's positive and ambiguous-target denial controls. The new head's actual-merge CI passed the original production and all-exports Knip scans, production-core types, and Gateway-other types (63.4 seconds), with the normal guards unchanged.
This is isolated authenticated Gateway/SQLite/registered-handler proof, not a deployed browser, external provider, or live Telegram session. Exact-head ClawSweeper review is ready with no actionable findings and no remaining pre-merge moves. The required CI aggregate passed on attempt 1. Its actual merge is
50f65df9f9ab9c003d7239ad2474d4d9cff85e0e, treef9a58c9772da6ace5f501108db3dc2abb0004d8a, with parents739e2410702e0b1ad1d17a6dac07ddc0ab6dbebband the current signed head. Independent composition review reconstructed that exact tree from main plus all 36 unchanged PR blobs; the three earlier shard-routing changes already match canonical main. Native preparation and final landing checks remain separate.