Repository navigation
fix: keep agents responsive when recovery closes temporary SQLite readers - #173482
VictorSesma wants to merge 10 commits into
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesSchedules authentication-triggered model publication outside the temporary SQLite reader scope that emitted the change. Example: Agent main refreshes authentication while temporary SQLite readers close.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR fixes a concrete publication failure still present on main, and no actionable patch defects remain. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherAuthentication mutations invalidate prepared model runtimes; lifecycle-owned publication rebuilds their model catalogs and makes fresh generations available to Gateway agent requests. flowchart TD
A[Authentication mutation] --> B[Synchronous runtime invalidation]
B --> C[Publication outside temporary readers]
C --> D[Existing plugin drain and publication queue]
D --> E[SQLite worker catalog reads]
E --> F[Published runtime generation]
F --> G[Gateway agent request]
Technical reviewBest possible solution: Land the focused scheduling repair through the existing runtime lifecycle owner after the enforced maintainer approval. Do we have a high-confidence way to reproduce the issue? Current-main scheduling inherits the temporary reader scope, whose closure rejects catalog inspections; supplied negative-control logs demonstrate the same failure through the shipped Gateway. Is this the best way to solve the issue? Exiting only the reader AsyncLocalStorage scope fixes resource ownership at scheduling without retries, parallel publication machinery, or changes to credential invalidation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e39ce04c8197. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +2, Tests +34. Total +36 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 HistoryReview history (4 earlier review cycles)
Reviewed October 17, 2026, 6:57 PM ET / 22:57 UTC (Revision 5). |
|
Added live Gateway evidence and reproduction steps to the PR body on behalf of @VictorSesma.
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
|
@clawsweeper re-review Completed the requested pinned-base comparison on behalf of @VictorSesma; the new Evidence subsection contains the commands and results. The same three plugin test files fail at |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Updated on behalf of @VictorSesma for current head Hosted CI for this exact head completed successfully: https://github.com/openclaw/openclaw/actions/runs/39075176358 (including lint, test type checks, changed tests, ratchets, and all three PostgreSQL shards). Codex code review completed on this exact head without findings. The enforced maintainer approval is still required; this request does not claim or substitute for that approval. Please also reconcile the stale review labels: the durable review on |
|
🦞👀 Re-review progress:
|
…es (#182615) Auth publication queued during Gateway startup inherited a temporary SQLite reader scope that startup closed before the work ran, so model publication and later reads failed with 'SQLite read-only worker scope closed' until restart. The scheduling owner now exits that reader scope when queuing, preserving the caller's own startup scope. Refs #182547 (the slow startup scan is already fixed on main by #176737 and #181289). Supersedes #173482. Thanks @VictorSesma and @hoangtohl. Co-authored-by: Victor <[email protected]>
|
Thank you @VictorSesma. You found the real cause in #182547: startup work inheriting a temporary SQLite reader that closes before the work runs. We re-implemented it in #182615, now on main, with you credited as co-author. Closing as superseded. |
|
awww, happy I helped fixing the issue, thanks for looking into this! |
…es (openclaw#182615) Auth publication queued during Gateway startup inherited a temporary SQLite reader scope that startup closed before the work ran, so model publication and later reads failed with 'SQLite read-only worker scope closed' until restart. The scheduling owner now exits that reader scope when queuing, preserving the caller's own startup scope. Refs openclaw#182547 (the slow startup scan is already fixed on main by openclaw#176737 and openclaw#181289). Supersedes openclaw#173482. Thanks @VictorSesma and @hoangtohl. Co-authored-by: Victor <[email protected]>
…es (#182615) Auth publication queued during Gateway startup inherited a temporary SQLite reader scope that startup closed before the work ran, so model publication and later reads failed with 'SQLite read-only worker scope closed' until restart. The scheduling owner now exits that reader scope when queuing, preserving the caller's own startup scope. Refs #182547 (the slow startup scan is already fixed on main by #176737 and #181289). Supersedes #173482. Thanks @VictorSesma and @hoangtohl. Release adaptation: production fix (readOnlyWorkerScope.exit around the queued publication, plus the agentDir normalization moved into the invalidation owner) applied unchanged; only the conflicting main-only throwSettledAggregate import was dropped. The prepared-harness integration-test fixture change was not needed on the baseline (its main-only DB admission setup is absent) and was dropped. The Gateway regression test was ported into the baseline describe block using its sendAgentRpc and setRuntimeAuthProfileStoreSnapshot; the main-only rows-cache cold-read step was omitted. It fails without the fix with "SQLite read-only worker scope closed". Co-authored-by: Victor <[email protected]> (cherry picked from commit 411bac2)
…es (#182615) Auth publication queued during Gateway startup inherited a temporary SQLite reader scope that startup closed before the work ran, so model publication and later reads failed with 'SQLite read-only worker scope closed' until restart. The scheduling owner now exits that reader scope when queuing, preserving the caller's own startup scope. Refs #182547 (the slow startup scan is already fixed on main by #176737 and #181289). Supersedes #173482. Thanks @VictorSesma and @hoangtohl. Co-authored-by: Victor <[email protected]> (cherry picked from commit 411bac2) Adapted for 2026.9.x: 9.x queues auth publication with publicationQueue.enqueue (main uses modelRuntimeDrain.runAfter), so the enqueue is wrapped in readOnlyWorkerScope.exit; the queue's previous.then(task) continuation otherwise captures the emitter's reader scope. Dropped main's normalizedEvent cleanup in prepared-model-runtime-auth-publication.ts and the source-delivery integration test mock change (unrelated refactors). beginPreparedModelRuntimePluginDrain does not exist on 9.x, so the regression closes the startup reader scope synchronously before the queued publication runs, then asserts publication completes, ensureOpenClawModelsJson sees no inherited reader scope, and an agent run on the affected agent completes.
Related: #158592 (the same unpublished-runtime symptom; this patch addresses a different, reproduced trigger).
Prepared and submitted by Codex on behalf of Victor Sesma (@VictorSesma), with his explicit authorization. Originally submitted as a draft at his request; the PR is now ready for review. Validation below identifies the tested revisions.
What Problem This Solves
Fixes agents becoming unavailable when an authentication change queues a model refresh from temporary SQLite readers that close before the refresh finishes, as can happen during deferred database recovery.
User Impact
The refresh completes and the agent can handle its next request without restarting the Gateway. Credential invalidation and genuine publication failures continue to reject affected requests.
Why This Change Was Made
The queued refresh inherited the emitter's SQLite AsyncLocalStorage scope. Closing that scope caused real catalog reads to fail with
SQLite read-only worker scope closed, leaving the reply runtime unpublished.Schedule auth publication outside that SQLite scope. Reads continue through the existing bounded worker pool and runtime lifecycle; the spawn broker, plugin registry, publication ordering, and synchronous credential invalidation retain their existing behavior. No retry manager, new state, configuration, or schema changes are added.
Evidence
Conflict resolution against main (
43ed85ea9)Merged upstream
05ade6d2df13f660e9df17cbedaeba5eb9f93dfcto resolve the new conflict inprepared-model-runtime.ts. Both branches had added an import at the same location: the resolution keeps upstream'sthrowSettledAggregateand this fix'sreadOnlyWorkerScope. All other upstream changes merge normally.The authored PR patch is unchanged: its stable patch ID with zero context is
0155fdf46591daf220a6768af311f2c934533eb3both before and after integration. The diff remains three files, 45 additions and 9 deletions. The scheduling fix, directory normalization, and regression are preserved.Validation of the merged candidate in the isolated Ubuntu VM (pnpm 12.12.1):
git diff --checkagainst the integrated main, and the official line-cap ratchet: passed; no new line-cap violations or growth.Hosted checks for the new revision track current CI. The prior clean code review and live Gateway red/green proof below retain their original revisions; no new live-model execution is claimed for this mechanical conflict resolution. Maintainer approval is still required for the new head.
Previous integrated revision (
dcc5a5f)Merged upstream
0a0d88df543a9d36c4708f93c56d995da769050cinto the PR branch. The resulting PR diff remains three files, 45 additions and 9 deletions: the reader-scope scheduling fix, existing auth-directory normalization moved into its processing owner, and the connected-Gateway regression.Hosted CI on this exact head completed successfully on 2026-10-17 at 22:49 UTC, including lint, test type checks, changed tests, the baseline ratchets, and all three PostgreSQL conformance shards. The historical LRU failure documented below is from an earlier revision, not a failing test in this CI run. The inspected lint/ratchet annotations do not flag any of the three changed files; advisory annotations elsewhere remain visible in GitHub.
Codex code review completed on
dcc5a5fced7cb41027e056e433dc772c1394ad28with no findings. Maintainer approval remains required for the current revision because the patch touches auth-publication code; the associated approval gate is separate from the CI execution result.The live Gateway proof and local red/green regression results below retain their original tested revisions. They have not been relabeled as new local runs on this merge commit.
Requested CI rerun (
6e83931d5)The author requested a fresh CI execution. This empty commit has exactly the same Git tree as
7328d09d3; it changes no source files, tests, or CI configuration. The validation and pinned-base failure attribution below remain attached to their recorded revisions. Checks for this rerun.CI failure attribution: identical failure on the pinned main base
Completed the pinned-base comparison requested by ClawSweeper. Historical result on
7328d09d3: the failing LRU assertion also fails on that revision's pinned main base without this PR.Failed CI job:
checks-node-changed-compact-small-3,src/plugins/runtime/runtime-llm.prepared-owner.test.ts,keeps completion ownership coherent: lru, line 923. The global CI gate also fails as a consequence. The native failure classifier reportedunknownbecause the scheduled-main run had no matching job; the following direct comparison supplies the missing attribution.In the same isolated Ubuntu VM, with Node 24.21.0, pnpm 12.11.1, unchanged dependencies, and the same three plugin test files selected by the failed CI shard:
7328d09d3b0ab44081ef483fcd0a86c8afae3b4eb30e9bc24, clean detached checkout, no PR changesBoth runs used:
OPENCLAW_VITEST_RUNTIME=node NODE_OPTIONS=--max-old-space-size=3072 \ pnpm test \ src/plugins/prepared-model-generation.lifecycle.test.ts \ src/plugins/runtime/runtime-llm.prepared-owner.test.ts \ src/plugins/runtime/runtime-llm.retained-generation.test.ts \ --maxWorkers=1The LRU diagnostic reports
buildsBeforeSecond: 11andsecondBuilds: 11in both runs: the owner-reuse assertion passes; the subsequent globalModelRegistry.forkcount fails. Source inspection shows a possible additional catalog-projection fork: snapshot capture wrapscreateStores()with another fork when published models are available, after background catalog discovery. The test and these owners are unchanged by this PR.The comparison establishes that the CI assertion is pre-existing, rather than a regression from detaching the auth-publication reader scope. No source, test expectation, baseline, or CI setting was changed during this investigation. The PR checkout was restored cleanly to
7328d09d3. That revision's failing check was retained for maintainer handling under the repository's inherited-failure policy. See the latest-revision status above for current CI and approval requirements.Conflict resolution against current main (
7328d09d3)Merged upstream
b0ab44081to resolve the conflict introduced when #174670 refactored the connected-Gateway test helpers. Preserved the upstream test file and adapted the temporary-reader regression torefreshAuth,sendAgentRpc(agentId, runId), andexpectCompleted. The runtime scheduling fix and the line-cap repair are unchanged.Validation on the merged candidate in the isolated Ubuntu VM (Node 24.21.0, pnpm 12.11.1):
phase: failedandSQLite read-only worker scope closed(154.04 s wall time). Restored and verified the exact reviewed/passing source bytes before committing; the negative-control edit is not published.git diff --checkpass.autoreviewof the full candidate diff against the new main: no actionable P0–P2 findings.Hosted checks for the merge commit record the CI state for that revision. This run uses the existing connected-Gateway harness with real SQLite and mocked provider discovery/agent execution. The separate shipped-Gateway/live-model evidence below remains explicitly attributed to its original revision.
Line-cap follow-up (
a85c45b)Moved the existing auth-event directory normalization into
invalidatePreparedModelRuntimeOwnersForAuthMutation, its sole processing owner.prepared-model-runtime.tsnow has 697 counted lines instead of 701 (cap: 700). The scheduling fix and all regression coverage remain intact; no lint limit or baseline was relaxed.Validation of this follow-up in the isolated Ubuntu VM:
6e73bd9: passes.config/tsconfig/oxlint.core.json: 292 rules, zero warnings/errors; formatting passes.autoreviewof the incremental change: no actionable P0–P2 findings.Hosted checks for this head. The shipped-Gateway red/green output below was recorded on
67eb4ad; it is retained with its original revision rather than relabeled as a new run.Live Gateway proof (outside Vitest)
Added in response to ClawSweeper's proof request.
On 2026-10-15, built and ran head
67eb4ad0be334581d3af129b15649fd025800bb9through the shippedpnpm openclaw gateway runentry point in a disposable Ubuntu VM. The Gateway selected the pinned Bun 1.4.3 runtime (Node compatibility version 26.3.0); build tooling used Node 24.21.0 and pnpm 12.10.1. Agent execution used the native OpenClaw agent harness and real llama.cpp inference with Qwen3-0.6B Q8_0, over loopback, without external model credentials.agentRPC67eb4adpublishedstatus: ok, model reply returnedfailed:SQLite read-only worker scope closedUNAVAILABLE: runtime owner was not publishedWithin each run, the reader close and publication events below come from the same running Gateway process. The post-recovery RPC is a separate CLI process using
gateway call agent --expect-final; it does not fall back to local execution. No Vitest, mocked provider discovery, mocked agent command, or fabricated model response is used. The negative control was saved as disposable local commit637a346fb07ee5cc5e05796591d4d520ad237f3d; its diff against the PR head is exactly the one scheduling-line reversal. Configuration and preload file hashes were identical across the final red/green runs.The deterministic input is disclosed: a disposable preload calls the existing auth-snapshot setter from a temporary SQLite reader scope, then closes the scope, using synthetic credentials and an actual persisted agent database. This isolates the publication boundary used by deferred recovery. It does not claim an end-to-end OOM/restart reproduction, an OAuth renewal test, or a production/Telegram deployment. The preload and negative-control edit are laboratory artifacts, not additions to this PR.
Recorded reader, publication and real agent RPC output
{"at": "2026-10-15T22:55:11.070Z", "pid": 31554, "event": "trigger", "run": "patched-catalog-67eb4ad", "agentDatabaseExists": true} {"at": "2026-10-15T22:55:11.075Z", "pid": 31554, "event": "invalidated", "run": "patched-catalog-67eb4ad"} {"at": "2026-10-15T22:55:11.095Z", "pid": 31554, "event": "readers-closed", "run": "patched-catalog-67eb4ad"} {"at": "2026-10-15T22:55:11.198Z", "pid": 31554, "event": "published", "run": "patched-catalog-67eb4ad"} {"at": "2026-10-15T22:54:12.601Z", "pid": 30404, "event": "trigger", "run": "negative-catalog-67eb4ad", "agentDatabaseExists": true} {"at": "2026-10-15T22:54:12.608Z", "pid": 30404, "event": "invalidated", "run": "negative-catalog-67eb4ad"} {"at": "2026-10-15T22:54:12.619Z", "pid": 30404, "event": "readers-closed", "run": "negative-catalog-67eb4ad"} {"at": "2026-10-15T22:54:12.666Z", "pid": 30404, "event": "failed", "run": "negative-catalog-67eb4ad", "error": "Error: SQLite read-only worker scope closed"}Patched Gateway, next actual agent response:
{ "label": "patched-catalog-after", "started": "2026-10-15T22:55:12.059769+00:00", "finished": "2026-10-15T22:55:37.665736+00:00", "exitCode": 0, "runId": "53fb3df0-ee0d-4b23-8b8e-aa9703fdb095", "status": "ok", "summary": "completed", "payloads": [ { "text": "Hello! How can I assist you today?", "mediaUrl": null } ], "provider": "llama-cpp", "model": "qwen3-0.6b", "executionTrace": { "winnerProvider": "llama-cpp", "winnerModel": "qwen3-0.6b", "attempts": [ { "provider": "llama-cpp", "model": "qwen3-0.6b", "result": "success", "stage": "assistant" } ], "fallbackUsed": false, "runner": "embedded" } }Negative control, the agent works before the trigger:
{ "label": "negative-catalog-before", "started": "2026-10-15T22:53:03.122586+00:00", "finished": "2026-10-15T22:54:03.583889+00:00", "exitCode": 0, "runId": "59a8a027-0235-4ab4-9658-67a835c8f7df", "status": "ok", "summary": "completed", "payloads": [ { "text": "Hello! Have a great day!", "mediaUrl": null } ], "provider": "llama-cpp", "model": "qwen3-0.6b", "executionTrace": { "winnerProvider": "llama-cpp", "winnerModel": "qwen3-0.6b", "attempts": [ { "provider": "llama-cpp", "model": "qwen3-0.6b", "result": "success", "stage": "assistant" } ], "fallbackUsed": false, "runner": "embedded" } }Negative control, the next request after the failed publication:
{ "label": "negative-catalog-after", "started": "2026-10-15T22:54:13.500473+00:00", "finished": "2026-10-15T22:54:18.698332+00:00", "exitCode": 1, "runId": null, "status": null, "summary": null, "payloads": null, "provider": null, "model": null, "executionTrace": null, "responseError": { "type": "gateway_request_error", "code": "UNAVAILABLE", "message": "prepared reply dispatch runtime owner was not published for main", "retryable": false } }Reproduce the live Gateway check (disposable state only)
This procedure uses the normal compiled CLI, a real persisted agent database, and a real local model server. The diagnostic preload below only subscribes to existing publication events and calls the existing auth-snapshot setter inside a temporary reader scope, then closes that scope. It does not replace SQLite, discovery, scheduling, publication, Gateway admission, or agent execution. Do not install it in an operator's Gateway.
Check out
67eb4ad0be334581d3af129b15649fd025800bb9, install withpnpm install --frozen-lockfile, and build throughpnpm openclaw --version. The recorded toolchain was Node 24.21.0 / pnpm 12.10.1. The source launcher selected OpenClaw's pinned Bun 1.4.3 runtime for the actual Gateway. On the 4-GiB VM the documented build override wasOPENCLAW_TSDOWN_MAX_OLD_SPACE_MB=4352; declarations were deferred withOPENCLAW_RUN_NODE_SKIP_DTS_BUILD=1(hosted CI separately passed production and test type checks).Run the official llama.cpp
b11669Linux x64 server with the officialQwen/Qwen3-0.6B-GGUFQ8_0 model:Recorded model SHA-256:
9465e63a22add5354d9bb4b99e90117043c7124007664907259bd16d043bb031.Official llama.cpp archive SHA-256:
cf07c1c112d709bd67e522017471de57ed0ec8bea031d732c5422351c07f65ac.No external model account or real API key is used.
In a separate shell in the checkout, configure fresh laboratory state through the supported CLI:
The native
llama-cppprovider is important: a generic custom provider can have no generated-catalog owner, soloadPersistedPluginModelCatalogsreturns early for an empty plugin list and the closed-reader bug is not exercised.Save the diagnostic preload below as
$LAB/recovery-preload.mjs. Adjust itsrootanddistconstants if using different disposable directories. Start the shipped Gateway command in that shell:NODE_OPTIONS="--max-old-space-size=2048 --import=$LAB/recovery-preload.mjs" \ pnpm openclaw gateway run --port 18790 --bind loopback --verboseWait for
gateway-publication-readyin$LAB/live-events.jsonl. In another shell with the same state environment, write{"run":"patched"}to$LAB/trigger.json. Observeinvalidated,readers-closed, thenpublished. Afterpublished, call the actual Gateway RPC (there is no CLI local-execution fallback):pnpm openclaw gateway call agent --expect-final --json --timeout 240000 \ --expect-url ws://127.0.0.1:18790 \ --params '{"agentId":"main","sessionKey":"agent:main:live-proof","idempotencyKey":"live-proof-unique-1","thinking":"off","message":"Say hello in one short sentence. Do not use any tools. /no_think"}'Negative control: stop only the disposable Gateway, replace the single scheduling line below in source, save it in a disposable local commit, and rebuild through the same CLI. The local commit keeps the source runner from rebuilding a dirty tree at every Gateway start; do not push it. Keep the configuration and preload identical. Restart, verify an ordinary agent RPC succeeds, and trigger
{"run":"negative-control"}. Publication now fails with the real closed-reader exception and a subsequent Gateway RPC is rejected. Use new session and idempotency keys for each request.The negative control is a local experiment, not an additional PR commit. Restore the source from the pinned head afterward. This reproduces the recovery publication boundary; it does not manufacture an OOM or claim to exercise every startup-recovery branch.
Exact diagnostic preload used for the live check
This imports the existing compiled module exports without modifying them. Capturing the initial publication context preserves the Gateway's ordinary async context; the temporary reader scope is created only around the synthetic mutation. The RPC and model server run separately from this observer.
Fast regression reproduction (Vitest)
This is a deterministic regression at the auth-publication boundary used by deferred database recovery. It uses a real persisted SQLite database and a connected Gateway, with synthetic credentials and mocked provider/agent execution. It does not require a Telegram account or a real model API key, and does not simulate the preceding out-of-memory crash or a full Gateway restart.
Use Node 24.21.0 and pnpm 12.10.1, the versions used for the recorded run. The commands below use a new disposable checkout and pin both the tested base and the PR commit.
Prepare the checkout and dependencies:
git clone --depth 1 --single-branch --branch fix/auth-refresh-reader-lifetime \ https://github.com/VictorSesma/openclaw.git openclaw-recovery-repro cd openclaw-recovery-repro git fetch --depth 1 origin \ 6e7781b5968ff4c3b8b660bd1b6b0def24503d48 \ ee6ef3aeede951c1070082a6482f9c1e69ac4a55 git switch --detach ee6ef3aeede951c1070082a6482f9c1e69ac4a55 pnpm install --frozen-lockfileKeep the new regression test, but restore the production file from the failing base:
Expected: exit code 1. The test
dispatches after the auth mutation's temporary SQLite readers closereceives publication phasefailedinstead ofpublished, withSQLite read-only worker scope closed. It fails at that assertion before sending the next agent RPC. Running the base alone would not reproduce this test failure because the new regression test is absent there.Restore the fix and run the same test:
Expected: exit code 0. Publication reaches
published, the following GatewayagentRPC returnsokwith payload statusok, and the agent-command mock is invoked exactly once. Remove-t 'temporary SQLite'to run all five tests in the file. A cold compiler preparation adds roughly two minutes on the recorded VM; the individual regression timing below excludes most of that startup cost.The test first persists the affected agent's database and prepares its runtime. It then calls
setRuntimeAuthProfileStoreSnapshot(...)insidereaders.run(...), immediately awaitsreaders.close(), and observes the asynchronously queued publication. Persisting the database is essential: an empty fixture can skip the SQLite catalog read and miss the bug. The closed-scope exception is produced by the real reader implementation.Earlier regression evidence
6e7781b5968ff4c3b8b660bd1b6b0def24503d48, the new regression fails with the exact closed-scope error. It emits a real auth mutation using an actual persisted agent database, then closes the temporary readers; the error is not mocked.agentRPC completes. All 5 tests in the Gateway auth-refresh file pass, including cancellation and rejected-publication behavior.prepared-model-runtime.reload-auth,prepared-model-runtime.auth-recovery, andsqlite-readonly-worker-session.autoreviewof the complete patch and lifecycle context: no P0-P2 findings.git diff --checkpass.Hosted validation on
67eb4adpassed: production types, test types, lint, and changed tests. The local full typecheck had previously been stopped under the 4-GiB VM's memory pressure; no success is claimed for that interrupted run. Hosted CI supplies the completed validation on67eb4ad.Local proof used Node 24.21.0 on Ubuntu in an isolated 2-vCPU, 4-GiB VM. The regression took 1.37 seconds on the failing base and 6.29 seconds after the fix, including the successful RPC. The complete Gateway file took 159.29 seconds with a cold compiler preparation; the three related files took 58.09 seconds. Real SQLite plus Gateway admission is necessary to exercise the lifecycle boundary that a fixture without a persisted database misses.
The original Vitest results above use mocked provider/agent execution; the new live Gateway proof separately exercises real local-model inference. Neither is a production deployment or live Telegram test. The scope remains the reader-lifetime publication failure, not the preceding OOM or every cause of an unpublished runtime.