Repository navigation
fix: avoid blocking the Gateway during cold model catalog preparation - #161201
Conversation
Share auth read policy between synchronous and prepared worker consumers, carry the original environment through preparation, and prepare label paths without reopening host databases. Preserve env-only profile isolation. Route real model preparation tests through their database-worker owner and retain the existing built SDK prerequisites. Related: #161200
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. Reviewed September 29, 2026, 9:37 AM ET / 13:37 UTC (Revision 2). ClawSweeper reviewWhat this changesMoves cold model catalog auth, plugin metadata, and label preparation toward worker-backed reads while preserving the selected credential source and rerouting related tests. Merge readiness⛔ Blocked before merge - 3 items remain Keep open: the reviewed main revision still prepares cold catalog auth synchronously, and this PR is a distinct candidate fix for the linked report. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway prepares a model catalog from configured models, plugin metadata, and stored credentials. That preparation supplies model choices and auth labels to later agent and catalog requests. flowchart LR
A[Gateway catalog request] --> B[Prepared model runtime]
B --> C[Auth store worker reads]
B --> D[Plugin metadata]
C --> E[Selected credentials and path]
D --> F[Model catalog assembly]
E --> F
F --> G[Models and auth labels]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +728, Tests +661, Other +7. Total +1396 across 26 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one auth-store owner for synchronous and prepared readers, and reuse its selected credentials and source path throughout each catalog generation. Do we have a high-confidence way to reproduce the issue? Yes. The real prepared-runtime entrypoint with a cold persisted synthetic profile provides a focused path; the PR reports eight calling-thread SQLite calls before the fix and zero afterward, though this review did not execute it. Is this the best way to solve the issue? Yes. Reusing the auth owner's worker reads and carrying the selected environment through preparation fits the existing ownership boundary; the cold-path cost still needs measurement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against dc6e5cd22712. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…openclaw#161201) * fix: prepare model catalog auth without host SQLite reads Share auth read policy between synchronous and prepared worker consumers, carry the original environment through preparation, and prepare label paths without reopening host databases. Preserve env-only profile isolation. Route real model preparation tests through their database-worker owner and retain the existing built SDK prerequisites. Related: openclaw#161200 * test: verify catalog worker reuse through discovery threads
Closes #161200
What Problem This Solves
Cold model catalog preparation still reads durable auth, plugin metadata, and auth-label paths synchronously on the Gateway thread.
User Impact
Model catalog preparation uses the existing database workers while preserving the caller’s credential source and auth labels. Env-only preparation also ignores published stored profiles without deleting them. No configuration or storage migration is required.
Why This Change Was Made
The auth owner now drives one lazy read policy through both its existing synchronous API and captured worker reads. Model preparation carries the original environment and authority through awaited work. Labels consume the selected raw storage path instead of reopening SQLite while formatting. Real model preparation tests follow their database-worker project and retain their built-SDK prerequisites.
Evidence
Cold-path cost and compatibility
A paired fresh-process run of the same real cold catalog fixture measured acquisition through lease disposal on original
0c8e56cfand finald89f94d1. Both reached the correct model, synthetic credential, and label; the original then failed the unchanged eight-host-SQL assertion, while the candidate passed with zero host SQL.This is one isolated synthetic pair, not a statistical or live Gateway latency claim. It shows a 0.373 s cold-start cost in exchange for removing synchronous SQLite from the caller. RSS includes the test process and its Node worker threads, excludes external child processes, and is not a retained-memory/leak measurement. Wrapper/build time is excluded from the acquisition figures. The temporary numeric-only instrumentation was removed and all final source hashes reverified.
Measured test-body costs from retained successful runs (sums of Vitest case durations, excluding transform/import/runner overhead): inherited-store 13 cases, 7.893 s; display-path 10 cases, 5.478 s; auth-label 6 cases, 1.047 s; catalog resources 7 cases, 9.157 s; startup-static 6 cases, 1.329 s; corrected catalog capture-reuse case, 9.558 s. The existing 98-case directive file took 95.53 s including its runner/import/transform work; its unchanged status block was moved to test support for the line cap. That broad existing suite protects real directive persistence and model selection, not a new duplicate integration suite. The deleted auth-store test is replaced at its real shared-store/catalog consumers; fixture/support modules have no independent test runtime. CI's observed original 14-file Gateway group took 153.01 s before the unrelated fixture failure below.
The stored-data-model flag is a heuristic false positive: no schema, stored auth DTO, serialized representation, migration, retention, or permission changes. Existing auth SQLite readers and serializers remain authoritative; the change prepares their facts asynchronously and carries the selected path into presentation. The cold regression starts from credentials persisted by the existing writer and verifies the unchanged credential shape; inherited/OAuth/personal-account policy coverage also passes. No upgrade migration is required.
CI attribution
CI run 36575451638 is failed/cancelled, not green. Its sole failed root is eight existing session-event fixture assertions missing the canonical
prepareSessionProjectioncallback. The same original 14-file/two-worker group reproduced 117 passes and those same eight failures on clean maindc6e5cd2, without this auth change; adding the exact callback option produced 125 passes. All decisive fixture/producer inputs are identical in the tested merge. The fail-fast monitor cancelled 94 sibling jobs, whose unexecuted coverage is not claimed. The exact helper correction is now on main in 68b547f6.Landing uses the explicitly authorized native pre-existing-failure path with the exact failed run, tested merge, source comparison, independent baseline proof, and complete cancellation accounting. Current security and review checks remain enforced.