Repository navigation
fix: preserve queued send permissions across Gateway restarts - #196540
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
@clawsweeper review Please review commit |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves each queued send’s original authenticated source and permission limits across Gateway restarts. Example: One person queues a send with operator.read and operator.write, then sends another with operator.admin before a Gateway restart.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main authority gap in queued replay; no actionable patch defects were found, and the supplied restart, revocation, and upgrade evidence is sufficient. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherChat admission places accepted messages under the pending-input owner; shutdown records their source evidence, and startup restores current authority before replaying them through ordinary chat dispatch. flowchart LR
A[Authenticated send] --> B[Pending input owner]
B --> C[Private shutdown marker]
C --> D[Current source authorization]
D --> E[FIFO chat dispatch]
E --> F[Live tool effect checks]
Technical reviewBest possible solution: Retain original source ceilings in existing input custody and restore them through the shared authority owner while preserving live checks at execution. Do we have a high-confidence way to reproduce the issue? Current main visibly restores authority from sender attribution, and the committed regression distinguishes two accepted scope ceilings that the old path collapses to administrator authority; no target code was executed during this review. Is this the best way to solve the issue? The patch is a focused repair using existing custody, serialization, recovery authorization, and dispatch owners, with no competing queue or policy implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d553516036b6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +42, Tests +101, Docs +6, Other +2. Total +151 across 14 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes: No label 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 HistoryReviewed November 10, 2026, 5:11 AM ET / 10:11 UTC (Revision 3). |
|
@clawsweeper re-review Please review the unchanged head
|
|
🦞👀 Re-review progress:
|
Adapt the original-source recovery contract to the release's existing workspace and graceful-restart owners. Revalidate retained scope ceilings and current grants before dispatch; missing or mismatched provenance fails the queued input instead of adopting current administrator privileges. Independent local review omitted by explicit release-owner instruction. (cherry picked from commit 67a327f) Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vincentkoc <[email protected]> (cherry picked from commit a5d208a64db8837af6a599063bc8aebd985c42b2)
What Problem This Solves
Queued sends can resume under the sender’s broader current permissions after a Gateway restart instead of retaining the source that accepted each input.
User Impact
Each queued send keeps its original app, membership, scope, and model limits. Replay requires that source’s current authorization. Missing or revoked sources become failed sends that can be submitted again; older markers without source evidence also require resubmission.
Why This Change Was Made
Capture the accepted source on the existing pending-input owner before request shutdown, retain it in the private restart marker, and restore it through the existing authority owner. This preserves FIFO replay and keeps live authorization checks through execution. It requires no database schema migration.
Evidence
install.shstep passed, but its separate installed-tree budget check failed: 50,913 entries against a 47,500 budget. This branch leaves dependency manifests and packaging scripts unchanged; the exact base count has not been independently reproduced. Release publication and deployed services were not tested.802f67d8d410f4f48cb57c954ab84350a921290a, covering P0–P3, found no actionable defects. It reviewed the full diff and supplied owner code; it did not independently verify runtime evidence or cover every unchanged admission/final-effect implementation. Local ClawSweeper was unavailable. The completed hosted re-review of this exact head accepted the runtime and stable-upgrade evidence, found no actionable findings, and marked the PR ready for maintainer review. The red CI gates remain recorded below.512886c5a869has an inherited formatting failure inscripts/lib/full-release-child-reuse.mjs,test/scripts/full-release-receipt-recovery.test.ts,test/scripts/plugin-npm-cli-process.test.ts, andtest/scripts/plugin-npm-cli-recovery.test-support.mjs. All four files are byte-identical between CI's main baseb85de3162b1d92beefd2bbae220ff7a3599f88b6and merge2ca64dd2f95b7152cca7cf85f8c3724aa8ba29c4; checking those exact main files reproduced the same four failures. This branch changes no formatter code, configuration, or dependencies. The CI helper initially classified it as new against an older passing scheduled main job; exact-base inspection established that it is inherited. All other selected CI jobs passed, including builds, test/type/lint shards, and all three PostgreSQL conformance shards; the final CI gate failed solely on this formatting job.The test-line allocation grants exactly 101 net lines for the distinct per-input scope, source-rejection, and revocation regressions and updated restart expectations. The source change adds 42 net production lines and reuses existing pending-input custody and recovery ownership.
Sanitized native process-restart and filesystem-admission receipt
The following allowlisted fields were extracted from the actual runtime receipt. Private fixtures and credentials are omitted; the archive hashes identify retained local evidence and do not make those private archives public. All twelve source modules in the candidate archive were verified byte-for-byte against this commit. The observation hook pauses the real filesystem operation before its normal authorization check; it does not simulate the write or its refusal.
{ "candidateCommit": "512886c5a869a6cabcfeb3a6066b38434a503dce", "candidateOwnerArchiveSha256": "443b8a046272042f693586398826df19d6e943d313a2f57c1904d439f0c5ad16", "privateRuntimeArchiveSha256": "ff7ae550e7162ea77e9eb0d31e13916605849b88fd0a09daa1f473c33490b22d", "startedAt": "2026-11-10T09:23:02.283Z", "finishedAt": "2026-11-10T09:23:23.286Z", "status": "passed", "stage": "completed", "cleanupJoined": true, "phases": [ { "phase": 0, "status": "passed", "normalStartup": true, "actualPluginHandshake": true, "startupAdmissionReady": true, "finalAuthoritySeq": 1, "ownersClosed": true }, { "phase": 1, "status": "passed", "normalStartup": true, "actualPluginHandshake": true, "startupAdmissionReady": true, "actualMemberConsents": 2, "realAppAgentWrite": true, "queuedOriginalAppAndMembershipRetained": true, "queueRetainedForRealShutdown": true, "controlAppUsable": true, "finalAuthoritySeq": 3, "ownersClosed": true }, { "phase": 2, "status": "passed", "normalStartup": true, "actualPluginHandshake": true, "startupAdmissionReady": true, "queuedRunReachedProviderBeforeRemoval": true, "queuedWriteReachedFilesystemAdmission": true, "queuedWriteResumedAfterMembershipRemoval": true, "originalSourceRestoreRefused": true, "queueProviderWriteSupplied": true, "queuedEffectObserved": false, "removedQueuedInputDenied": true, "controlAppUsable": true, "finalAuthoritySeq": 4, "ownersClosed": true, "queuedRunCompletion": { "status": "error", "startedAt": 1794302602828, "endedAt": 1794302602924, "stopReason": "rpc" } } ], "gatewayFixtureBase": "78b4d953dbd8985eba02bea7d3f112b987c53056", "candidateModulesMatchCommit": true, "matchedSourceModules": 12, "wholeCandidatePackage": false, "limitations": [ "Retained Gateway fixture plus the twelve verified source modules; not a full-current-package or deployed-service attestation.", "Actual issuer, Discovery, native transport, app consent, agent and filesystem write; local external relay and deterministic SSE model fixtures.", "NODE_ENV=test enables an observation hook that only pauses the actual filesystem admission and reads source identity. It performs no authority validation or simulated refusal. No Vitest or module mocks." ] }Latest-stable upgrade proof passed in the published-upgrade-survivor lane, with inspectable summary and logs. The published
[email protected]updater replaced its release build with candidate source512886c5a869a6cabcfeb3a6066b38434a503dce. Candidate and installed-package identity checks, automatic migration, seeded configuration/session/transcript survival assertions, and Gateway startup/readiness/status all passed. This was thebasescenario with manual Gateway startup after the update; it does not attest a managed service restart or live deployment. The overall Package Acceptance run failed solely on the separate installed-tree budget check described above. The stable source (b556fdf457b026574bf0f1e7b4914b15f3f179ce) contains none ofresumeAfterRestart,queuedInputIds, orcontinueSessionQueuedInputs: this restart marker is a pre-release mechanism. Source-less pre-release marker rejection is covered by the committed restart and per-input regression tests; a source-less marker cannot be generated by that stable release.Published-package upgrade receipt
The following fields are projected from the admission record and successful upgrade receipt. The before/after build IDs establish that the source package replaced the stable release even though their manifest versions match.
{ "status": "passed", "runId": 42789639049, "candidateCommit": "512886c5a869a6cabcfeb3a6066b38434a503dce", "toolingCommit": "0b9114291429df561ed41340cdc035f51e0f163b", "candidatePackageSha256": "0998b29271acf82e29cff9bc527751ec5e4cd4021316e6311b471217228151e1", "baseline": "[email protected]", "beforeBuildId": "2026.11.2-release-b556fdf457b0-2026-11-07T15-35-25.381Z", "afterBuildId": "2026.11.2-512886c5a869-2026-11-10T09-22-02.457Z", "scenario": "base", "candidateInstallMode": "updater", "updateRestartMode": "manual", "updateOutcome": "success", "passedPhases": [ "candidate-package-identity", "update-candidate", "installed-package-identity", "assert-automatic-migration", "validate-post-doctor-config", "assert-survival", "gateway-start", "gateway-probes", "gateway-status" ], "gatewayTimings": { "startupSeconds": 32, "updateRestartSeconds": null, "idempotenceSeconds": null, "idempotenceBudgetSeconds": null, "healthzSeconds": 1, "readyzSeconds": 1, "statusSeconds": 2 } }