Repository navigation
Conversation
Use scoped SQLite receipts so certified session-only writes retain the existing immutable auth row revision. Auth and unclassified writes, schema changes, publication revisions, physical generations, and live reader authority still fence reuse. Avoid repeated credential reads and freezing during chat turns.
|
🦞👀 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. What this changesThis PR preserves cached immutable auth rows across certified session-only database writes. Example: The supplied benchmark reads 64 credential profiles 3,000 times between certified session writes.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it is maintainer-authored and provides a focused performance improvement still absent from current main; source review found no actionable introduced defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherModel-auth preparation reads persisted credential and health rows through a bounded runtime cache, then applies request-specific composition and live reader authority checks. flowchart TD
A[Model auth preparation] --> B[Live reader authority]
B --> C[Runtime auth rows cache]
D[SQLite scoped receipts] --> C
E[Auth publication revisions] --> C
C --> F[Persisted row reader]
C --> G[Request auth composition]
Technical reviewBest possible solution: Use the existing scoped receipt owner to preserve immutable auth rows across session writes while retaining all auth invalidation and reader authority checks. Do we have a high-confidence way to reproduce the issue? Current main keys reuse on the whole-database write token, establishing why a committed session write forces another auth-row read; the PR reports a baseline-failing regression, which was inspected but not executed during this read-only review. Is this the best way to solve the issue? The patch changes both token checks together and consumes the existing scoped receipt mechanism without adding another cache, state owner, or persistence contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ccb7b5f7e5de. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +4, Tests +11, Docs 0. Total +15 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel 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 Reviewed October 12, 2026, 4:20 AM ET / 08:20 UTC. |
|
Landing under the authorized inherited-failure exception. The sole root failure is the suppression inventory assertion: the pre-existing Bun assertion in The fail-fast monitor cancelled 27 collateral jobs; cancelled coverage remains unrun. The aggregate gate names that originating failure. Changed-file checks and 26 focused auth tests pass, including both nearest runtime snapshot test files; independent review is clean. No CI rerun, dispatch, or re-push was used to chase green. |
Use scoped SQLite receipts so certified session-only writes retain the existing immutable auth row revision. Auth and unclassified writes, schema changes, publication revisions, physical generations, and live reader authority still fence reuse. Avoid repeated credential reads and freezing during chat turns.
What Problem This Solves
Repeated model-auth reads reload and deeply freeze unchanged persisted credentials after unrelated session writes to the same SQLite database.
User Impact
Reduces allocation and repeated credential reads during active chat sessions. Credential changes, runtime publications, database replacement, and reader revocation retain their existing invalidation and authority checks. No schema, config, migration, or update behavior changes.
Why This Change Was Made
The rows cache currently keys reuse on the whole-database write token. Use the existing scoped-receipt owner instead: session-only writes no longer invalidate auth rows, while auth writes and all unclassified writes still invalidate through its unscoped revision. Freeze still occurs once when a new row revision is loaded; no second cache or alternate freeze path is introduced.
The source audit found that production scoped writers are session owners. Auth writes remain unscoped. Production LOC is +4 (7 added / 3 removed), entirely the scoped-token argument, its formatting, and the ownership comment. Retaining invalidation for unknown writes and schema/physical-generation changes requires the existing scoped receipt; dropping the write check in favor of auth publications alone would not preserve that contract. There is no new state owner, cache, branch, or helper.
Evidence
The corrected 20-session allocation profile attributed 7.122 GiB to property descriptors and 5.871 GiB to immutable traversal from auth-row cache admission: 12.993 GiB / 5.87% of sampled main-thread allocation.
A synthetic Linux benchmark uses the real row reader and cache with 64 credential profiles and 3,000 reads interleaved with certified session writes. Each timing run has 100 warmups; allocation is sampled separately at 1 KiB including collected objects. The auth-read timing excludes the preceding SQLite write; total iteration time includes it.
Measurement host: isolated Linux rig, Node 26.8.1, source
ac5432479226a46259c303ad3a8907fc8ad310feplus this change. Command:nice -n 10 ionice -c3 node --import ./scripts/tsx.mjs .rig/bench.mts baselineand the same command withcandidate. The fixture uses real SQLite writes, the production receipt mechanism,readAuthProfileRows, andcreateRuntimeAuthProfileRowsCache. These are focused measurements, not a full-Gateway throughput claim.The new worker-receipt regression fails on the unchanged implementation at the row-identity assertion and passes with the fix.
pnpm test src/agents/auth-profiles/runtime-persisted-rows.test.ts --maxWorkers=1: 4 tests passed; 1.18 s test bodies, 96.58 s wrapper wall time (mostly worker-artifact preparation). Changed-file oxfmt passed. Focused repository lint passed on both changed TypeScript files (runOxlintwithconfig/tsconfig/oxlint.core.json). Independent Codex autoreview returned scoped-clean with no actionable P0–P2 findings. PR CI owns full gates. No Testbox or Crabbox lease was allocated. The Linux rig is used only for measurement; no Team or live user data was accessed. Full-workload allocation share after this change has not been measured.CI disposition
CI run 38222430842 stopped on the inherited
type-suppression-inventory.test.tsratchet failure:scripts/lib/managed-cleanup-handoff.mtsadds a Bun@ts-expect-error, yielding 19 entries versus 18 expected. The failing test and its subjects are unchanged between the tested main baseline76f4fdd41acf06621fe5b4605f67816f63a7f698and CI merge3f952a215d8fef42f550062dfe581c70cb277aa2. The same assertion reproduces on unmodified mainccb7b5f7e5de8e0e6c3bd20030c902d2134e9a15usingpnpm test test/scripts/type-suppression-inventory.test.ts --maxWorkers=1(10.51s).The successful fail-fast monitor cancelled 27 remaining jobs; those are unrun coverage, not additional source failures. The aggregate gate reports the originating inventory failure. No rerun or re-push was requested. Closest sibling proof passed:
runtime-snapshots.test.tsandruntime-snapshot-publication.test.ts, 22 tests / 29.82s wrapper. Together with the changed-file proof, 26 focused auth tests pass. Landing uses the authorized inherited-failure exception.