Repository navigation
improve(gateway): reduce work when loading sessions from fixed stores - #148985
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: needs maintainer review before merge. Reviewed September 15, 2026, 3:29 PM ET / 19:29 UTC (Revision 12). ClawSweeper reviewWhat this changesThe PR skips redundant fixed-store inventory scans during Gateway session lookups while preserving ownership validation, cached discovery, and regression coverage. Merge readiness✅ Ready for maintainer review Keep open: this remains a useful performance improvement absent from current main. No actionable introduced defect remains, and the earlier session-spawn harness finding is resolved. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway resolves session keys to agent-owned SQLite stores before serving history and startup requests. Store discovery selects candidate locations, and the session accessor reads the requested rows. flowchart TD
A[History or startup request] --> B[Resolve session and agent]
B --> C[Validate store ownership]
C --> D{Uncached configured fixed store?}
D -->|Yes| E[Skip duplicate inventory scan]
D -->|No| F[Keep complete discovery]
E --> G[Read selected session rows]
F --> G
G --> H[Return session history]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +15, Tests +53. Total +68 across 5 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep the existing discovery owner and eliminate its discarded inventory work while retaining complete cached discovery and unchanged store-admission behavior. Do we have a high-confidence way to reproduce the issue? Yes, from source: an uncached configured fixed-store lookup scans inventory before discarding the duplicate target; foreign rows can increase that work. This review did not execute the workload. Is this the best way to solve the issue? Yes. The patch removes discarded work through the existing discovery owner without adding another cache, changing selected stores, or altering persisted formats. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8b4754c73279. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (11 earlier review cycles; latest 8 shown)
|
|
Merged via squash.
|
…openclaw#148985) * improve(gateway): avoid redundant fixed-store discovery * test(agents): preserve session store classifier in spawn harness
What Problem This Solves
History and startup requests can traverse many unrelated sessions when agents share a configured fixed session store.
Why This Change Was Made
The Gateway previously discovered a store that its caller already selected, then discarded that duplicate target. The existing discovery owner now excludes that target after validating ownership. This applies only to uncached configured fixed-store lookups; request-scoped caches retain complete targets for deleted-session and worker-placement lookups.
User Impact
History and startup reads avoid redundant session-store discovery. Store selection, registry errors, collision warnings, missing-store behavior, and cached discovery remain unchanged. No configuration or storage migration is required.
Evidence
45e944b51584: nine cases and 25 lookup calls per arm. Complete results, warnings, errors, and stored rows match after validating and normalizing only synthetic temporary-directory identities. Error stacks have no differences.Hosted CI 34954726529, merge revision
f6c944691d41, exposed a missing export in the session-spawn test harness caused by this PR's classifier import. The harness now forwards the real classifier from its canonical leaf module. All eight lifecycle cases reproduce the same missing-export error with the published harness and pass with the repair; assertions, case order, and deadlines are unchanged. Targeted formatting, lint, and the canonical agents-root test type graph pass. Fresh independent review of the repair found no actionable P0-P2 findings.Hosted CI 34959628169 on repaired head
ee3ef5d23f3dremains a recorded failure. Its runtime-auth fixture failures are covered by merged #149004; the UI setup expectations by merged #149023; and the Copilot fixture cleanup and canonical credential metadata by merged #149016 and #149038. Main80936b0933a1contains these repairs. Complete retained logs attribute the failures to the historical CI base, outside this five-file diff. The fresh hosted review resolves the harness finding and reports no actionable findings. Headfb3658ce8995now integrates repaired main80936b0933a1. Its complete five-file binary diff and all original/candidate file snapshots are unchanged. Fresh CI 34965682831 then exposed six thinking-route tests whose runtime auth-store fixture was incomplete (2,034 passed and six failed in that shard). The failing test and runtime/model owners are unchanged by this PR. Merged #149049 supplies the existing fixture store through its runtime reader without changing the cases or assertions. Headee1012b5dd3dnow integrates mained264cc3ca59; all five changed files and the complete patch remain unchanged. The subsequent exact-head failure is recorded below; that historical run did not satisfy native gates. Historical failures remain recorded; no test retry or timeout adjustment was used.A source comparison with main
140ae96507aconfirmed the four original files were unchanged and found no conflict with its newer committed-read lifecycle. Local tests and work counts remain evidence from the recorded base; they do not assert identical counts or latency on later main revisions.Exact-head CI 34969565592 failed one plugin-inspection case (1,384 passed, one failed, six skipped in that shard). Existing diagnostics show that the written config matched the fixture and the initial snapshot was valid, then config observation rejected with
STATE_DATABASE_READ_ADMISSION_INVALIDATEDand returned a read-failed fallback. The test, command, and named observation owners are unchanged by this PR. Canonical repair #148839 landed as1bbc39f1b988. Previous head59d706b95a30normally integrates repaired main22a07e0abe7f, which also includes the child-evidence fixture repair #149243. The complete PR patch remains equivalent. Four complete original/candidate file pairs are unchanged; the cursor suite also incorporates the existing asynchronous database teardown from #148972. Fresh CI 34995632936 failed in native PR-tooling and Codex fixtures, detailed below. Historical failures remain failed evidence; no duplicate repair, CI rerun, or timeout adjustment was used.That run failed 34 cases across the native main-refresh, cross-checkout, hosted-merge and Crabbox-authorization fixture suites because their GitHub mocks reject the repository metadata request introduced by #149230. A separate Codex model-attribution case failed background-terminal cleanup with
TypeError: data is not iterable. The exact CI merge tree matches this PR, and all those owners/tests are unchanged by the fixed-store patch. The canonical repair owners investigated these failures; no duplicate fix, retry or deadline change was made here. That historical run did not satisfy native gates; the repairs and current-head check result are recorded below.Current head
b047bd1deebdintegrates main273b6c5e11462, containing the merged native fixture repair #149294 and Codex model-attribution fixture repair #149301. Every complete original/candidate file pair and the complete binary PR patch are byte-identical to the preceding reviewed integration. Existing source review remains applicable; prior runtime evidence retains its recorded base. Exact-head CI35006860947 passed onb047bd1deebd; native gates remain required before landing. Historical failures remain recorded; no CI retry or deadline/assertion change was made in this PR.