Skip to content

fix(codex): keep catalog refreshes fast during older-session discovery - #150517

Merged
steipete merged 2 commits into
mainfrom
codex/catalog-discovery-cache-2582
Sep 17, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/catalog-discovery-cache-2582

Conversation

@steipete

@steipete steipete commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Refreshing the native session catalog can repeatedly scan the same hidden sessions while background discovery pages through older sessions.

Related: #149773, #149879, #150112.

User Impact

Recent catalog refreshes reuse their cached pages during older-session discovery. Native ordering, cursors, visibility checks, and the 32-second cache lifetime are preserved.

Why This Change Was Made

A filtered head request can walk 20 native pages. Older discovery walks can then evict that entire prefix from the 32-page source cache, making the next unchanged refresh repeat 19 native requests. Cache admission now favors pages belonging to a head walk, bounded to 20 across all queries within the existing 32-page total. Pending requests remain shared and settle normally.

Evidence

The registered provider regression interleaves a 40-row head request with three deeper discovery walks using the default 50-row limit. Each unchanged head makes 19 extra native requests before the fix and zero afterward, with identical results and continuation cursors. Discovery still reaches a visible session beyond 4,300 managed sessions.

Validation: 92 focused catalog tests passed, followed by a final rerun of all 28 tests in the two changed test files. Full changed-file checks and independent P2 review passed. CI identified two node-listing assertions for the previous helper signature; those now explicitly check head-fill and continuation cache hints. All 33 node/discovery tests and their changed-file checks passed, with a second clean independent review.

Checks cover pending and settled page reuse, cache bounds across query variants, expiration, background refresh, source isolation, cancellation, and native paging. The demonstrated performance claim is eliminating redundant native page requests under this interleaved workload. The synthetic proof does not establish production latency or CPU savings; those require measurement after deployment. The cache size and expiration policy stay unchanged.

@clawsweeper

clawsweeper Bot commented Sep 17, 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.

@steipete
steipete marked this pull request as ready for review September 17, 2026 02:36
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: codex size: M maintainer Maintainer-authored PR labels Sep 17, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 11:03 PM ET / September 17, 2026, 03:03 UTC (Revision 2).

ClawSweeper review

What this changes

The Codex session catalog favors recent listing pages in its existing cache so discovering older sessions does not force unchanged refreshes to repeat native requests.

Merge readiness

✅ Ready for maintainer review

This remains useful work beyond the earlier merged fixes, with no blocking correctness findings. The updated evidence appropriately limits the performance claim to avoided requests, resolving the previous measurement caveat.

Priority: P2
Reviewed head: 80227a824b010b40f79b70ab900f812cf72480b5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with useful boundary regressions, accurate evidence limits, and no actionable correctness or security findings.
Proof confidence 🌊 off-meta tidepool Not applicable: Verified maintainer-authored internal cache work is exempt from contributor live-proof requirements. The registered-provider test exercises the changed retention owner through mocked native requests; it supports the stated request-count claim, not production latency or CPU savings.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Verified maintainer-authored internal cache work is exempt from contributor live-proof requirements. The registered-provider test exercises the changed retention owner through mocked native requests; it supports the stated request-count claim, not production latency or CPU savings.
Evidence reviewed 10 items Bounded cache policy: The retention helper favors at most 20 head-walk entries, demotes older favored entries across queries, and evicts ordinary entries until the existing 32-page limit is restored. It replaces the existing eviction policy rather than adding a competing cache.
Production caller and request lifecycle: The visible-page builder derives the hint from the original request cursor, so all steps of a head fill receive it. The control promotes pending and settled pages while preserving source/config partitioning, expiry, shared producers, and stale delivery. The hint remains private to the plugin and is not sent over the native or node protocol.
Focused behavioral regression: The registered-provider test interleaves a 20-page head fill with three older discovery walks, requires zero additional requests on unchanged head refreshes, preserves results/cursors, and reaches the visible thread beyond 4,300 hidden sessions. Supplemental cases cover pending/settled promotion, expiry, and bounds across queries. These tests use mocked transport; they were inspected, not executed during this review.
Findings None None.
Security None None.

How this fits together

The Codex plugin supplies OpenClaw's session catalog with native session metadata from local and paired-node app-servers. Its page cache sits between catalog refreshes and native pagination, before visibility filtering and delivery to consumers.

flowchart TD
  A[Catalog refresh or older discovery] --> B[Visible session page builder]
  B --> C[Source-scoped page cache]
  C --> D{Fresh or pending page?}
  D -->|Reuse| F[Visibility filtering]
  D -->|Fetch or refresh| E[Native Codex catalog]
  E --> C
  F --> G[Sessions and continuation cursor]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source +55, Tests +146, Docs +4. Total +205 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 4 95 40 +55
Tests 3 230 84 +146
Docs 1 4 0 +4
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 329 124 +205

Review metrics

Metric Value Why it matters
Cache budget 20 favored entries within 32 total; 32-second expiry unchanged The optimization reallocates retention preference without increasing the per-source page capacity.
Production versus test growth Production +55 net lines; tests +146 net lines Production growth implements bounded retention and shared-request promotion; tests exercise the eviction workload and existing lifecycle guarantees.

Technical review

Best possible solution:

Keep cache retention within the existing catalog owner, preserving native pagination, visibility checks, and freshness without adding configuration or persistent state.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: a 20-page head walk followed by enough older pages exceeds main's ordinary 32-page cache and evicts pages needed by the next refresh. The registered-provider regression covers that sequence; no runtime reproduction was executed here.

Is this the best way to solve the issue?

Yes. A bounded preference in the existing cache directly addresses the eviction mechanism while preserving native requests, expiry, and public contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9ca2d1dfcd16.

Labels

Label justifications:

  • P2: This addresses redundant native catalog requests during older-session discovery with a bounded, plugin-local performance repair.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Verified maintainer-authored internal cache work is exempt from contributor live-proof requirements. The registered-provider test exercises the changed retention owner through mocked native requests; it supports the stated request-count claim, not production latency or CPU savings.

Evidence

What I checked:

  • Bounded cache policy: The retention helper favors at most 20 head-walk entries, demotes older favored entries across queries, and evicts ordinary entries until the existing 32-page limit is restored. It replaces the existing eviction policy rather than adding a competing cache. (extensions/codex/src/session-catalog-page-cache.ts:31, 80227a824b01)
  • Production caller and request lifecycle: The visible-page builder derives the hint from the original request cursor, so all steps of a head fill receive it. The control promotes pending and settled pages while preserving source/config partitioning, expiry, shared producers, and stale delivery. The hint remains private to the plugin and is not sent over the native or node protocol. (extensions/codex/src/session-catalog-visible-page.ts:49, 80227a824b01)
  • Focused behavioral regression: The registered-provider test interleaves a 20-page head fill with three older discovery walks, requires zero additional requests on unchanged head refreshes, preserves results/cursors, and reaches the visible thread beyond 4,300 hidden sessions. Supplemental cases cover pending/settled promotion, expiry, and bounds across queries. These tests use mocked transport; they were inspected, not executed during this review. (extensions/codex/src/session-catalog-discovery-cache.test.ts:64, 80227a824b01)
  • Still necessary on current main: Inspection of the fetched main revision shows ordinary settled-page recency updates and pruneMapToMaxSize eviction, without head-walk preference. The merged multi-home partitioning and bounded-index work therefore do not solve this interleaved discovery case. (extensions/codex/src/session-catalog-control.ts:615, 9ca2d1dfcd16)
  • Latest release check: The catalog control retrieved through GitHub at v2026.9.4 still uses the older 32-entry pruning implementation and has no headWalk hint. This PR's retention behavior is not established as shipped in that release. (extensions/codex/src/session-catalog-control.ts:535, 3a9d69db306c)
  • Affirmative Codex dependency boundary: The catalog index sends native thread-list requests with recency ordering and native cursors; the PR expressly preserves those contracts. This establishes the dependency signal for personally inspecting the sibling Codex implementation. (extensions/codex/src/session-catalog-index.ts:255, 80227a824b01)

Likely related people:

  • steipete: 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 (1 earlier review cycle)
  • reviewed 2026-09-17T02:46:22.759Z sha e315229 :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Updated the paired-node assertions to check the internal cache hint explicitly: both head-fill steps are favored, and an older continuation is not. All 33 node/discovery tests, the follow-up changed-file checks, and a fresh independent review passed.

The PR description now states the acceptance claim precisely: the registered-provider reproduction eliminates 19 redundant native requests per unchanged head refresh, with identical results and cursors and unchanged cache bounds and expiry. Production latency and CPU measurements remain a deployment follow-up.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@steipete
steipete merged commit 438b6bf into main Sep 17, 2026
102 checks passed
@steipete
steipete deleted the codex/catalog-discovery-cache-2582 branch September 17, 2026 04:14
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
openclaw#150517)

Keep recent native session catalog refreshes reusable while background discovery visits older sessions. Favor at most 20 head-walk pages within the existing 32-page source cache, preserving its expiration policy, native cursors, visibility checks, and shared pending producers.

The registered-provider regression eliminates 19 redundant native requests per unchanged head refresh after deeper discovery, with identical results and continuation. Focused catalog and node tests, full changed-file checks, independent review, and exact-head CI passed. Production latency and CPU measurements remain a deployment follow-up.

Related: openclaw#149773, openclaw#149879, openclaw#150112.
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 maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. 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.

1 participant