Repository navigation
fix(codex): avoid repeated session catalog timeout waits - #149378
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 15, 2026, 6:59 PM ET / 22:59 UTC (Revision 3). ClawSweeper reviewWhat this changesAdds bounded retry backoff for repeatedly failing local Codex session catalogs while preserving shared pending reads and cached pages. Merge readiness⛔ Blocked before merge - 3 items remain This remains useful, distinct work, but the previously reported malformed-response cursor case is still unfixed. The related catalog repairs do not supersede it. Priority: P2 Review scores
Verification
How this fits togetherThe Codex plugin supplies native session listings to OpenClaw’s session catalog. Its local control layer reads App Server pages and returns cached sessions or host errors to callers. flowchart TD
A[Session catalog refresh] --> B[Local Codex page cache]
B -->|Cached or pending page| F[Sessions or host error]
B -->|New page attempt| C[Source backoff check]
C -->|Retry allowed| D[Codex App Server]
C -->|Backoff active| F
D --> E[Validate page and update source health]
E --> F
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +91, Tests +201, Docs +15. Total +307 across 6 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep source health beside the existing page owner, count malformed upstream pages as source failures, and preserve caller-validation exemptions and cached-page delivery. Do we have a high-confidence way to reproduce the issue? Yes, from source: repeatedly return an oversized nextCursor or backwardsCursor to a valid local list request; each response fails validation without advancing backoff. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? The owner placement and bounded retry strategy are appropriate, but the blanket caller-error exemption also excludes upstream response failures and needs correction. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 66d85ddf5397. LabelsLabel 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 (2 earlier review cycles)
|
|
Source review of
The config/agent/home partitioning, cached/pending precedence, and late-failure generation fence look coherent. The separate completed-node scheduling repair in #149396 tracks node publication lifetimes; it does not replace this local-source backoff work. |
2beda62 to
100c5fe
Compare
Back off repeatedly failing catalog sources so newly admitted callers do not restart the same timeout on every page. Keep retry health in a typed sibling module while the control owner retains page sharing and stale delivery. Preserve one immediate retry, bound recovery delays to 60 seconds, and keep older overlapping failures from undoing a successful recovery.
100c5fe to
0fc8ede
Compare
|
Merged via squash.
|
…9378) Back off repeatedly failing catalog sources so newly admitted callers do not restart the same timeout on every page. Keep retry health in a typed sibling module while the control owner retains page sharing and stale delivery. Preserve one immediate retry, bound recovery delays to 60 seconds, and keep older overlapping failures from undoing a successful recovery.
Related: #149030, #148631, #148639, #148984.
What Problem This Solves
Fixes repeated catalog timeout waits when a local Codex source keeps failing. On team.openclaw.ai (2026-09-15, serving
7bdca7d8d1b), 370sessions.catalog.listcalls across 18 connections had p50 90,263 ms, p90 216,506 ms, and max 410,415 ms. One sampled call waited 146,596 ms for admission and then spent 65,669 ms in its single admitted step.User Impact
After two source failures, later catalog refreshes reuse the failure during bounded backoff instead of repeatedly waiting for the same source timeout. Failed cold hosts remain present with their existing unavailable/error state; healthy sources and previously cached pages remain available. The first failure and its immediate recovery retry retain their existing timeout budgets; backoff applies after repeated failure. Recovery can then be deferred by up to 60 seconds, plus the caller's refresh interval. Slow successful scans and unrelated providers can still occupy admission slots.
Why This Change Was Made
The Gateway already shares identical lists within each connection's authority partition, and Codex already shares pending native pages across matching source/query scopes. The missing behavior was failure reuse: settling a failed cold page immediately removed the pending producer, allowing the next admitted wave to retry it. Keep that ownership and result sharing intact, allow one immediate recovery retry, then back off 5/10/20/40/60 seconds per runtime config, agent, and source home. Only one recovery probe runs per source; successful recovery creates a fresh source-state generation so older overlapping failures cannot reopen the outage. Invalid-request errors do not trip host backoff.
The source-health state machine is extracted into the private, typed
session-catalog-source-backoff.tssibling;session-catalog-control.tsremains its consumer and owns page sharing and delivery. This keeps the control file within its unchanged 700-line lint limit. Gateway FIFO admission, caller visibility, native pending-request custody, late host publication, and diagnostic fields keep their existing contracts.hostCountsCompletestill means every returned host was counted, not that discovery succeeded. No protocol, configuration, or persistent-state changes.The sample does not prove which host consumed 66 seconds. A local control timeout is consistent with its disconnected error host and the 60-second default; paired-node foreground listing is already bounded to eight seconds. Correlated phase logs are still needed to confirm the production bottleneck, and this change has not been deployed to the Team Gateway.
Evidence
node scripts/run-vitest.mjs src/gateway/server.catalog-startup.test.ts src/gateway/server-methods/session-catalog*.test.ts extensions/codex/src/session-catalog*.test.ts: 34 files, 416 tests passed (178 Gateway, 238 Codex).node scripts/check-changed.mjs: passed fully, including production/test types, lint, unchanged line limits and ratchets, dependency/boundary guards, and import cycles.pnpm check:docs: passed, including 1,309 MDX files, 13,910 internal links (zero broken), and 1,241 validated config examples.git diff --checkpassed.