Repository navigation
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: blocked before merge. Reviewed September 25, 2026, 2:20 AM ET / 06:20 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch reuses revision-checked participant display facts during SQLite transcript appends, prepares a generation query once per connection, adds regression coverage, and coordinates collector cancellation with failed-launch cleanup. Merge readiness⛔ Blocked before merge - 2 items remain Keep open. Current main contains the prerequisite and collector cancellation repair, but still lacks the measured append-path optimization. The branch has distinct value, and this review found no blocking code defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw stores transcript turns, session entries, and participants in SQLite, then publishes committed session views to Gateway readers. The subagent registry also coordinates Stop requests with cleanup of failed collector launches. flowchart LR
A[Transcript append] --> B[Session writer]
B --> C{Cache revision current}
C -->|Yes| D[Retained participants]
C -->|No| E[SQLite participant rows]
D --> F[Committed session view]
E --> F
G[Stop request] --> H[Cancellation and cleanup]
H --> F
Before merge
Agent review detailsSecurityNone. PR surfaceSource +126, Tests +122. Total +248 across 19 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep participant rows authoritative while borrowing detached display facts only at a matching SQLite revision, then publish session changes after commit. Do we have a high-confidence way to reproduce the issue? Not applicable as a correctness bug. The captured Testbox comparison measures the existing repeated reads, and current-main source still follows the uncached participant path. Is this the best way to solve the issue? Yes. Reusing the existing entry-cache owner at its native revision, with an authoritative SQLite fallback, is a narrow solution to the remaining reads. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 823f86c8a465. LabelsLabel changes: No label 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)
|
cc32bdf to
828f514
Compare
Borrow detached participant projections at the entry owner's native revision and publish transcript identity from the normalized write result. Prepare the existing generation query once per connection to keep freshness checks cheap. Synthetic warm appends: seven participant SELECTs to zero; new actors retain one projection refresh. Median CPU improves 12% with one participant and 37% with 32. No schema, configuration, or update behavior changes. Follow-up to #157582. Testbox: 92 focused tests, all changed-check stages, and independent review pass.
Move the sole entry-cache WeakMap and native-revision participant lender into a shared state module. The writer and projection keep the same state and algorithm without importing each other. Fixes the architecture and guard failures on the initial PR head. Testbox architecture checks, all 92 focused tests, complete changed-file checks, and independent review pass.
Move SessionEntryCacheDatabase unchanged to the existing entry-cache types leaf and update every importer without retaining a projection re-export. This removes the type-only cache-state -> cache-projection edge counted by Madge while preserving the participant cache owner and runtime behavior. Import OpenClawAgentDatabase from its declaring database contract so the leaf does not gain a dependency on the database runtime barrel. Baseline: check:madge-import-cycles reproduced the three-module cycle. Validation on blacksmith-testbox, profile openclaw-check, lease tbx_01m3be4cqwcx9nb4mxqzc9v541: - pnpm check:madge-import-cycles: zero cycles (41.7s). - pnpm check:import-cycles: zero runtime value cycles (12.3s). - node scripts/run-vitest.mjs: 268 passed across 19 focused files, including both participant suites (196.7s remote command). - node scripts/check-changed.mjs --base 0484d7a: passed (27m22s), including core and all 25 dependent test type graphs, lint and remaining guards. - Independent Codex review: no actionable P0-P2 findings. No runtime, schema, configuration or update behavior changes.
29b3abb to
6847e10
Compare
Queued collector startup failure could delete its provisional session before Stop published cancellation, returning a misleading session-generation error. Retain an exact-entry publication barrier in the existing retirement owner. Failed-launch cleanup waits for publication to finish, including failure, before the scheduler hold can await that cleanup. Existing generation, session, successor, FIFO and current-authority checks remain intact. Extend the existing real sessions.abort regression with a deterministic publication boundary: original code deletes the session before publication; the fix passes both exact modes and five cleanup/publication siblings. No additional Gateway boot, timers or test cases. Changed case 2.372s, file 21.11s Vitest; seven selected cases 42.998s wrapper wall. Core types, 25 changed-test type graphs, scoped lint/format and independent review pass. The unchanged local baseline did not reproduce the timing-dependent CI failure; deterministic ordering proof establishes the repaired invariant. Repairs the queued-collector failure observed in main CI36090933962. Release note: Stop reliably reports cancellation when a queued collector has not yet reached native acceptance, while preserving cleanup ownership. (cherry picked from commit d65bc76)
…4-prep * commit '8fe893da516ebdc817692fb2d272e27bc3c88376': (31 commits) fix(test): wait for reload admission before restart polling (#157964) refactor(mattermost): reuse DM retry option selection (#157800) chore(i18n): refresh native locales (#157850) perf(sessions): reuse current participants across transcript appends (#157622) refactor(signal): share pending transport migration results (#157777) fix(tui): open model pickers without waiting for the Gateway (#157839) fix(gateway): apply config despite delayed file notifications (#157906) fix(auth): clear deleted account selections and support account recovery (#157745) fix: plugin reloads lose tool results and strand subagent settlement (#157339) fix(gateway): avoid preview errors during worker metadata updates (#157943) refactor(diffs): reuse native promisify for compression (#157835) fix(models): keep current choices on the first picker page (#157869) fix(plugins): retain existing quarantine across unrelated reloads (#157907) fix(openai): prioritize ChatGPT sign-in and clarify auth choices (#157792) chore(ui): refresh control ui locales (#157955) fix(ui): refresh connected accounts after auth changes (#157950) fix(scripts): avoid redundant npm version process in package checks (#157809) refactor(usage): capture hosted pricing once per operation (#157838) refactor(ui): share slash-command failure results (#157649) fix(cron): announce runs miss the channel's formatting rules (#157877) ...
…penclaw#157622) * perf(sessions): reuse current participants across transcript appends Borrow detached participant projections at the entry owner's native revision and publish transcript identity from the normalized write result. Prepare the existing generation query once per connection to keep freshness checks cheap. Synthetic warm appends: seven participant SELECTs to zero; new actors retain one projection refresh. Median CPU improves 12% with one participant and 37% with 32. No schema, configuration, or update behavior changes. Follow-up to openclaw#157582. Testbox: 92 focused tests, all changed-check stages, and independent review pass. * perf(sessions): share participant cache state without an import cycle Move the sole entry-cache WeakMap and native-revision participant lender into a shared state module. The writer and projection keep the same state and algorithm without importing each other. Fixes the architecture and guard failures on the initial PR head. Testbox architecture checks, all 92 focused tests, complete changed-file checks, and independent review pass. * fix(sessions): break participant cache import cycle Move SessionEntryCacheDatabase unchanged to the existing entry-cache types leaf and update every importer without retaining a projection re-export. This removes the type-only cache-state -> cache-projection edge counted by Madge while preserving the participant cache owner and runtime behavior. Import OpenClawAgentDatabase from its declaring database contract so the leaf does not gain a dependency on the database runtime barrel. Baseline: check:madge-import-cycles reproduced the three-module cycle. Validation on blacksmith-testbox, profile openclaw-check, lease tbx_01m3be4cqwcx9nb4mxqzc9v541: - pnpm check:madge-import-cycles: zero cycles (41.7s). - pnpm check:import-cycles: zero runtime value cycles (12.3s). - node scripts/run-vitest.mjs: 268 passed across 19 focused files, including both participant suites (196.7s remote command). - node scripts/check-changed.mjs --base dda1f68: passed (27m22s), including core and all 25 dependent test type graphs, lint and remaining guards. - Independent Codex review: no actionable P0-P2 findings. No runtime, schema, configuration or update behavior changes. * fix(agents): publish collector cancellation before launch cleanup Queued collector startup failure could delete its provisional session before Stop published cancellation, returning a misleading session-generation error. Retain an exact-entry publication barrier in the existing retirement owner. Failed-launch cleanup waits for publication to finish, including failure, before the scheduler hold can await that cleanup. Existing generation, session, successor, FIFO and current-authority checks remain intact. Extend the existing real sessions.abort regression with a deterministic publication boundary: original code deletes the session before publication; the fix passes both exact modes and five cleanup/publication siblings. No additional Gateway boot, timers or test cases. Changed case 2.372s, file 21.11s Vitest; seven selected cases 42.998s wrapper wall. Core types, 25 changed-test type graphs, scoped lint/format and independent review pass. The unchanged local baseline did not reproduce the timing-dependent CI failure; deterministic ordering proof establishes the repaired invariant. Repairs the queued-collector failure observed in main CI36090933962. Release note: Stop reliably reports cancellation when a queued collector has not yet reached native acceptance, while preserving cleanup ownership. (cherry picked from commit f5159c6)
Related: #157582
What Problem This Solves
A transcript append that touches its session entry executes seven full participant SELECTs, repeatedly decoding the same participant list during target resolution, admission, and publication.
User Impact
Busy sessions do less SQLite and participant-decoding work. Transcript bytes, participant order, contribution updates, and publication behavior stay unchanged. There are no configuration, schema, migration, retention, or update changes.
Why This Change Was Made
Borrow detached participant display facts from the existing entry-cache owner only while its exact connection revision is current. The existing local generation and SQLite data version invalidate raw/local and foreign changes; dynamic authorization still declines cache reuse. The participant writer continues to own refresh and commit publication; it shares the same state with the projection through a small module that keeps imports acyclic. The transcript writer carries its normalized entry into identity publication instead of immediately reading it back. Compile the existing generation query once per connection so freshness checks do not replace the removed reads with repeated query compilation.
The participant optimization adds 49 net production lines, with no new result cache. Batch readers keep their existing single cohort query. The zero-read path requires a current retained entry cache; cold handles and invalidated revisions retain authoritative reads. This branch is based on the prerequisite commit
7e6bad656fd7and does not reimplement that change.Evidence
Synthetic
persistSessionTranscriptTurnappends with entry touches, measured against the prerequisite on one blacksmith-testbox, profile openclaw-check, lease tbx_01m3amf8c49y1ssqmg0vk5qy8q, Node 24.19.0 (lease workflow):Timing uses 200 warmup appends and five 100-append samples, without stack capture. Both participant counts measured 3,500 → 0 full SELECTs across the 500 measured appends. Exact-actor/capacity reads for recording a new participant remain unchanged. These are isolated synthetic measurements, not a production CPU projection.
Queued collector cancellation repair
The failing
session-utils.queued-collector-admission.test.tsis a pre-existing cancellation race, not a participant-cache regression. Earlier main CI 36090933962 failed with the identicalQueued collector session changed before cancellation publication; retry Stop.error. Main already repaired it ind65bc76d60daaa16078748bd2f2a9c090564d2ee; this branch imports that owner fix unchanged.The guard compares the Gateway projection's lifecycle generation, not
updatedAt, participant display facts, or the SQLite cache token. Aborting native admission can start provisional-session deletion after the kill releases its session fence but before it publishes the cancellation receipt. The fix retains an exact-entry publication barrier in the existing registry retirement owner. Launch cleanup waits for publication to finish, including failure, before scheduler release can join cleanup. Session replacement, live authority, FIFO, and revision checks remain intact.The existing native-admission test now controls the publication boundary and verifies cleanup ordering without weakening the Stop response assertion or adding another Gateway boot.
All comparison runs use blacksmith-testbox, profile openclaw-check, Node 24.19.0, with the repository runner
node scripts/run-vitest.mjs src/gateway/session-utils.queued-collector-admission.test.tsin 20 independent invocations per ref.6847e10ff51btbx_01m3bh8q2g845s2aj1aza4zvqr2584898818aatbx_01m3bhwg489rz2ta81hzqpxhyr17e75b2b923e, already containing the repairtbx_01m3bjcq2ejj81hqp9y9ykckcpe7944bf715fbtbx_01m3bk3cs790k3mcfj53d8kgchLease workflows: original PR, unoptimized base, and repaired main.
Every baseline failure was the reported cancellation-publication error in
exact=false. The original 13-file CI shard also passed once on the old PR (143 tests, 110.767 s remote command); that passing replay was not treated as a fix. Applying only the strengthened test to the unoptimized base failed on the intended ordering assertion:session deleteprecededpublication entered(27.445 s remote command).The first PR lease invocation stopped before Vitest because synced dependencies were absent. After remote
pnpm install --frozen-lockfile, the 20 actual test runs above completed; the setup failures are excluded from the comparison. Main's final portal-sync warning did not affect its successful test command.Fresh independent Codex review of the exact imported repair: scoped-clean, no actionable P0–P2 findings. No local tests, typechecks, or builds were run. Auto-merge was left untouched.
Final validation
Repair head:
e7944bf715fbbf1fe91d1e81dac59e677a2681a6(plain push; original perf commits preserved).All following commands passed on blacksmith-testbox, profile openclaw-check, lease tbx_01m3bk3cs790k3mcfj53d8kgch, with the physical checkout, clean source, and exact head verified before execution (lease workflow):
node scripts/run-vitest.mjs src/gateway/session-utils.queued-collector-admission.test.ts, 20 independent runspnpm test src/gateway/session-utils.queued-collector-admission.test.ts --maxWorkers=1node scripts/run-vitest.mjson the six sibling files belownode --import tsx scripts/ci-run-node-test-shard.mts, original CI group manifest and eight-worker setting, three runsSibling files:
src/agents/subagents/registry/subagent-control.publication.test.tssrc/agents/subagents/registry/subagent-registry-queued-registration.test.tssrc/agents/subagents/spawn/subagent-spawn.claim-handoff.test.tssrc/agents/subagents/spawn/subagent-spawn.context-resources.test.tssrc/gateway/session-utils.queued-collector.test.tssrc/config/sessions/session-accessor.sqlite-append-participants.test.tsThe participant-append regression still passes (0.842 s), preserving the zero-repeat-read budget and new-actor refresh behavior.
git diff --checkalso passed.Hosted CI 36101840133 completed success for this exact head, including production/test types, lint, guards, build artifacts, architecture, all selected tests, and
openclaw/ci-gate. Those completed gates supply broader validation; a duplicate Testboxcheck-changedsweep was not run.One preliminary candidate lease,
tbx_01m3bjw5ehxtw0zsmb9033s60a, rejected the hydration Git HEAD before tests: unpublished source had synced as a working-tree patch, not the new commit. Inspection verified the repair file hashes; after publishing, that lease was stopped and replaced with the exact-head lease above. No test failure was hidden or rerun as a setup failure.All five lane-owned leases are stopped. No live Gateway deployment or production Node 26 profiling was performed. Existing squash auto-merge, enabled before this repair lane on 2026-09-24 at 23:11:32Z, completed after green CI on 2026-09-25 at 06:27:59Z. Merge commit:
0e6a3175dae3854d022965701bf63a8bfb4a9765, verified on main. This repair lane issued no merge command and left auto-merge untouched.