Repository navigation
fix(gateway): skip registered agent stores no configured agent owns - #164929
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 October 4, 2026, 10:34 AM ET / 14:34 UTC (Revision 2). ClawSweeper reviewWhat this changesGateway startup skips registered databases without a configured owner or explicit configured store path, preserves deletion and registry recovery, and adds readiness regressions. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 4 items remain The correction preserves registry recovery, but the Gateway projection still excludes healthy stores containing configured agents’ descendant sessions. This useful PR remains necessary and needs a focused compatibility repair. Priority: P1 Review scores
Verification
How this fits togetherGateway startup inspects agent databases and prepares their sessions before serving requests. The session projection turns admitted physical stores into the conversation inventory used by Gateway clients. flowchart TD
A[Configured agents and store paths] --> C[Startup database selection]
B[Registered and discovered databases] --> C
C --> D[Configured store eligibility]
D --> E[Database admission and maintenance]
D --> F[Skipped store warning]
E --> G[Gateway conversation inventory]
E --> H[HTTP readiness]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +44, Tests +102. Total +146 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Exclude unrelated corrupt leftovers from readiness while retaining healthy descendant conversations through the existing store-admission and projection owners. Do we have a high-confidence way to reproduce the issue? Yes, from source: use the existing ops/codex lineage fixture through the real Gateway projection under startup admission; the new physical-owner predicate excludes the child store. This read-only review did not execute that failure. Is this the best way to solve the issue? No, the shared eligibility predicate is useful, but applying it before projection reads discards supported lineage regardless of successful registry recovery. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bb5656bf89e2. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…penclaw#164929) * fix(gateway): skip registered agent stores no configured agent owns * fix(gateway): preserve agent store registry recovery
…ent stores (#165408) chat.history and chat.startup for a session in an agent store skipped by startup admission (#164929) now return the existing non-retryable not-found refusal instead of a retryable "reload the conversation" error that clients retried forever. A row created mid-read still gets the retryable reload.
…ent stores (openclaw#165408) chat.history and chat.startup for a session in an agent store skipped by startup admission (openclaw#164929) now return the existing non-retryable not-found refusal instead of a retryable "reload the conversation" error that clients retried forever. A row created mid-read still gets the retryable reload.
Refs #164799
What Problem This Solves
A registered database left behind by an unconfigured agent can be inspected and opened during Gateway startup, causing a startup refusal or failed readiness even though configured agents can serve requests.
Why This Change Was Made
Preflight, startup-owned session projection, and startup maintenance use one configured-store predicate. Standalone session readers retain their existing behavior. Registered configured owners and explicit configured store locators remain admitted; other registered stores are skipped before runtime reads. Startup records one warning naming the database basename and Doctor guidance. Configured database inspection and Doctor/restart diagnostics retain their normal behavior.
Startup maintenance applies the skip inside its existing deletion-fenced operation, immediately before database access. Deleted-store cleanup logging runs first, and stores missing registry entries retain the existing recovery path, including durable lineage child re-registration. No reconciliation logic is duplicated.
The existing two-slot background opening bound from #164670 is preserved and covered by the HTTP fixture. No configuration, schema, dependency, worker, or cache is added.
User Impact
A corrupt unconfigured system-agent leftover no longer prevents the tested Gateway from returning
/readyz200. Its source bytes remain untouched.Deferred lineage-probe follow-up: conversations stored only under a retired physical owner with no registry/config reference are not surfaced until re-registered. This PR deliberately does not probe session lineage. Version-bound clean-close receipts still require normal admission after a version change; the reporter's multi-GB systemd deployment and packaged 9.7↔9.8 update path have not been reproduced end to end.
Reported by @Oldrich333.
Evidence
AgentDatabaseAdmissionError/file is not a database. The corrected fixture returns/readyz200, records one skip warning, preserves the corrupt bytes, and observes peak parallel opening of two configured stores after version-bound receipts are invalidated. The preflight regression covers both startup passes and keeps Doctor strict.b3e633835f5770ee05fc6e8f933bb17e5acc9093exposed three registry-recovery failures in the runtime-config job. The unchanged suite reproduced all three locally (3 failed / 11 passed, 41.27s command wall time). The early configured-owner return was the regression; it bypassed retained-deletion logging and unregistered lineage recovery.startup-migration.registry-recovery.test.ts,server-agent-database-startup.test.ts, andopenclaw-database-preflight.startup-prepared.test.tseach passed three times: 36 tests per pass. Combined command wall times: 168.78s, 151.73s, 156.94s. The HTTP regression itself took 4.19s, 4.30s, 4.13s; the lineage recovery case took 2.83s, 2.55s, 2.85s. No tests were edited for this CI repair.node scripts/check-changed.mjspassed in 582.59s, including all 27 test-type graphs, changed-file lint, dead-export scans, guards, and zero runtime import cycles. Final formatting andgit diff --checkpassed.src/agents/main-session-recovery/main-session-restart-recovery.test.tstook 188.888s for 150 cases;src/auto-reply/reply/session.test.tstook 128.337s for 105 cases. Both files are unchanged and passed. A CLI-auth case reported 38.766s including setup/cleanup; callback-only time was not measured.2ebfd7fa84495cf5c35bb9852ca96a1d431ad518; hosted CI for this new head is not claimed as passed.