Skip to content

fix(codex): cap compaction override warning cache via createDedupeCache - #101745

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-101643-codex-compaction-cap
Aug 4, 2026
Merged

vincentkoc merged 4 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-101643-codex-compaction-cap

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Codex app-server ignored-compaction-override warning used a process-lifetime
Set<string>. Every distinct ignored override key remained in memory until the
gateway exited.

Why This Change Was Made

The warning owner now uses the existing public SDK helper:
createDedupeCache({ ttlMs: 0, maxSize: 4096 }).

This preserves ordinary warn-once behavior while bounding retained keys. A key
can warn again only after it is evicted from the 4,096-entry LRU cache.

The change does not alter configuration, persistence, provider routing, or the
Codex RPC.

User Impact

Gateways with ordinary ignored-override cardinality keep the same warning
behavior. High-cardinality configurations no longer grow this warning cache
without bound.

Evidence

  • Exact reviewed head: 36605735babdbd4ebc8d6733eb6b817fb6acf78a.
  • Current main still contains the unbounded module-level Set.
  • Direct upstream contract inspection at openai/codex
    414782450952a196bbb64b1605a458c2531c47b6:
    • codex-rs/app-server-protocol/src/protocol/v2/thread.rs:924-926 defines
      ThreadCompactStartParams with only thread_id.
    • codex-rs/app-server/src/request_processors/thread_processor.rs:1755-1766
      loads that thread and submits Op::Compact.
    • codex-rs/core/src/tasks/compact.rs:17-75 selects native compaction from
      the Codex turn context.
    • OpenClaw model/provider/thinking overrides therefore cannot enter
      thread/compact/start; the warning remains accurate.
  • Boundary test passed three consecutive runs:
    node scripts/run-vitest.mjs extensions/codex/src/app-server/compact.test.ts -t "bounds ignored compaction override warnings".
  • Full focused file passed: 46/46 tests.
  • git diff --check passed.
  • Exact-head CI passed, including openclaw/ci-gate:
    https://github.com/openclaw/openclaw/actions/runs/30884809067
  • Exact-head ClawSweeper found no actionable code findings:
    fix(codex): cap compaction override warning cache via createDedupeCache #101745 (comment)
  • Autoreview was attempted twice; its helper completed secret scanning but hung
    before returning model output, so no autoreview result was available.

Production delta: +5/-3 (net +2). Tests: +65/-0.

AI-assisted: built with Codex

@clawsweeper

clawsweeper Bot commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 3:14 AM ET / 07:14 UTC.

ClawSweeper review

What this changes

The PR replaces the Codex compaction override-warning Set with a 4,096-entry SDK deduplication cache and adds entry-point eviction-boundary coverage.

Merge readiness

⛔ Blocked until stronger real behavior proof is added - 3 items remain

Keep open: current main still retains warning keys in an unbounded Set, and the patch has no source-level correctness finding. A final Codex contract and merge-ready verdict is blocked because the repository-required sibling Codex checkout is unavailable.

Priority: P3
Reviewed head: 36605735babdbd4ebc8d6733eb6b817fb6acf78a

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused implementation and boundary test are sound on the inspected OpenClaw surfaces, but the mandatory Codex contract gate remains unverified.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR body contains a useful before/after terminal transcript through the entry point, but repository policy prevents a sufficient Codex proof claim without direct sibling Codex source inspection. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs stronger real behavior proof before merge: The PR body contains a useful before/after terminal transcript through the entry point, but repository policy prevents a sufficient Codex proof claim without direct sibling Codex source inspection. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main defect remains: Current main declares a process-lifetime Set and uses has/add for ignored-override warning keys, so distinct configurations can grow it without bound.
Entry point and caller: Both Codex harness compaction routes call the same entry point, which warns before deciding whether native compaction may run.
Existing SDK cache contract: The public plugin SDK export delegates to a helper whose zero TTL retains keys, check refreshes LRU recency, and maxSize pruning removes the oldest entry.
Findings None None.
Security None None.

How this fits together

The bundled Codex plugin sends compaction work to Codex app-server and warns when OpenClaw-specific compaction overrides cannot apply. The module-local cache suppresses duplicate operator warnings before native compaction continues.

flowchart LR
  A[Agent compaction settings] --> B[Codex compaction entry]
  B --> C[Ignored override check]
  C --> D[Bounded warning cache]
  D --> E[Operator warning]
  B --> F[Codex app-server request]
  F --> G[Native thread compaction]
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR body contains a useful before/after terminal transcript through the entry point, but repository policy prevents a sufficient Codex proof claim without direct sibling Codex source inspection. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - The required direct Codex protocol/runtime-source check cannot be completed until a sibling Codex checkout is available; this review cannot make a merge-ready or proof-sufficient claim without it.
  • Complete next step (P2) - No mechanical repair is identified; a reviewer with the required sibling Codex source must complete the blocked contract check.
Agent review details

Security

None.

PR surface

Source +2, Tests +65. Total +67 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 3 +2
Tests 1 65 0 +65
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 70 3 +67

Review metrics

Metric Value Why it matters
Production versus test delta production +5/-3 (net +2), tests +65/-0 The small production increase is the existing SDK seam plus an explicit cache-lifecycle comment; the larger change is focused regression coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Merge the narrow SDK-cache replacement only after an exact-head review can inspect the required sibling Codex source and confirm the existing app-server contract.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Merge the narrow SDK-cache replacement only after an exact-head review can inspect the required sibling Codex source and confirm the existing app-server contract.

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

Yes from source: current main records each distinct ignored-override key in a process-lifetime Set, and the proposed test exercises the 4,096/4,097-key boundary through the entry point. This read-only review did not execute the test.

Is this the best way to solve the issue?

Yes for the local memory-boundary defect: the plugin already has an SDK-supported bounded dedupe cache, so using it preserves warn-once behavior until intentional LRU eviction without adding a parallel implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8393b37779d9.

Labels

Label justifications:

  • P3: This bounds diagnostic-memory growth without changing configuration, the Codex request payload, or ordinary compaction behavior.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body contains a useful before/after terminal transcript through the entry point, but repository policy prevents a sufficient Codex proof claim without direct sibling Codex source inspection. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

Likely related people:

  • steipete: Commit 934fc6c records the native Codex app-server compaction direction for this file. (role: native-compaction area contributor; confidence: medium; commits: 934fc6ceeb10; files: extensions/codex/src/app-server/compact.ts)
  • vincentkoc: The provided timeline assigns this PR to vincentkoc, and shallow current-line blame attributes the file to a commit authored by Vincent Koc. (role: assigned reviewer and recent file attribution; confidence: low; commits: 3bbc4ad085e2; files: extensions/codex/src/app-server/compact.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Make the sibling Codex source available to an exact-head reviewer, then request one fresh review.

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 (43 earlier review cycles; latest 8 shown)
  • reviewed 2026-07-17T14:31:12.819Z sha 100b6f016f7c6637f535d698b173179607e7f92a :: needs changes before merge. :: [P3] Document the zero-TTL cache lifecycle
  • reviewed 2026-07-25T17:24:56.706Z sha 3cb30318607e2fbe15079ef63815c7136894612c :: needs changes before merge. :: [P3] Document the zero-TTL cache lifecycle
  • reviewed 2026-07-28T01:28:05.675Z sha 83b41430d5254a6e1037ac0c5c668ebac8c6916f :: needs changes before merge. :: [P3] Document the zero-TTL cache lifecycle
  • reviewed 2026-07-31T06:10:36.679Z sha 83b41430d5254a6e1037ac0c5c668ebac8c6916f :: needs changes before merge. :: [P3] Document the zero-TTL cache lifecycle
  • reviewed 2026-08-03T13:29:19.125Z sha 3b070680d287381ced8466ed33b04af433a58714 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T13:35:41.758Z sha 3b070680d287381ced8466ed33b04af433a58714 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-03T15:01:33.168Z sha 5d83cd7eb1f8478f271113efba5b57af7221aea6 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-04T04:13:34.098Z sha 40f66c6ea3ed03af7aabb94a322ffa29f247ae2d :: needs real behavior proof before merge. :: [P3] Assert retention at the advertised cache boundary

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 7, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-101643-codex-compaction-cap branch from 8516dbb to d2d3e84 Compare July 7, 2026 15:38
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 7, 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 repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 7, 2026
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

1 similar comment
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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: 🦪 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 Jul 7, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-101643-codex-compaction-cap branch from d284a6d to cdaa401 Compare July 9, 2026 01:33
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-101643-codex-compaction-cap branch from cdaa401 to 59d6fff Compare July 9, 2026 13:55
@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Jul 9, 2026
@clawsweeper clawsweeper Bot added the rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. label Jul 13, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-101643-codex-compaction-cap branch from 6e9acce to 536ad6f Compare July 13, 2026 15:52
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 Jul 13, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-101643-codex-compaction-cap branch 3 times, most recently from ebbbdeb to 10f4d92 Compare July 14, 2026 15:04
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Jul 14, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-101643-codex-compaction-cap branch from 10f4d92 to 3c2a635 Compare July 16, 2026 03:02
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 3, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 4, 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 repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: codex P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants