Repository navigation
perf(gateway): skip empty session recovery stores - #117498
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 1:21 PM ET / 17:21 UTC. ClawSweeper reviewWhat this changesThe PR adds a read-only session-status probe so gateway restart recovery skips agent databases that contain no running durable session. Merge readinessThis focused optimization appears correct: it avoids writable recovery work for agent SQLite stores with no running durable session while preserving the existing writer path for missing, unknown, or unreadable stores. Keep it open for the assigned human maintainer review because it intentionally changes restart-recovery eligibility for persisted session state. Priority: P2 Review scores
Verification
How this fits togetherGateway startup scans configured and discovered agent session stores, then marks interrupted running sessions for recovery. This change inserts a read-only status check before the session writer path so unrelated agent-database state does not trigger recovery initialization. flowchart LR
A[Gateway restart] --> B[Discover agent session stores]
B --> C[Read-only session status probe]
C -->|running row found| D[Recovery writer path]
C -->|database missing or no running row| E[Skip store]
C -->|unknown or unreadable schema| D
D --> F[Mark interrupted session for recovery]
Decision needed
Why: The implementation is mechanically sound and covered, but it deliberately changes the recovery boundary for durable session state; accepting that behavioral contract is an owner decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +40, Tests +96. Total +136 across 7 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the single read-only probe and its conservative unknown-schema fallback, then land it once the recovery-path owner accepts the stored-session eligibility change. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main sends every discovered/configured store into startup recovery, while the branch's focused tests exercise missing stores, inactive stores, and stores with running rows. I did not execute the tests because this review checkout is read-only. Is this the best way to solve the issue? Yes: reusing the existing read-only agent-database contract at the recovery eligibility boundary is narrower and safer than opening every store writable or adding a second discovery mechanism. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 8b994fc9e170. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
dfb7f85 to
3890fea
Compare
3361c75 to
140dae6
Compare
|
Maintainer decision:
This resolves the remaining ClawSweeper owner-decision item on head |
|
Land-ready verification for head
This satisfies the remaining exact-head ClawSweeper |
|
Merged via squash.
|
* origin/main: (26 commits) fix(update): return failure when dirty checkout blocks update (#117452) fix(auto-reply): apply mixed chat directives in one session transaction (#117542) refactor(ui): unify channel status and setup controls (#117499) fix(doctor): preserve surviving lint selections (#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (#112464) refactor(channels): consolidate lightweight plugin discovery (#117541) fix(imessage): prevent duplicate messages after delayed sends (#110853) refactor(memory): unify authoritative dreaming state and presentation (#117538) refactor(agents): consolidate main-session recovery ownership (#117383) fix(proxy-capture): make path-based session cleanup atomic (#98852) refactor(agents): consolidate compaction and context-engine ownership (#117482) fix(gateway): preserve Responses usage details (#117533) perf(gateway): skip empty session recovery stores (#117498) fix(ci): update canonical Kova performance pin (#117508) fix(system-agent): emit the wizard cancel hint once per message (#113731) refactor: dedupe secrets runtime snapshot fixtures (#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (#117493) ...
* origin/main: (35 commits) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (openclaw#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (openclaw#117493) ...
* origin/main: (491 commits) feat(gateway): advertise chat attachment limits on hello-ok (#116188) fix(ui): preserve full graphemes in session owner initials (#117350) refactor(tui): consolidate runtime ownership (#117368) fix(update): return failure when dirty checkout blocks update (#117452) fix(auto-reply): apply mixed chat directives in one session transaction (#117542) refactor(ui): unify channel status and setup controls (#117499) fix(doctor): preserve surviving lint selections (#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (#112464) refactor(channels): consolidate lightweight plugin discovery (#117541) fix(imessage): prevent duplicate messages after delayed sends (#110853) refactor(memory): unify authoritative dreaming state and presentation (#117538) refactor(agents): consolidate main-session recovery ownership (#117383) fix(proxy-capture): make path-based session cleanup atomic (#98852) refactor(agents): consolidate compaction and context-engine ownership (#117482) fix(gateway): preserve Responses usage details (#117533) perf(gateway): skip empty session recovery stores (#117498) fix(ci): update canonical Kova performance pin (#117508) fix(system-agent): emit the wizard cancel hint once per message (#113731) refactor: dedupe secrets runtime snapshot fixtures (#117502) test(google): cover ready callback close precedence ...
* perf(gateway): skip inactive session recovery stores * chore: leave release notes to release workflow
* origin/main: (26 commits) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (openclaw#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (openclaw#117493) ...
* origin/main: (35 commits) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence test(openai): dedupe realtime voice fixtures (openclaw#117503) fix(google): flush lazy prompts on provider readiness fix(gateway): keep canonical hooks on pristine startup path (openclaw#117493) ...
* origin/main: (491 commits) feat(gateway): advertise chat attachment limits on hello-ok (openclaw#116188) fix(ui): preserve full graphemes in session owner initials (openclaw#117350) refactor(tui): consolidate runtime ownership (openclaw#117368) fix(update): return failure when dirty checkout blocks update (openclaw#117452) fix(auto-reply): apply mixed chat directives in one session transaction (openclaw#117542) refactor(ui): unify channel status and setup controls (openclaw#117499) fix(doctor): preserve surviving lint selections (openclaw#117543) fix(media): keep an unquoted MEDIA path with spaces as one media item (openclaw#112464) refactor(channels): consolidate lightweight plugin discovery (openclaw#117541) fix(imessage): prevent duplicate messages after delayed sends (openclaw#110853) refactor(memory): unify authoritative dreaming state and presentation (openclaw#117538) refactor(agents): consolidate main-session recovery ownership (openclaw#117383) fix(proxy-capture): make path-based session cleanup atomic (openclaw#98852) refactor(agents): consolidate compaction and context-engine ownership (openclaw#117482) fix(gateway): preserve Responses usage details (openclaw#117533) perf(gateway): skip empty session recovery stores (openclaw#117498) fix(ci): update canonical Kova performance pin (openclaw#117508) fix(system-agent): emit the wizard cancel hint once per message (openclaw#113731) refactor: dedupe secrets runtime snapshot fixtures (openclaw#117502) test(google): cover ready callback close precedence ...
What Problem This Solves
Gateways with many configured agents can have per-agent SQLite databases before any durable session exists because unrelated auth or model-catalog state uses the same database. Restart recovery was opening the session writer path for every such store even when it had no interrupted run.
Kova exposed this on the 12-agent prepared-runtime fixture:
sidecars.main-session-recoverytook about 1.3 seconds on a fresh fixture.Why This Change Was Made
The first implementation only checked whether the database file existed. Exact-head Kova disproved that approach: the databases already existed, so startup time was unchanged.
The corrected implementation adds a generic read-only indexed status probe and enters the recovery writer lane only for stores proven to contain
runningsession rows. Missing databases return false without being created. Existing databases with an unknown or unreadable schema remain eligible for the writer path so diagnostics and compatibility behavior stay visible.User Impact
Fresh multi-agent gateways avoid unnecessary recovery writer initialization for databases that contain only unrelated state. Interrupted durable sessions continue to recover normally, and unknown or corrupt durable stores retain the existing diagnostic path.
Evidence
3361c7550266396befd56d551aad052d479e622f.3890fea5705ca20538600ed9205b7f11d7ae3338; the only later change removes the release-ownedCHANGELOG.mdentry requested by ClawSweeper.main(877843422ec61bc3e9b9510a79e9362c4f4fc051):75da17442a493a58b27fc26abd57aae8162932e6.sidecars.main-session-recoverymeasured about2.8-3.4msacross the recorded release scenarios, with no span errors.oxfmt, directoxlint,git diff --check, and autoreview passed.