Repository navigation
perf(agents): retain admission facts for async catalog reads - #175347
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9019bf8d20
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| catalogs = scope.run(input, () => | ||
| readPluginModelCatalogEntries(input, PLUGIN_MODEL_CATALOG_CACHE_SCOPE, input.pluginIds), |
There was a problem hiding this comment.
Normalize the agent ID before entering the read scope
When agentDir resolves to a noncanonical owner ID (for example, a custom .../Foo/agent path), scope.run records Foo, but readPluginModelCatalogEntries normalizes it to foo before calling withScopedOpenClawAgentDatabaseReadOnly. The scope therefore does not match, so the read uses the global cached scope instead; this finally closes only the unused local scope, leaving the actual SQLite handle open through result transfer and until idle expiry or invalidation. That violates this worker's close-before-transfer contract and can block database replacement/cleanup, particularly on Windows. Normalize input.agentId when constructing both the scope target and read options, as the removed operation did.
Useful? React with 👍 / 👎.
|
Codex review: needs changes before merge. What this changesThis PR moves asynchronous model-catalog reads to an owned worker that retains physical database admission facts between requests. Example: Repeatedly load persisted catalogs for agent main.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this maintainer-directed optimization is useful, but a P2 scope-matching defect leaves native readers open for noncanonical agent IDs. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherAgent preparation and model registries request persisted catalogs from per-agent databases; the worker returns catalog rows while the host retains lifecycle and disclosure authority. flowchart LR
A[Agent preparation] --> B[Catalog read owner]
B --> C[Owned task worker]
C --> D[Catalog query kernel]
D --> E[Agent database]
F[Admission publications] --> C
C --> B
Technical reviewBest possible solution: Keep the owned-worker transport and normalize the worker’s agent ID once before supplying identical options to the scope and query kernel. Do we have a high-confidence way to reproduce the issue? At the reviewed head, an unregistered custom directory ending in Foo/agent produces scope ID Foo while the reader requests foo, selecting an unclosed cached scope; this was verified from source without executing target code. Is this the best way to solve the issue? Reusing the existing admission relay is a coherent optimization with a complete transport cutover, but the replacement must preserve the former operation’s normalized scope target. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9acdc3c8aa2f. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +93, Tests +122, Docs +6, Other -1. Total +220 across 17 files. Added test files: 1. View PR surface stats
Review metrics
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 17, 2026, 5:00 AM ET / 09:00 UTC. |
|
Follow-up from the completed ClawSweeper review: normalize mixed-case custom agent directory IDs before selecting the read-only scope. The review identifies a potential |
The async catalog reader added in #175347 is a separate worker pool. Reuse the fixture's existing source-worker observer instead of counting all process workers. Keep every failure, replacement, and peak assertion. Test-only: catalog publication, recovery, and update behavior are unchanged. Original regression reproduced; all 18 importing files pass (76 tests, 391.73s wall with --maxWorkers=1). Targeted types/lint/format, architecture, source contracts, and P2 review pass. Existing unrelated Knip exports remain.
…w#175347) Route async generated-model catalog reads through the owned read-only worker pool so physical admission facts survive reader cleanup and owner publications invalidate them. Remove the generic catalog read operation and the duplicate post-capture check; preserve final disclosure authority and fresh row reads. Owner tests and static gates pass, with exactly attributed inherited Knip findings. Eleven mocked-UI CI failures pass in focused base/head runs; land with the authorized relaxed-CI exception. SQL measurement evidence follows on the PR.
The async catalog reader added in openclaw#175347 is a separate worker pool. Reuse the fixture's existing source-worker observer instead of counting all process workers. Keep every failure, replacement, and peak assertion. Test-only: catalog publication, recovery, and update behavior are unchanged. Original regression reproduced; all 18 importing files pass (76 tests, 391.73s wall with --maxWorkers=1). Targeted types/lint/format, architecture, source contracts, and P2 review pass. Existing unrelated Knip exports remain.
What Problem This Solves
Repeated async generated-model catalog reads used the generic read-only child process. That process intentionally drops physical admission facts when its native reader closes, because it has no writer-publication relay. Each catalog read therefore repeats physical admission.
User Impact
Catalog results and refusal behavior are preserved. This removes a median 38 repeated admission statements (range 37–38) across five asynchronous catalog requests; catalog request counts stay unchanged. No user action or migration is required.
Why This Change Was Made
Route these reads through an owned read-only catalog task worker. The existing worker host/server exchange retained admission facts and owner invalidations; catalog rows are still queried on every call. Close the native reader before transferring the result in bounded frames. Remove the old
pluginCatalog.readoperation, factory, registration, and transport-specific test fixtures. Quarantine refusal, real-open corruption handling, and explicit fresh Doctor/restore/backup verification remain with their existing owners. No schema or engine change and no new admission protocol.Remove the duplicate authority/identity assertion immediately following source capture. Accepted edge: a revoked queued read can waste internal work; the final authority, maintenance, and source-identity check still refuses disclosure.
T1 and compatibility
The two kernel primitives remain reachable through the released synchronous
ModelRegistry.create,refresh, andunregisterProviderSDK contract. That contract explicitly preserves synchronous disk reads through December 31, 2026, with removal in the first January 2027 stable release. Bundled discovery already uses async/prepared APIs. The other native callers are Doctor-only. This PR does not relabel the shared kernel as worker-only or claim the area reached zero T1.Measurement
Completed all three alternating shared-harness-v3 pairs, M1,C1,M2,C2,M3,C3, on base
a2e6a6b0f9c437989aa8cdf80d495240381f7be8and candidate20dfa3519a8341a47446b1df1be5142183263803. Every arm passed restart, clean shutdown, runtime/source pinning, and attribution validation. The shared harness was unmodified; Node 26.12.0 and native libraries were pinned across arms, with compile cache disabled. One build per revision was reused with byte-verified outputs. No measured arm was discarded.Values are median [min–max]. Cold/whole rows contain three observations per side; pooled warmed rows contain 30 turns per side. Raw rows count all threads by execution/dispatch window. Turn-attributed rows include only work with the corresponding turn cause; they do not erase background work from the raw totals.
The changed catalog owner removes 38, 38, and 37 statements in the three pairs (median 38), with five requests unchanged. Each side performs the same two all-scope and three key-filtered catalog reads. The removed admission work is nine engine/version probes, nine
user_versionreads, four or five quarantine decisions, fourschema_versionreads, four encoding reads, four schema inventory reads, and three metadata reads. C3 retains one cold quarantine decision lookup on a background catalog read during first turn; its stack passes through the quarantine store, admission reader, and catalog worker. It is real owner work, counted in the 6-statement result, not excluded as noise. The trace establishes the lookup but not why its retained fact was unavailable.Raw whole-workload medians change by −31 statements and −1 request. The same 194-statement registry open appears in every arm but shifts between connect and first turn: connect-only in M1/M2/C3, split 29/165 in C1 and 51/143 in C2, and first-turn-only in M3. These phase shifts are observed scheduling variation; they are not catalog savings. Credit only the catalog's median −38 statements (range −38 to −37) and zero request change; other operations and phase scheduling contribute to the difference. The raw per-run warmed median rises by 0.5 statement, below the campaign noise floor; pooled raw and turn-attributed warmed medians are unchanged. No catalog SQL, catalog dispatch (including SQL-free dispatch), or unmatched catalog read was observed during warmed turns. Generic worker stacks do not identify every possible caller, so this is no observed hidden changed-owner work, not universal attribution. Whole turn-attributed request medians are 400→401, outside the catalog cohort: pair deltas are +1 ACP first-turn request, −1 second-session settlement request, and +1 second-session settlement request. Three auth-profile helper engine probes also appear on every candidate first turn; these are outside the catalog cohort, and their causal independence is not established. No wall-time improvement is claimed on this loaded host.
Pinned database-worker inventory is unchanged: repository T1 186→186, catalog kernel 2→2; the released synchronous SDK exception above remains explicit.
The prewarm recapture cluster remains unresolved: its four earlier captures occurred beside real memory DDL, which does not prove that every capture was necessary. Additional cold snapshot reads originate in session-entry-cache owners; scheduling versus invalidation remains unproven. Neither lead is changed or claimed solved by this catalog PR.
Evidence
9019bf8d2092: catalog reader 3/3, model registry 23/23, prepared-model sources 13/13, read-only authorization 18/18, operation transport 9/9, and compile-cache process 1/1 pass. The reader tests cover canonical writes, quarantine set/clear, tracked schema damage, bounded transfers, and source replacement before disclosure.20dfa3519a83removes it. Final-head CI confirms both repaired wrapper rows and all selected Node/static jobs pass.CI exception and focused diagnosis
Final-head CI completed with all selected type, lint, source-contract, Madge, T1/dialect and Node jobs passing. Its required aggregate is red from eleven mocked-Gateway browser cases in seven files: stream batching/composer invalidations, model labels, deferred model responses, focus handoffs, thinking menus and host-selector focus.
Each failed case was run once on the base and once on the final candidate using the same installed dependencies and
pnpm test:ui:e2e, one worker and an exact name filter: 11/11 pass on each side (30 unrelated cases intentionally excluded). The complete UI tree and dependency manifests are identical between these revisions; these scenarios replace Gateway WebSockets and supply model responses directly, so they do not call the changed catalog worker. Delayed fixture requests/render/focus are plausible dependencies, not established failure causes.The CI failures remain unreproduced, not proven inherited or fixed. This landing uses the authorized relaxed-CI exception after the one-line wrapper repair, with all static gates green or exactly attributed as inherited, owner tests passing, both focused browser comparisons passing, and no proven product regression. No browser assertion, timeout or retry was changed, and CI was not rerun to chase green. Browser CI reliability remains a follow-up.
Follow-up
Follow-up from the completed ClawSweeper review: normalize mixed-case custom agent directory IDs before selecting the read-only scope. The review identifies a potential
Foo/foomismatch that could retain a native reader beyond result transfer, especially relevant to file replacement on Windows. This is a P2 lifecycle follow-up; the review reports no security finding. It is left separate under the requested two-round review limit and relaxed landing policy. No new review was requested.Scope
17 files; production/tooling +141/−49, tests +343/−221, docs +6. The production growth supplies the existing owned-pool transport and bounded result channel; it deletes the generic catalog operation and registration. No new admission protocol, schema, engine branch, or SDK signature.