Repository navigation
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
…/perf-micro-prepared-model-runtime-per-completion-20260919
|
@clawsweeper review Please review head |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. What this changesThis PR reduces model-catalog copying for isolated completions and preserves missing-session authorization facts across initial database registration. Example: Run 200 isolated completions selecting model-0 from a 500-model catalog.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: the changes provide measurable value, preserve the reviewed ownership boundaries, and introduce no actionable defect found in this review. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherPrepared model generations supply catalog facts and credentials to completion requests; session-fact preparation supplies current storage and authorization facts to Gateway operations. flowchart TD
A[Completion request] --> B[Captured model generation]
B --> C[Request-local credentials and selected row]
C --> D[Provider HTTP transport]
C --> E[Full inventory on demand]
F[Gateway chat request] --> G[Session fact acquisition]
G --> H[Database and row publications]
Technical reviewBest possible solution: Retain the existing registry and fact-acquisition owners, their narrow optimizations, and the preserved mutable and authorization contracts. Do we have a high-confidence way to reproduce the issue? Current-main source shows full-catalog cloning on each fork and rejection of the selected absent database’s registration; supplied regressions and benchmark results support both paths, without this review executing target code. Is this the best way to solve the issue? The patch removes unnecessary copying at the registry owner and corrects registration classification at fact acquisition while retaining existing persistence, credential, and revocation owners. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c4d8259fdf68. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +88, Tests +110, Docs +6, Other +240. Total +444 across 18 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. 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 HistoryReview history (3 earlier review cycles)Reviewed November 18, 2026, 1:45 AM ET / 06:45 UTC (Revision 4). |
Codex Review Summary: ✅ CompletedThis 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. |
|
The prior review on The exact failed suppression guard, core/scripts typechecks, targeted lint/format, and Codex delta review pass. Five final A/A/B timing rounds are complete; the PR body contains the current measurements and reuse limits for allocation/count proof. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Follow #200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean.
Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019.
|
@clawsweeper re-review Please review final head Local proof: 174 custody/provenance tests, 66 session-facts/creation-settlement tests, three complete real Gateway reload trials, and full-context Codex P0–P2 review. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review final head |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…penclaw#200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow openclaw#200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies openclaw#197510 as the first failing first-chat authorization boundary; openclaw#199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 4dca39a and attributed to openclaw#200533, openclaw#198455, and openclaw#200817. Preserve peer cleanup scope in openclaw#201019.
…200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow #200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies #197510 as the first failing first-chat authorization boundary; #199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to #200533, #198455, and #200817. Preserve peer cleanup scope in #201019. (cherry picked from commit 8610cd6) Co-authored-by: RomneyDa <[email protected]>
…penclaw#200966) * perf(agents): materialize selected rows for simple completions * style: satisfy selected completion lint checks * test: bind isolated registry measurement to concrete instances * test: align participant custody with requester ownership Follow openclaw#200952: Alice owns sessions she requests even when Bob supplies execution authority. Preserve autonomous agent ownership expectations. All 174 spawn-boundary, child-custody, and provenance tests pass; Codex scoped review is clean. * fix: retain missing-session facts across database creation Preserve first-chat authorization when catalog persistence opens the selected absent database. Keep session-row, lifecycle, routing, and source-revocation guards intact. The focused bisect identifies openclaw#197510 as the first failing first-chat authorization boundary; openclaw#199565 had repaired other cold-registration orderings. The deterministic regression is red before this fix. All 66 owning tests and three complete real Gateway reload trials pass; Codex review is clean through P2. check:changed passes every check except nine unused exports reproduced identically on exact main parent 97b03f7 and attributed to openclaw#200533, openclaw#198455, and openclaw#200817. Preserve peer cleanup scope in openclaw#201019. (cherry picked from commit 8610cd6) Release adaptation: approved 2026.11.7 models replay; see models-hook-safe-v2/REPORT.md. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
Each isolated title, summary, or side question copied the whole prepared model catalog even though it selected one model. A 500-model catalog meant 100,000 copied model rows for 200 short completions.
User Impact
Simple completions use less CPU and allocate less memory. Model selection, provider routing, host authorization, credentials, and prompt-cache identity retain their existing behavior. No configuration or migration is required.
Why This Change Was Made
ModelRegistry can now materialize only the normalized selected row from its captured generation while keeping fresh request-local AuthStorage. A different-model lookup, inventory access, or model registration promotes that local registry to its full captured catalog, preserving the already-exposed row. Agent runs, provider-stream preparation, and custom SDK resolvers retain their full mutable stores by default. No registry instances or mutable rows are shared between requests.
The production change adds 62 lines to carry selection through existing owners and preserve mutable SDK contracts. Existing runtime row materialization moves to its sibling module to respect the registry module's line cap. No new cache or configuration is introduced.
Evidence
The single-row regression fails against the base registry and passes with this change. Focused tests cover alias normalization through agent, worker, and actual isolated completion paths; two overlapping HTTP completions with distinct credentials; mutable registry isolation; and captured catalog generation replacement. All 133 focused consumer tests pass, including isolated authorization/fallback and prompt-prefix stability.
pnpm check:changedpasses on head9670e9d37e73598560f566ec28066836ff3a8c31. Another 26 selection/generation/prefix tests pass after integration. Codex autoreview is scoped-clean with no actionable P0–P2 findings, including the materializer extraction; separate Codex passes also cleared the mechanical lint corrections and the CI measurement repair.The committed synthetic workload makes 200 actual isolated completions to a loopback SSE provider with 500 catalog rows, after five warmup requests. A1/A2 load the base registry owner into the same completion pipeline; B uses the candidate owner. Five serial, counterbalanced rounds per arm; timing and GC-inclusive V8 main-isolate allocation sampling use separate processes. Acceptance: identical selections/replies, 200 copied rows, lower allocation/CPU, and no measured latency regression.
Median / p95 per 200 completions (p95 is the maximum of five samples):
Against mean A medians: registry CPU -95.5%, whole-loop CPU -18.5%, allocation -12.7% (~74.3 MB), wall time -20.7%. A/A allocation medians differ 0.6%; process CPU 3.7%. Allocation ranges: A1 584.4–610.1 MB, A2 585.0–612.8 MB, B 499.7–543.5 MB. Host load rose during allocation runs; all samples are retained and profiler-run timings are excluded from the timing results. Independent CPU profiles show inclusive fork time falling from 199.8 to 10.2 ms.
This is a synthetic catalog/isolated-request benchmark, not a full large-state Gateway benchmark. The first-five metric excludes explicit catalog refresh. No production data is used. Responses fingerprint representation is untouched; the prior incremental work is already present in #189796, #193553, and #200715.
Reproduce with Node 26 and the repository dependencies:
git show 0ca4e7d3db4b83fd82bd74f43844e25605b52b85:src/agents/sessions/model-registry.core.ts > /tmp/model-registry-base.ts node --expose-gc --import ./scripts/tsx.mjs scripts/perf/isolated-completion-registry-measure.ts --owner /tmp/model-registry-base.ts node --expose-gc --import ./scripts/tsx.mjs scripts/perf/isolated-completion-registry-measure.tsRepeat serial A1/A2/B five times; run
--allocationand--countsseparately. Timing was repeated with the final receiver-bound instrumentation. Allocation/count arms do not enable that instrumentation; their measured runtime inputs are unchanged and their existing proof is reused. The final materializer extraction is outside the measured warm fork path; final-source count proof confirms one copied row per completion.The first local check exposed two main-parent dead-export regressions, reproduced unchanged on exact parent
0ca4e7d3db4b83fd82bd74f43844e25605b52b85:describeSpawnAuthintroduced by #191324, andADVANCED_FIELDSintroduced by #200808. They were already fixed on main by #200943 (abdff0b25697f) and #200935 (e592d76967f3e). This branch incorporates main through the latter commit for that named failing gate. Patch-caused line-cap and lint errors were corrected. Those earlier failures were repaired through main integration, with no exception for them.PR CI on
9670e9d37e735exposed one patch-caused test failure: the measurement script introduced a lint suppression not on the production allowlist. The script now binds the actual registry instance and instruments its factory result, removing the suppression entirely. The receiver-independentfromCapturedSourcesfactory declaresthis: void, matching the existing static factories. The exact failed guard, core/scripts typechecks, targeted core/scripts lint, and formatting pass locally on84046ad961f2cb474e55ebc35d36fae0fedacb5f; the timing rerun asserts all 200 owner calls are observed. No test baseline or suppression allowlist was changed.Main CI repairs included in this PR
CI run 44237078089 exposed two main regressions on its exact main parent,
97b03f7428d3711fb4b5653beeac5f0a62ab8afe. Both are repaired here in separate commits rather than waived as inherited failures.The participant-custody expectations were stale after #200952 (
e235b2b983b63c4365895fd87cb8fac72cb9658d). Alice requests these spawns; choosing Bob's execution authority does not transfer ownership away from Alice. The test now expects Alice in both cases. The production ownership rule is unchanged, and autonomous agent ownership remains covered. All 174 spawn-boundary, child-custody, and provenance tests pass.The runtime reload test intermittently rejected its first chat when background catalog persistence created the initially absent agent database. The native registry publication invalidated retained missing-session facts even though no session row had changed. The session-facts acquisition now accepts the selected absent database's first registration, with matching agent and schema; actual session creation, row/lifecycle changes, unknown publications, and physical replacement keep their existing invalidation. Catalog persistence remains intact, preserving #197784's restart behavior. The small registration setup moves into the existing fact-acquisition owner to keep the preparation module within its line cap.
A local
git bisect runof the focused real-runtime test, followed by direct qualification of the earlier observed boundary, identifies2c4413a6abbfeb4ac23cd07b775a105586548af1(#197510) as the first failing commit for first-chat authorization. Its parent636454ee16af5d125bfe3c680e66bbcf371efe75admitted the warmup in three trials; those historical full tests then failed a separate later capability assertion, which is not claimed as a passing suite. The introducing commit fails during first-chat fact acquisition; the current main failure occurs when the retained facts are consumed. #199565 had already repaired other cold-registration orderings. The new deterministic owner regression fails before this repair and proves both empty-store continuity and invalidation on actual session creation.Repairs are separate commits: custody
b9e54e551ddb5, first-chat authorization617f4d97ce36eb18dc099238a365722acc824bad. On the final source, all 66 session-facts/creation-settlement tests and three complete real Gateway reload trials pass. Codex autoreview with the complete authorization/publication owners is scoped-clean through P0–P2. The repair adds 26 production lines; total production delta is 88 lines, preserving the narrow registry and authorization contracts. No configuration, schema, cache representation, or prompt-prefix identity changes.pnpm check:changed --base 97b03f7428d3711fb4b5653beeac5f0a62ab8afecompleted: all typechecks, lint, format, line caps, database guards, import-cycle checks, and remaining guards pass. Its only failure is the unused-export scan: 6 production and 7 full-tree entries, 9 distinct symbols. Running the same export owner on untouched exact parent97b03f7428d3711fb4b5653beeac5f0a62ab8afereproduces both lists identically. These are main regressions, not a passing-check claim:703c82d20c5cbff62ba3c53eb35045006c9b1d02) madeprepareSessionEventDeliverymodule-private in use while retaining its export, and introduced unusedDurablePilotCustody/DurablePilotInputexports.bd1c54cfde534824d31a4cc3c01ce3a116234549) introduced the unusedPluginMetricFamily,PluginMetricFamilyDeclaration,PluginMetricLabels, andPluginMetricsexports.14b9fc3c8d9454b89b9ff402ce31e39b75e41dfb) introducedformatDaysand madeselectSegmentedmodule-private in use while retaining its export. Peer fix(ci): register the standalone cache regression entry #201019 already owns the private cron/session-test helper cleanup; this PR does not duplicate it.Prior-head CI run 44249719486 tests head
617f4d97ce36eb18dc099238a365722acc824badin merge49cc7ff2a26d94630dc5230d2f0d04722c363609, with main parent75a31ed2854cd7c3448cb35d4b6b4b9a547ef1cb. Its build, extension-boundary, and typecheck jobs encounter a newly introduced main regression from #201017 (62a9ca09124d408b1db45a9148f7048b04338c31): six plugin types became private whilesrc/plugin-sdk/plugin-entry.tsstill re-exports them. The same six TS2724/TS2459 errors reproduce on that exact untouched main parent withnode scripts/run-tsgo.mjs --noEmit -p test/tsconfig/tsconfig.core.test.templates.json. The three source files are identical between parent and tested merge. This is a main regression requiring owner repair, not a passing check or a defect introduced by this PR. Final accounting: 39 successful jobs, 27 skipped, nine root failures plus the failed aggregate. All nine root failures contain the same six SDK errors; the automatic comparison calls them unknown because its scheduled-main run has no comparable jobs, so inheritance is established by the exact-parent reproduction and source attribution above. Hosted Codex and ClawSweeper on 617f4d9 report zero findings/open items. The prepared landing route was the authorized native inherited-failure route for this separate main regression; the two specifically requested custody/first-chat failures are fixed, not waived.Final conflict integration
Final head
99c28cbb350b8f1d6a8967bd6bd0eeb11682f179integrates mainee3f5a72fb75f26a55ac200a18839751c4cd9c3dbecause #201027 independently landed the identical custody expectation immediately before landing. The only conflict was the explanatory comment; main wording is retained and the custody helper now has no diff against main. All 18 other PR files are byte-identical to reviewed 617f4d9. All four participant cases pass again, and a fresh full-candidate Codex review is scoped-clean P0–P2. Prior performance and first-chat proof remain valid for unchanged inputs; exact-head CI and ClawSweeper were refreshed before landing. The two original repairs remain separate commits in branch history.The reconciled run 44252803204 tests merge
2661349b0ea0b3cc07b7539e1684d4be1f48ed89against exact main parentee3f5a72fb75f26a55ac200a18839751c4cd9c3d. The same six SDK errors reproduce on that parent; all nine failed build/type jobs match them. ClawSweeper reviewed99c28cbb350b8with zero findings/open items. Final accounting: 39 jobs passed, 27 skipped, nine attributed root failures plus aggregate. The automated comparison labels these new against older scheduled main08cb881bf7ed1751c6f61a9197cb13099b6add83(05:26Z, before #201017); inheritance is established by the exact-parent reproduction and identical source blobs. Extension lint is skipped downstream of the failed SDK-boundary artifact. Security and hosted review are clear. The native inherited-failure route merged this exact reviewed head as8610cd65622cd34b32f4e42b12b422734260c146.On
99c28cbb350b8,pnpm check:changed --base ee3f5a72fb75f26a55ac200a18839751c4cd9c3dcompletes with all guards, lint, and formatting passing. Its failures are the six attributed SDK type errors and 19 unused exports (3 production, 16 full-tree), whose ordered lists reproduce identically on the exact untouched parent. New main export regressions: #200987 (0ff7e2772eb15ce38f28f030c90e12fabba0c2f7) addedattestsGbrainReleasewith only local production use; #197553 (34d6c288fe1c46a369ff4171a103226b8c6059e3) replaced external consumers ofbuildMessageToolSchemaandresolveMessageToolActionSchemaActions; #198916 (ee3e16ecca7216d99547ee5acd614ced7e245fff) removed/folded the consumers of 16 retained test-helper/type exports in attempt context, terminal preparation, model fallback, and catalog-worker test support. These are additional main regressions for owner repair, not passing-check claims. No suppression or baseline exception was added.