Repository navigation
perf(gateway): skip empty session reconciliation - #117589
Conversation
0dd5a53 to
937393e
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 3:45 PM ET / 19:45 UTC. ClawSweeper reviewWhat this changesThe branch adds a post-import filesystem check so gateway startup reconciles transcript projections only for configured agents whose canonical SQLite session database exists, with regression coverage for absent, existing, and import-created databases. Merge readinessKeep open for normal maintainer landing. Current Priority: P2 Review scores
Verification
How this fits togetherGateway startup performs session maintenance before serving requests: it imports any legacy session store, then repairs SQLite transcript projections. The projection repair currently opens each configured agent database, so filtering absent databases prevents unused agents from gaining empty persistent state during startup. flowchart LR
A[Configured agents] --> B[Legacy session import]
B --> C[Canonical agent SQLite path]
C --> D{Database exists?}
D -- Yes --> E[Reconcile transcript projections]
D -- No --> F[Skip empty database creation]
E --> G[Gateway begins serving]
F --> G
Decision needed
Why: The patch is source-consistent and the author is a repository MEMBER, but the protected Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +23, Tests +111. Total +134 across 2 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the post-import existence filter as the canonical startup behavior and land it after the session-persistence owner confirms the exact merge result; existing and import-created databases must continue through projection reconciliation. Do we have a high-confidence way to reproduce the issue? Yes — source establishes that current main reconciles every configured agent, and reconciliation opens and schema-registers its SQLite database. The branch's focused tests and supplied temp-state measurements cover the absent, existing, and import-created database cases, although this read-only review did not execute them. Is this the best way to solve the issue? Yes — the filter sits after the legacy-import owner and before the database-opening reconciliation owner, so it removes the unnecessary producer-side work without adding runtime fallback behavior or changing schema/config contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 26aa884c6914. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Resolved the exact-head ClawSweeper finding on
This resolves the P2 changelog finding, its derived merge risk, and the matching rank-up move. @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final exact-head landing proof is complete for
This resolves the durable review's current-main merge-risk and maintainer-decision items. @clawsweeper re-review |
|
Merged via squash.
|
* commit '81e392b7ff43bcdb7a3be50a99adf65c3b0141b5': fix(channels): preserve filters in offline status diagnostics (#117570) perf(gateway): separate startup maintenance timing (#117577) refactor(tests): deduplicate database-first guard fixtures (#117594) fix(cli): align sessions cleanup label summary by visible width (#117459) perf(gateway): skip empty session reconciliation (#117589)
* commit '81e392b7ff43bcdb7a3be50a99adf65c3b0141b5': fix(channels): preserve filters in offline status diagnostics (#117570) perf(gateway): separate startup maintenance timing (#117577) refactor(tests): deduplicate database-first guard fixtures (#117594) fix(cli): align sessions cleanup label summary by visible width (#117459) perf(gateway): skip empty session reconciliation (#117589) refactor(ui): consolidate cron form control rendering (#117576) fix(memory): recover restored session freshness (#117548) fix(ui): preserve Talk transcript surrogate bounds fix(ui): harden Talk transcript marker bounds test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text
* commit '81e392b7ff43bcdb7a3be50a99adf65c3b0141b5': fix(channels): preserve filters in offline status diagnostics (#117570) perf(gateway): separate startup maintenance timing (#117577) refactor(tests): deduplicate database-first guard fixtures (#117594) fix(cli): align sessions cleanup label summary by visible width (#117459) perf(gateway): skip empty session reconciliation (#117589)
* perf(gateway): skip empty session reconciliation * chore(release): remove branch-local changelog entry
* commit '58213dd5389737ff100c6286d110921defeb76e8': fix(channels): preserve filters in offline status diagnostics (openclaw#117570) perf(gateway): separate startup maintenance timing (openclaw#117577) refactor(tests): deduplicate database-first guard fixtures (openclaw#117594) fix(cli): align sessions cleanup label summary by visible width (openclaw#117459) perf(gateway): skip empty session reconciliation (openclaw#117589)
* origin/main: perf(gateway): separate startup maintenance timing (openclaw#117577) refactor(tests): deduplicate database-first guard fixtures (openclaw#117594) fix(cli): align sessions cleanup label summary by visible width (openclaw#117459) perf(gateway): skip empty session reconciliation (openclaw#117589)
* commit '58213dd5389737ff100c6286d110921defeb76e8': fix(channels): preserve filters in offline status diagnostics (openclaw#117570) perf(gateway): separate startup maintenance timing (openclaw#117577) refactor(tests): deduplicate database-first guard fixtures (openclaw#117594) fix(cli): align sessions cleanup label summary by visible width (openclaw#117459) perf(gateway): skip empty session reconciliation (openclaw#117589)
* commit '58213dd5389737ff100c6286d110921defeb76e8': fix(channels): preserve filters in offline status diagnostics (openclaw#117570) perf(gateway): separate startup maintenance timing (openclaw#117577) refactor(tests): deduplicate database-first guard fixtures (openclaw#117594) fix(cli): align sessions cleanup label summary by visible width (openclaw#117459) perf(gateway): skip empty session reconciliation (openclaw#117589) refactor(ui): consolidate cron form control rendering (openclaw#117576) fix(memory): recover restored session freshness (openclaw#117548) fix(ui): preserve Talk transcript surrogate bounds fix(ui): harden Talk transcript marker bounds test(ui): cover bounded realtime Talk entries fix(ui): bound realtime Talk conversation text
Related: #117577
What Problem This Solves
Fixes an issue where gateways with configured agents that had no session state would create and schema-register an empty SQLite database for every agent during startup transcript reconciliation.
Why This Change Was Made
Startup now checks each configured agent's canonical SQLite path after the legacy import step and reconciles transcript projections only when that database exists. Request-time reconciliation and reconciliation for existing or newly imported databases remain unchanged.
User Impact
Gateways with many configured but unused agents start faster and no longer create empty per-agent databases solely because the gateway started.
Evidence
main, 1 agent: 123-139 ms, 1 reconcile call, 1 database createdmain, 12 agents: 424-433 ms, 12 reconcile calls, 12 databases creatednode scripts/run-vitest.mjs src/gateway/server-startup-session-migration.test.tsoxfmt,oxlint, andgit diff --checkpassed.packages/terminal-core/src/ansi.ts; the touched files pass direct targeted lint.