Repository navigation
fix: keep catalog discovery scoped and execution lazy - #147159
Conversation
Keep catalog compatibility on a narrow internal import and install the existing transport host before session dispatch or completion preparation. Direct SDK completions now apply provider stream wrappers before sending a request, with owner and cancellation checks after initialization.
Use explicit catalog plugin owners without automatic agent slots. Load Ollama payload helpers when their streams run and acquire the TypeScript compiler only when a typed module is actually compiled.
|
🦞👀 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. Reviewed September 13, 2026, 1:50 PM ET / 17:50 UTC (Revision 6). ClawSweeper reviewWhat this changesThe PR limits model discovery to relevant plugins, defers streaming and compiler loading, and initializes provider hooks before model execution. Merge readiness✅ Ready for maintainer review This PR remains useful: current main still lacks the scoped catalog loading and execution-boundary fixes. No actionable defect remains; the corrected cancellation fixture and updated package evidence address the previous review concerns. Priority: P2 Review scores
Verification
How this fits togetherModel catalog preparation turns configuration and plugin metadata into available model choices. Session and direct-completion execution then use the selected provider’s transport hooks to send requests. flowchart TD
A[Configuration and plugin metadata] --> B[Catalog preparation]
B --> C[Scoped provider discovery]
C --> D[Available model choices]
D --> E[Session or direct completion]
E --> F[Initialize transport and check cancellation]
F --> G[Provider request]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +71, Tests +195, Docs 0, Config +8, Other +6. Total +280 across 29 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep discovery confined to its provider owners and initialize existing execution hooks only when needed, preserving agent selection and cancellation contracts. Do we have a high-confidence way to reproduce the issue? Yes, source inspection identifies catalog scope broadening and direct transport preparation before host initialization on current main; focused regression controls cover these paths. This review did not execute them locally. Is this the best way to solve the issue? Yes. The patch repairs the existing loading and execution owners, reuses the compatibility implementation, and preserves public settings and plugin contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ef2861d55a5d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
Cancel the manual compaction after its provider is admitted so its exact rejection remains observable. Assert that cancellation before dispatch never calls the provider again.
|
Merged via squash.
|
* commit '201f11afefdb19a9c75e9d3542bf7425c80df7a7': (141 commits) fix: keep catalog discovery scoped and execution lazy (#147159) fix: serialize reclamation worker shutdown with foreground writes (#147178) test(sessions): cover abrupt committed transcript recovery (#143984) fix: stop transcript storms during context overflow recovery (#147202) fix: reduce CPU overhead for small history and usage reads (#147205) fix: resume tasks after tools finish and the model times out (#147203) refactor(scripts): share SQLite reliability message waits (#146900) feat(exec): configure approval reviewer thinking and fastMode (#147192) test: remove redundant Bonjour module headers (#146981) refactor: share streaming media tail boundary update (#146989) refactor(tui): classify resume candidates once (#146983) improve: skip unused toast dismissal work (#147196) fix(linux): recover saved remote connections without replacing active sessions (#146047) fix: doctor stays silent when Windows state dir is under OneDrive (#123720) feat: announce successful Daybreak retries (#147146) feat(code-mode): reuse results across code cells (#147154) refactor(test): reuse CLI plugin fixture writer (#147186) test: skip unused compiler setup in routing fixtures (#147194) test: reuse LINE webhook runtime fixture (#146710) fix(code-mode): check automation and process result types (#147143) ...
* commit '2d87daf04b78992382299d552f15ac84a86a23ed': (1815 commits) fix(ui): distinguish tool activity with semantic icons (#147207) fix(linux): recover completed Quick Chat replies without resending (#146048) feat(desktop): unify Tauri title bar and window controls (#147097) refactor(test): share plugin fixture server shims (#147225) perf(gateway): defer worker workspace execution imports (#143496) fix(gateway): post-ack webhook work fails with "Async work scope is closed" (#144801) refactor(scripts): centralize upgrade survivor version floors (#146975) fix(ci): check publication registries before FRV fanout (#147184) fix(qa): align system-agent delegation with channel contracts (#145905) improve: reduce repeated chat message identity work (#147210) fix(channels): remove stale pre-tool previews from Slack and Telegram (#147106) fix: keep catalog discovery scoped and execution lazy (#147159) fix: serialize reclamation worker shutdown with foreground writes (#147178) test(sessions): cover abrupt committed transcript recovery (#143984) fix: stop transcript storms during context overflow recovery (#147202) fix: reduce CPU overhead for small history and usage reads (#147205) fix: resume tasks after tools finish and the model times out (#147203) refactor(scripts): share SQLite reliability message waits (#146900) feat(exec): configure approval reviewer thinking and fastMode (#147192) test: remove redundant Bonjour module headers (#146981) ...
* fix(agents): initialize transport hooks at execution boundaries Keep catalog compatibility on a narrow internal import and install the existing transport host before session dispatch or completion preparation. Direct SDK completions now apply provider stream wrappers before sending a request, with owner and cancellation checks after initialization. * build(ai): emit the model compatibility entrypoint * perf: isolate catalog workers from unused execution code Use explicit catalog plugin owners without automatic agent slots. Load Ollama payload helpers when their streams run and acquire the TypeScript compiler only when a typed module is actually compiled. * test(agents): exercise admitted compaction cancellation Cancel the manual compaction after its provider is admitted so its exact rejection remains observable. Assert that cancellation before dispatch never calls the provider again.
What Problem This Solves
Model catalog preparation can acquire agent-only plugin owners and load streaming or compilation code before any model execution. Direct prepared completions can also miss provider stream wrappers when transport setup has not already run.
User Impact
Catalog workers use their explicit provider-discovery scope, while agent sessions retain their selected memory, context-engine, and harness owners. Session and direct-completion execution initialize the provider transport hooks before dispatching requests.
Why This Change Was Made
Complete the boundary between catalog discovery and execution in the existing owners. Catalog registries avoid adopting unrelated active agent registrations. Model compatibility metadata uses a narrow internal AI entrypoint; Ollama loads its shared stream runtime when a stream is invoked, and captured TypeScript acquires the compiler when compilation is needed.
Moving transport initialization to execution includes cancellation and current-owner checks after initialization. The new internal compatibility entrypoint is included in the package exports, build map, and package checks so built artifacts preserve the same import boundary.
Evidence
Original-source controls reproduced the eager streaming import paths and the missing provider header on direct completion. The discovery-isolation controls additionally reproduced two catalog-scope failures and premature TypeScript compiler acquisition.
The import/execution cutover passed 27 focused tests and 81 related tests; four transport-host cases passed again after the fixture typing correction. The discovery-isolation suites passed 312 focused tests, with one existing opt-in Bun case skipped, plus 52 catalog-worker sibling cases. These cover registry scope and reuse, provider wrapping, cancellation, deferred compilation, metadata, secrets, and native catalog behavior.
The production changes at
5484d903passed final managed reviews, the selected changed-file gates, and a full build. The initial build exposed a missing AI build-map entry; that entry was repaired, reviewed, and verified by subsequent complete builds. The later test-only cancellation fixture correction reproduced the original CI error, then passed all 23 owner tests, formatting, diff checks, and a fresh managed review. Exact-head hosted CI supplies the remaining typecheck and lint proof for that follow-up.In one audited baseline/candidate comparison, catalog-worker heap after GC was 144.212 MiB versus 129.865 MiB (about 9.95% lower). Idle process RSS was 627.516 MiB versus 610.406 MiB in that same single-pair observation. These are single-pair, workload-specific observations; the worker inspection still found the TypeScript compiler loaded. A separate fixed-order live comparison sampled 1.123% more main-isolate allocation, so it did not demonstrate an allocation reduction. The lower worker heap and the main-isolate allocation sample are separate results.
The combined candidate also passed 12 real OpenAI turns through the normal Gateway entrypoint: ten code-mode and tool-search turns, plus two explicit managed web-search and web-fetch turns. Assistant results, same-session continuity, session listings, and exact tool-result history checks passed. All isolated runtime roots were removed and owned ports released. These were functional proof runs alongside other work; their timing and RSS are excluded from comparisons.
Supplementary Package Acceptance passed for production source
5484d903, which is unchanged by the test-only follow-up. It covered fresh build/pack, package integrity, npm 12 installation, and two upgrades from published[email protected]: custom-plugin siblings and legacy operator state. Both scenarios passed on their first attempt, including JavaScript plugin/Doctor sibling imports, ordinary mocked-provider turns before and after the update, state migration, a clean Doctor check, and an already-current second update. The survivor scenarios used manual restart mode. This run does not independently establish first TypeScript-plugin compilation, explicit prepared-completion provider headers, or catalog membership/exclusion. A separate manifest-driven AI package E2E passed after packing the qualified build and installing it into an external consumer: every declared export, including the new compatibility entrypoint, imported successfully, and runtime compatibility checks plus a strict TypeScript consumer passed.Exact-head CI passed on
d539c104: 135 successful jobs and nine skipped, including successful UI performance and the repaired Node shard. The prior run’s UI budget failure was independently reproduced: Linux builds of the exact CI base and tested merge, using Node 24.20.0, Vite 8.2.2, and Pako 3.0.1, produced byte-identical retained startup files. Both measured 355,770 bytes of startup JavaScript gzip against the unchanged 355,719-byte limit: this UI budget failure is pre-existing, with no PR startup-byte delta. No budget has been changed.The cancellation fixture now admits the provider with an active signal, cancels through the session API, and throws the same exact synthetic error. The automatic case still covers cancellation before dispatch. Both assert provider call counts, and all existing rejection-identity, aborted-event, compaction-count, and persistence assertions remain. The production cancellation guard is unchanged. No total-allocation or startup-time improvement is claimed here.
Maintainer disposition: the package/update scenarios, external AI consumer, captured-TypeScript first-execution controls, registered provider-header tests, catalog-scope tests, and live Gateway runs provide proportionate coverage of the touched contracts. They are separate proofs; no single installed-upgrade TypeScript/custom-header matrix cell is claimed. The change introduces no new persistence migration or packaged dependency.