Repository navigation
fix: stop idle Codex catalogs from re-listing native history - #157565
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 26, 2026, 2:36 AM ET / 06:36 UTC (Revision 6). ClawSweeper reviewWhat this changesThe Codex plugin defers full native session-history walks until a resident catalog read after the safety interval, while retaining scheduled local file scans and activity checks. Regression provenancePossible regression — suspected (failure trace). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main and v2026.9.6 still start full native history walks on the idle timer. The patch has focused real app-server proof and no actionable finding. The catalog owner explicitly accepted delayed discovery of silent changes. Priority: P1 Review scores
Verification
How this fits togetherThe Codex plugin builds a resident session catalog from app-server history, notifications, and local session files. Catalog reads return cached rows and can start a background walk that updates later reads. flowchart LR
A[Codex app-server history] --> B[Resident catalog]
C[Activity notifications] --> B
D[Local session files] --> E[Scheduled file scan]
E --> B
F[Catalog read] --> G{Full walk due?}
G -->|Yes| H[Background native walk]
H --> B
B --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +43, Tests +201, Docs -1. Total +243 across 11 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Retain demand-triggered full walks, independent local file scans, and the documented delayed-discovery behavior accepted by the catalog owner. Do we have a high-confidence way to reproduce the issue? Yes. Current main's timer starts a full native walk after 15 minutes, and the linked report records repeated native paging on a large history. This read-only review did not execute the current-main failure. Is this the best way to solve the issue? Yes. Starting the full walk on catalog demand removes idle paging while preserving activity checks and independent file scans; the freshness tradeoff has explicit owner acceptance. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 97d7de501fe8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
3f0f96a to
9329688
Compare
9329688 to
9c72d7c
Compare
|
Owner decision (Peter, maintainer): accepted. The idle-freshness tradeoff ClawSweeper flagged is intended — an idle Gateway must not re-list the whole native Codex thread history every 15 minutes for nobody; new threads still surface through |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
) (#158770) Stop full Codex native-history safety walks on idle Gateways. The resident catalog starts a due background walk on catalog demand, returns cached rows promptly, and keeps local file scans independently scheduled. Failed walks wait for the next interval and demand. Silent native changes can remain undiscovered while the catalog is unread. Peter accepted this documented freshness tradeoff: #157565 (comment) Related: #157460. Thanks @PollyBot13 for the fix. Validation: exact-head hosted CI; focused catalog regressions; pinned real Codex app-server proof with zero additional native pages during virtual idle and two database-only pages after demand. Production +55/-12 lines; tests +208/-7; docs +12/-13. No live Gateway CPU percentage is claimed. (cherry picked from commit a46c097) Co-authored-by: PollyBot13 <[email protected]>
Merge the already-landed release/2026.9.7 history at 7bd08b5 into the reviewed prepared branch without re-cherry-picking external sources. Preserve canonical native admission, companion namespaces, exact-generation fingerprints, worker publication and atomic index ownership alongside the parent's legacy census, cleanup and live lease repairs. Resolve four conflicts and retain both test inventories. A damaged native instance is not tokenless legacy scratch: keep its published payload when the coordinator disappears. Add the existing Doctor journal-history helper to the extracted-wrapper manifest; no database source changes. Canonical provenance remains in the merged history: - #158770 / source #157565 (PollyBot13, landed by Peter Steinberger) - #158808 / source #158323 (Peter Steinberger) - #158910 / sources #158414 and #158769 (Peter Steinberger) Verified 1,019 exact-parent, 82 exact-canonical and nine combined postimages. Two composition regressions reproduced and corrected. 157 focused owner cases and two wrapper closure checks pass, as do production/test types, lint, formatting and all frozen eb377ac ratchets. Full build passed in 262 seconds. Independent P0-P2 review completed all three passes clean. Compilation is not installed-driver qualification. Normal built integration preflight still refused runtime-artifact-publication/systemd-competing-managers. The separate coupled database backport and its bound fixture hunk remain unapplied. Version and dependencies are unchanged; public size-policy hold remains active. Implementation and verification: https://team.openclaw.ai/chat/roboclaw/subagent/69c28824-7ae8-4692-9037-6998b58bc7f4 Discussion, review and integration: https://team.openclaw.ai/chat/roboclaw/dashboard/db4d78ac-b19b-4f64-adfb-0ca7973a62e4 Co-authored-by: RomneyDa <[email protected]> Co-authored-by: vyctorbrzezowski <[email protected]> Co-authored-by: steipete <[email protected]> Co-authored-by: jalehman <[email protected]>
…claw#157565) Stop full Codex native-history safety walks on idle Gateways. The resident catalog starts a due background walk on catalog demand, returns cached rows promptly, and keeps local file scans independently scheduled. Failed walks wait for the next interval and demand. Silent native changes can remain undiscovered while the catalog is unread. Peter accepted this documented freshness tradeoff: openclaw#157565 (comment) Related: openclaw#157460. Thanks @PollyBot13 for the fix. Validation: exact-head hosted CI; focused catalog regressions; pinned real Codex app-server proof with zero additional native pages during virtual idle and two database-only pages after demand. Production +55/-12 lines; tests +208/-7; docs +12/-13. No live Gateway CPU percentage is claimed. Co-authored-by: PollyBot13 <[email protected]>
Related: #157460
What Problem This Solves
Fixes sustained Gateway CPU work when an enabled Codex session catalog sits idle with a large native thread history. The catalog was re-listing the entire history every 15 minutes even when nobody requested it.
User Impact
Idle Gateways no longer perform full native catalog walks solely because the safety timer elapsed. The first catalog read after the 15-minute interval returns cached rows promptly and starts a full background walk; silent external metadata or membership changes become visible after that walk completes. If no one reads the catalog, those silent changes remain undiscovered until a later read. Native activity notifications and local file safety scans keep their existing paths.
Why This Change Was Made
The resident catalog now owns the full-walk trigger at list demand. The periodic timer still handles local file safety scans and event-driven incremental native checks, but it no longer starts a full native walk while idle. Due walks are coalesced, do not hold the list request deadline, and a failed walk waits until another 15-minute safety interval plus demand before retrying, avoiding retries on every busy reader. This chooses lower idle load over a fixed bound for silent native changes when the catalog is unused; Peter accepted that freshness tradeoff in the owner decision linked below.
Evidence
de530816b0f: the 20,001-thread fixture fails at the 15-minute idle point because an extra native page request has already started (314 versus 313 expected).pnpm exec vitest run extensions/codex/src/session-catalog-native.test.tspassed both real-native tests. This is an app-server boundary proof, not a live Gateway CPU measurement.pnpm checkpasses on the latest source, including types, lint, formatting, and policy guards.pnpm buildpasses on the same source in 5m 15.9s; a no-overlap rebase onto current main followed, with no patch changes.9c72d7c19831eeaed2a3ffdfdb3fa41760229553. The optional full 415-file Codex extension sweep was started but not completed; its first 24-file batch passed 402 tests before the lane was stopped to serialize the build.AI-assisted: yes. Implementation and tests were developed with an AI coding agent and reviewed against the linked bug, live source, and focused test evidence.
Maintainer disposition
The owner decision accepts demand-driven discovery of silent native changes. The unread catalog can remain stale until a resident read starts and completes the background walk; native activity notifications and independent local file scans remain intact.
ClawSweeper's exact-head before-merge items are resolved as follows:
The campaign review of this unchanged patch is scoped-clean, with no actionable P0/P1 findings. Production delta: +55/-12 lines; tests: +208/-7; docs: +12/-13. Thanks @PollyBot13 for the fix.