Skip to content

test(qa): prove overflow compaction retry and pruning - #119033

Merged
vincentkoc merged 1 commit into
mainfrom
qa-b3-compaction-pruning-20260803
Aug 4, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
qa-b3-compaction-pruning-20260803

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

The existing compaction-retry QA scenario did not prove that one coded provider overflow causes exactly one OpenClaw compaction and retry, preserves durable current context, prunes older history, and avoids replaying a mutating tool. Its paired Codex cell could also look successful without exercising Codex native compaction.

Why This Change Was Made

This strengthens the mock provider contract and scenario evidence around request kind, coded overflow outcome, raw request size, retry ordering, transcript checkpoints, one successful write, one causal continuation, and exact pruning boundaries. The Codex cell now exits before gateway or provider work with an explicit known-harness-gap because provider-error recovery does not invoke Codex native token-threshold compaction.

User Impact

No production runtime behavior changes. Maintainers gain deterministic regression coverage for overflow compaction retry safety and pruning, without overstating cross-runtime parity.

Evidence

  • Exact head: dc41d697799007dd907a8054f5b4d82f00a3dce1
  • Exact-head private QA runtime pair passed:
    • OpenClaw: pass, one successful write, exact final text Protocol note: replay unsafe after write., totalTokens=168
    • Codex: intentional skip in 4 ms with zero tools and the documented known harness gap
    • Pair verdict: pass with structural drift
  • Coverage evidence records these primary IDs:
    • session-memory.compaction
    • session-memory.compaction-retry-policy
    • session-memory.pruning
  • Focused QA Lab tests: 270 passed
  • Extension lint: passed
  • Import-cycle check: 0 runtime value cycles
  • Project tsgo build: passed
  • Exact-head private QA build: passed
  • Sol/high autoreview: clean, confidence 0.99
  • git diff --check and privacy scan: clean
  • Blacksmith was unavailable because this session was unauthenticated. The changed-gate Daytona attempt failed before command execution during remote seed/hydration, so trusted local fallback was used per repository policy.

Codex contract checked directly at openai/codex@bb1af235ea2822d7a40f75ef52e4d6a2cde84da2:

  • codex-rs/codex-api/src/sse/responses.rs:625-627

  • codex-rs/core/src/compact.rs:240-385

  • codex-rs/core/src/compact.rs:525-547

  • codex-rs/core/src/compact.rs:630-654

  • codex-rs/core/src/compact_remote_v2.rs:201-321

  • codex-rs/core/src/compact_remote_v2.rs:330-378

  • codex-rs/core/src/compact_remote_v2_attempt.rs:30-134

  • codex-rs/core/src/session/turn.rs:330-545

  • codex-rs/core/src/session/turn.rs:983-1010

  • codex-rs/core/src/session/turn.rs:1369-1373

  • AI-assisted

  • I understand the changed QA behavior and proof boundary

@vincentkoc vincentkoc self-assigned this Aug 4, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 4, 2026 00:57
@vincentkoc

Copy link
Copy Markdown
Member 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:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 3, 2026, 11:24 PM ET / August 4, 2026, 03:24 UTC.

ClawSweeper review

What this changes

The PR adds a QA Lab gateway scenario and mock-provider assertions proving one overflow compaction, compacted retry, history pruning, and exactly-once mutation behavior.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open for human review. The OpenClaw QA path is well covered and no actionable patch defect was found, but the early Codex skip depends on a native-runtime claim that could not receive the repository-required direct Codex source check; the maintainer-authored, protected PR should not be auto-closed.

Priority: P3
Reviewed head: dc41d697799007dd907a8054f5b4d82f00a3dce1
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The OpenClaw boundary coverage is strong, with the overall rating capped by the unverified Codex-contract claim behind the skip.
Proof confidence 🦐 gold shrimp (3/6) Not applicable: This maintainer-authored QA PR is outside the external-contributor proof gate; its body supplies exact-head gateway/mock run results, though the Codex rationale still needs direct source verification.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored QA PR is outside the external-contributor proof gate; its body supplies exact-head gateway/mock run results, though the Codex rationale still needs direct source verification.
Evidence reviewed 7 items Overflow recovery owner: Current main sends provider overflow into recovery, performs forced overflow compaction, adopts the compacted transcript, then retries the prompt.
Compaction wire contract: Current main uses the structured context-summary system prompt that the PR’s mock classifies as a compaction-summary request.
QA boundary assertions: The proposed scenario binds one coded overflow to one later write, one continuation, durable-context retention, pruning, session compaction state, and an overflow-retry checkpoint branch.
Findings None None.
Security None None.

How this fits together

QA Lab runs an isolated gateway and agent session against a mock provider, then inspects provider requests, stored session state, and compaction checkpoints. The scenario exercises OpenClaw’s overflow recovery path and reports parity results for OpenClaw and Codex runtimes.

flowchart LR
  Transcript[Seeded session transcript] --> Gateway[QA gateway]
  Gateway --> Provider[Mock provider]
  Provider --> Overflow[One coded overflow]
  Overflow --> Recovery[OpenClaw compaction recovery]
  Recovery --> Retry[Compacted retry]
  Retry --> Evidence[Requests, transcript, checkpoint assertions]
Loading

Decision needed

Question Recommendation
Does current Codex source confirm that provider-error recovery cannot exercise native threshold compaction, making the early Codex skip accurate? Verify the native contract: Inspect the current Codex compaction and turn-recovery source, then merge if it confirms the stated harness boundary.

Why: The repository requires direct sibling Codex inspection for this dependency-specific claim, and that source was unavailable to this review.

Before merge

  • Resolve merge risk (P1) - Runtime parity accepts one known-harness-gap skip as passable, so an incorrect Codex assumption could make this QA lane green while suppressing useful Codex coverage.
  • Complete next step (P2) - A maintainer must validate the required direct Codex contract before treating the early skip as merge-ready.
Agent review details

Security

None.

PR surface

Source +158, Tests +489, Other +130. Total +777 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 207 49 +158
Tests 4 510 21 +489
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 166 36 +130
Total 9 883 106 +777

Review metrics

Metric Value Why it matters
QA harness versus test LOC QA harness/scenario +373/-85; tests +510/-21 The production-side growth is confined to mock-provider and scenario fidelity, with the stated contract justification of exercising overflow recovery through the gateway boundary.

Stored data model

Persistent data-model change detected: serialized state: extensions/qa-lab/src/scenario-catalog-compaction.test.ts, serialized state: extensions/qa-lab/src/scenario-flow-runner.test.ts, serialized state: qa/scenarios/runtime/compaction-retry-mutating-tool.yaml. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the Codex skip contract (recommended)
    Before merging, inspect the native Codex compaction path and revise the known-gap text or scenario if provider-error recovery can trigger it.
  2. Pause the paired coverage
    Defer this scenario until the Codex contract can be proven rather than allowing an unverified skip to count as parity success.

Technical review

Best possible solution:

Verify the Codex native compaction contract from the required sibling source; retain the explicit early skip only if that contract confirms this provider-error scenario cannot exercise native threshold compaction.

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

Not applicable as a user-bug reproduction: this PR addresses a QA coverage gap, and its supplied exact-head run reports the intended OpenClaw boundary scenario.

Is this the best way to solve the issue?

Unclear for the cross-runtime claim: the OpenClaw test boundary is the right layer, but the Codex exclusion cannot be called the best solution until its native contract is directly checked.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 12beeb7b2947.

Labels

Label changes:

  • add P3: This is test and QA-harness coverage with no claimed production behavior change.
  • add merge-risk: 🚨 automation: The PR changes QA parity pass/skip behavior, so an unverified Codex skip could mask a runtime coverage regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored QA PR is outside the external-contributor proof gate; its body supplies exact-head gateway/mock run results, though the Codex rationale still needs direct source verification.

Label justifications:

  • P3: This is test and QA-harness coverage with no claimed production behavior change.
  • merge-risk: 🚨 automation: The PR changes QA parity pass/skip behavior, so an unverified Codex skip could mask a runtime coverage regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored QA PR is outside the external-contributor proof gate; its body supplies exact-head gateway/mock run results, though the Codex rationale still needs direct source verification.

Evidence

What I checked:

Likely related people:

  • steipete: Commit 30cc87a modeled Codex compaction in the parity mock, and shortlog shows the largest contribution count across the affected QA surfaces. (role: historical QA and Codex-compaction contributor; confidence: high; commits: 30cc87a8a6b4, 3890a5efb6ac; files: extensions/qa-lab/src/providers/mock-openai/server.ts, qa/scenarios/runtime/compaction-retry-mutating-tool.yaml)
  • dallinromney: Commits 19d17bc and 132d91e established adjacent runtime-pair and coverage-ID conventions used by this scenario. (role: runtime-pair and coverage-taxonomy contributor; confidence: high; commits: 19d17bc3c45a, 132d91e42756; files: extensions/qa-lab/src/runtime-parity.ts, qa/scenarios/runtime/compaction-retry-mutating-tool.yaml)
  • vincentkoc: Authored the exact PR head and has substantial prior history across the affected QA mock and flow surfaces. (role: recent QA-area contributor; confidence: high; commits: dc41d6977990, 0758316883f5; files: extensions/qa-lab/src/providers/mock-openai/server.ts, extensions/qa-lab/src/scenario-flow-runner.ts)

Rank-up moves

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

  • Verify the current Codex native compaction and turn-recovery contract before accepting the known-harness-gap wording.

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.

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer disposition for the ClawSweeper decision, before-merge items, and rank-up move:

Verified current openai/codex origin/main at db1a4145692fcfc88fb354f478b0019ca0d2ef9d.

  • App-server turn/start submits one Op::UserInput into the core turn flow: codex-rs/app-server/src/request_processors/turn_processor.rs:569-583.
  • Native auto-compaction is driven by tracked token usage at pre-turn or after a successful sampling response: codex-rs/core/src/session/turn.rs:371-457, codex-rs/core/src/session/turn.rs:983-1010, codex-rs/core/src/session/context_window.rs:23-79.
  • A Responses context_length_exceeded failure maps to ContextWindowExceeded: codex-rs/codex-api/src/sse/responses.rs:390-419, codex-rs/codex-api/src/sse/responses.rs:628-630.
  • That error is non-retryable. The sampling path marks token usage full and returns the error, ending the current turn rather than invoking compaction or retrying it: codex-rs/core/src/session/turn.rs:1359-1397, codex-rs/core/src/session/mod.rs:3869-3875, codex-rs/protocol/src/error.rs:359-382.
  • Core and app-server tests confirm the distinction: provider overflow emits an error and completes the turn (codex-rs/core/tests/suite/client.rs:3471-3570), while native auto-compaction is triggered by successful token-usage-bearing turns and a later turn (codex-rs/app-server/tests/suite/v2/compaction.rs:48-98).

Verdict: the scenario's single coded provider overflow cannot exercise Codex native threshold compaction and same-run mutation recovery. A truthful Codex proof needs a separate multi-turn/token-usage scenario. The existing early known-harness-gap skip is accurate, runs before gateway/session/provider work, and makes no Codex compaction coverage claim. No code change is needed at PR head dc41d697799007dd907a8054f5b4d82f00a3dce1.

Decision accepted; merge-risk check, maintainer validation, and the Rank-up move are resolved.

@vincentkoc
vincentkoc merged commit 2ca01fb into main Aug 4, 2026
190 of 196 checks passed
@vincentkoc
vincentkoc deleted the qa-b3-compaction-pruning-20260803 branch August 4, 2026 04:15
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 4, 2026
* origin/main:
  fix: preserve live updater failure diagnostics (#119096)
  fix: recover new-session models through Gateway startup (#119120)
  test(qa): cover instruction profile artifacts (#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (#119093)
  test(qa): prove overflow compaction pruning (#119033)
  fix(tool-search): preserve deferred MCP failures (#118363)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 4, 2026
vincentkoc added a commit that referenced this pull request Aug 4, 2026
* 'main' of https://github.com/openclaw/openclaw:
  test(qa): cover sandboxed exec behavior (#119053)
  test(qa): prove shared-channel memory recall (#119111)
  fix(telegram): keep request deadlines through response bodies
  test(qa): cover gateway plugin approvals (#119128)
  fix(ai): keep OpenAI tool call id truncation UTF-16 safe (#110471)
  fix: preserve live updater failure diagnostics (#119096)
  fix: recover new-session models through Gateway startup (#119120)
  test(qa): cover instruction profile artifacts (#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (#119093)
  test(qa): prove overflow compaction pruning (#119033)
  fix(tool-search): preserve deferred MCP failures (#118363)
  fix(macos): keep setup activation within app checks
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* origin/main:
  fix: preserve live updater failure diagnostics (openclaw#119096)
  fix: recover new-session models through Gateway startup (openclaw#119120)
  test(qa): cover instruction profile artifacts (openclaw#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (openclaw#119093)
  test(qa): prove overflow compaction pruning (openclaw#119033)
  fix(tool-search): preserve deferred MCP failures (openclaw#118363)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
* 'main' of https://github.com/openclaw/openclaw:
  test(qa): cover sandboxed exec behavior (openclaw#119053)
  test(qa): prove shared-channel memory recall (openclaw#119111)
  fix(telegram): keep request deadlines through response bodies
  test(qa): cover gateway plugin approvals (openclaw#119128)
  fix(ai): keep OpenAI tool call id truncation UTF-16 safe (openclaw#110471)
  fix: preserve live updater failure diagnostics (openclaw#119096)
  fix: recover new-session models through Gateway startup (openclaw#119120)
  test(qa): cover instruction profile artifacts (openclaw#119078)
  fix(telegram): record automatic delivery message ids
  test(qa): cover memory promotion safety (openclaw#119093)
  test(qa): prove overflow compaction pruning (openclaw#119033)
  fix(tool-search): preserve deferred MCP failures (openclaw#118363)
  fix(macos): keep setup activation within app checks
  test(setup): type provider kind fixture
  fix(setup): complete prepared model activation
  fix(protocol): regenerate Swift wizard models
  fix(ollama): activate the model selected during setup
  fix(setup): preserve the prepared model handoff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qa-lab maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L 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