Skip to content

fix: stop idle Codex catalogs from re-listing native history - #157565

Merged
steipete merged 1 commit into
openclaw:mainfrom
PollyBot13:pollybot/fix-157460-catalog-idle
Sep 26, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
PollyBot13:pollybot/fix-157460-catalog-idle

Conversation

@PollyBot13

@PollyBot13 PollyBot13 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Pre-fix regression at 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).
  • Fixed candidate: 73 tests across eight Codex catalog suites passed on the first review repair (18.95 s wall), including a 20,001-thread idle/demand walk, blocked-walk responsive listing, missed-change recovery, and failed-walk cooldown. After the subsequent local-file scheduling repair, its five directly affected suites passed 38/38 (16.57 s wall), including the blocked-walk file-scan and queued-activity regression. These focused tests are a small fraction of the full extension lane.
  • A real pinned Codex app-server 0.155.1 ran with 128 synthetic threads in a private, network-blocked home: initial hydration made 2 native page RPCs; 15 minutes of virtual idle made 0 more; a resident read returned cached rows and then completed 2 database-only native pages. pnpm exec vitest run extensions/codex/src/session-catalog-native.test.ts passed both real-native tests. This is an app-server boundary proof, not a live Gateway CPU measurement.
  • The current repair also verifies that a due overflow/native-backed list issues only its own native page instead of a redundant full walk.
  • pnpm check passes on the latest source, including types, lint, formatting, and policy guards. pnpm build passes on the same source in 5m 15.9s; a no-overlap rebase onto current main followed, with no patch changes.
  • ClawSweeper reviewed the second head and accepted the real app-server proof, then found that a demand-triggered native walk could postpone local file safety scans. This revision separates their scheduling and tests an overlapping blocked walk. The previous-head CI failed seven adjacent tests that assumed timer-triggered full walks; all seven are aligned with demand-driven behavior and pass locally. The exact-head ClawSweeper review reports no actionable code findings; the campaign verified green exact-head CI on 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.
  • Local runtime CPU on a comparable 10k-thread Gateway was not measured; the proof is the native request behavior and source-level regression, not a claimed CPU percentage.

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:

  • Resolve merge risk (P1): accepted by Peter in the linked owner decision; the freshness tradeoff is documented in the PR and Codex harness guide.
  • Obtain explicit catalog-owner acceptance (P2): satisfied by that owner decision.
  • Resolve maintainer decision: satisfied by that same explicit acceptance; no code change is required.

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.

@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: S labels Sep 24, 2026
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 24, 2026
@clawsweeper

clawsweeper Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 26, 2026, 2:36 AM ET / 06:36 UTC (Revision 6).

ClawSweeper review

What this changes

The 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 provenance

Possible 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
Reviewed head: 9c72d7c19831eeaed2a3ffdfdb3fa41760229553

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Focused native-boundary proof and regression coverage support a sound repair with an explicitly accepted freshness tradeoff.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The changed catalog control used a real pinned Codex app-server with 128 synthetic threads: virtual idle added no native pages, and a resident read returned cached rows before two database-only pages completed. This proves native request behavior, while Gateway CPU reduction remains unmeasured. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The changed catalog control used a real pinned Codex app-server with 128 synthetic threads: virtual idle added no native pages, and a resident read returned cached rows before two database-only pages completed. This proves native request behavior, while Gateway CPU reduction remains unmeasured. No stored-data contract changes.
Evidence reviewed 8 items Introduced scheduling change: The branch makes full native reconciliation demand-driven and leaves file scans on the timer.
Production read path: A cached resident page starts the due background walk; native-backed overflow requests use their own page path.
Current-main and release check: The fetched main and v2026.9.6 have identical catalog currency code that starts a full native walk when the idle timer reaches its deadline.
Findings None None.
Security None None.

How this fits together

The 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
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +43, Tests +201, Docs -1. Total +243 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 2 55 12 +43
Tests 8 208 7 +201
Docs 1 12 13 -1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 11 275 32 +243

Review metrics

Metric Value Why it matters
Production and test growth production +43 net lines; tests +201 net lines The production growth separates native demand scheduling from file scans; the tests cover idle behavior, recovery, and overlap.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #157460
Summary: This PR is the candidate fix for the linked large-history idle catalog regression.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P1: The linked report describes sustained Gateway CPU use from repeated native history paging on v2026.9.6.
  • merge-risk: 🚨 compatibility: Existing installations discover silent native metadata changes only after catalog demand; the catalog owner explicitly accepted that tradeoff.
  • merge-risk: 🚨 session-state: Cached session rows can remain stale while the catalog is unread; the accepted design reconciles them after the next resident read.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The changed catalog control used a real pinned Codex app-server with 128 synthetic threads: virtual idle added no native pages, and a resident read returned cached rows before two database-only pages completed. This proves native request behavior, while Gateway CPU reduction remains unmeasured. No stored-data contract changes.
  • proof: sufficient: Contributor real behavior proof is sufficient. The changed catalog control used a real pinned Codex app-server with 128 synthetic threads: virtual idle added no native pages, and a resident read returned cached rows before two database-only pages completed. This proves native request behavior, while Gateway CPU reduction remains unmeasured. No stored-data contract changes.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed September 24, 2026, 4:56 PM ET / 20:56 UTC sha unknown :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-24T21:18:05.472Z sha 9329688457a5f0c2a42c7d9c4ab341e6a35e9dd9 :: blocked before merge. :: [P2] Keep local file scans independent of demand-triggered native walks
  • reviewed 2026-09-24T21:54:41.495Z sha 9c72d7c :: blocked before merge. :: none
  • reviewed 2026-09-26T04:38:29.501Z sha 9c72d7c :: needs maintainer review before merge. :: none
  • reviewed 2026-09-26T04:43:58.746Z sha 9c72d7c :: needs maintainer review before merge. :: none

@PollyBot13
PollyBot13 force-pushed the pollybot/fix-157460-catalog-idle branch from 3f0f96a to 9329688 Compare September 24, 2026 21:10
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 24, 2026
@PollyBot13
PollyBot13 force-pushed the pollybot/fix-157460-catalog-idle branch from 9329688 to 9c72d7c Compare September 24, 2026 21:45
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 24, 2026
@steipete

Copy link
Copy Markdown
Contributor

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 thread/started notifications, and the first catalog read after the interval starts the background walk. Lead review is clean, and I inspected the Codex app-server protocol (thread/list params/response and the thread/started notification) to confirm the model. Landing via the maintainer lander now; this will also be backported to the 2026.9.7 release branch. Thanks @PollyBot13.

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete steipete closed this Sep 26, 2026
@steipete steipete reopened this Sep 26, 2026
@steipete
steipete merged commit a46c097 into openclaw:main Sep 26, 2026
311 of 325 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

steipete added a commit that referenced this pull request Sep 26, 2026
) (#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]>
roboclaw-bot added a commit that referenced this pull request Sep 27, 2026
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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: codex merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants