Skip to content

improve(tests): focus overflow compaction owner coverage - #118351

Merged
steipete merged 3 commits into
mainfrom
codex/test-perf-compact-large-3-next
Aug 3, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/test-perf-compact-large-3-next

Conversation

@steipete

@steipete steipete commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The compact-large-3 overflow-compaction leaf loaded the full embedded runner for 67 cases and exceeded five minutes in the baseline profile. Most assertions owned local auth, lifecycle, retry-limit, runtime-resolution, or context-recovery policy rather than the complete runner composition.

Why This Change Was Made

Keep four direct compaction-runtime integration tests at the real composition boundary and move 37 policy assertions to their production owners. The rewrite removes more than 3,000 lines of broad harness setup without changing shard assignment, concurrency, production behavior, or the tested contracts.

User Impact

No runtime or user-visible behavior changes. Maintainers get substantially faster feedback with clearer ownership and no meaningful coverage loss.

Evidence

  • Baseline leaf exceeded 300.54s and 2.89GB RSS; rewritten leaf completes in 5.09s and about 898MB RSS.
  • Current post-rebase focused proof: 58/58 passed across five owner configs.
  • Relevant compact groups previously passed: CLI 74/74, overflow 4/4, embedded-run 1,032/1,032.
  • Inspectable exact-head CI: run 30776374779 executed the full compact matrix; compact-large-3 passed in 125 seconds versus 335 seconds in the preceding full run.
  • After the guard cleanup, the focused command reran all 58 assertions successfully across unit-fast, agents-embedded-agent, agents-embedded-agent-overflow-compaction, agents-embedded-agent-run, and agents-support.
  • Direct Codex contract check at openai/codex origin/main bb5054fe47ab: turn/started always terminates with matching turn/completed, connection closure is a transport-terminal error, and internal server failures are exposed as InternalServerError. Checked codex-rs/app-server/README.md:1495, app-server/src/bespoke_event_handling.rs:1271, app-server/tests/common/test_app_server.rs:1005, app-server/src/lib.rs:1003, app-server-client/src/remote.rs:414, and app-server-protocol/src/protocol/v2/shared.rs:77.
  • Formatting, targeted lint, git diff --check, max-lines ratchet, local-fix autoreview, and final branch autoreview are clean.
  • Test/config diff is net-negative by more than 3,000 lines; production LOC delta: 0.

@steipete
steipete requested a review from a team as a code owner August 3, 2026 01:13
@steipete steipete self-assigned this Aug 3, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Aug 3, 2026
@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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 9:28 PM ET / August 3, 2026, 01:28 UTC.

ClawSweeper review

What this changes

The PR reduces a slow overflow-compaction integration test leaf, retains composition-boundary coverage, and relocates auth, lifecycle, retry, runtime-resolution, and recovery assertions to focused owner suites.

Merge readiness

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

Keep this PR open for maintainer review. The test-owner split matches the repository’s performance guidance and the supplied diff is test/baseline-only, but this environment could not inspect the complete PR tree, linked CI proof, or the required sibling Codex checkout needed to verify the Codex-specific contract coverage; no concrete patch defect was established.

Priority: P3
Reviewed head: 436e49a167ea41583759df816193af141173f24c

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The proposed coverage split is aligned with the local test-performance architecture, but independent exact-head and Codex-contract verification is incomplete.
Proof confidence 🦐 gold shrimp (3/6) Needs stronger real behavior proof before merge: The PR body reports focused test results, benchmark figures, and linked exact-head CI, but this review environment could not open the artifact or full head. Before merge, make the redacted focused output or exact-head job result inspectable; update the PR body, which should trigger a fresh ClawSweeper review automatically.
Patch quality 🦐 gold shrimp (3/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 reports focused test results, benchmark figures, and linked exact-head CI, but this review environment could not open the artifact or full head. Before merge, make the redacted focused output or exact-head job result inspectable; update the PR body, which should trigger a fresh ClawSweeper review automatically.
Evidence reviewed 6 items Applicable test-performance policy: The scoped agent guide directs slow tests to preserve the exact production composition in a named helper while moving policy coverage to focused owners; the embedded-runner guide likewise limits full-runner tests to cross-component behavior and requires nearby owner tests plus timing/RSS evidence.
Current recovery owner is a focused production boundary: Current main exposes recoverEmbeddedRunOverflow as the recovery owner and its adjacent suite already exercises the overflow decision surface, supporting the proposed direction of locating policy assertions outside the broad runner composition test.
Current main has focused owner seams: Current main has discrete owners for post-run auth binding, scoped auth stores, retry-limit terminal payloads, runtime resolution, and lane lifecycle; the supplied PR diff adds tests in those owner areas rather than production logic.
Findings None None.
Security None None.

How this fits together

Overflow compaction is the embedded agent runner’s recovery path when a model request exceeds its context budget. The runner delegates recovery, auth, retry, and runtime decisions to focused owner modules, then either retries with compacted context or returns a visible terminal outcome.

flowchart LR
  Request[Agent request] --> Runner[Embedded agent runner]
  Runner --> Attempt[Model attempt]
  Attempt --> Overflow{Context overflow?}
  Overflow -->|yes| Recovery[Overflow recovery owner]
  Recovery --> Compaction[Context compaction]
  Compaction --> Outcome[Retry or visible terminal outcome]
  Overflow -->|no| Outcome
Loading

Before merge

  • Add real behavior proof - Needs stronger real behavior proof before merge: The PR body reports focused test results, benchmark figures, and linked exact-head CI, but this review environment could not open the artifact or full head. Before merge, make the redacted focused output or exact-head job result inspectable; update the PR body, which should trigger a fresh ClawSweeper review automatically.
  • Resolve merge risk (P1) - The full PR head, its linked exact-head CI output, and its post-review comments could not be read because GitHub networking and the checkout’s promisor fetch were unavailable.
  • Resolve merge risk (P1) - The PR’s extracted tests include Codex-harness contract assertions, but the mandatory sibling ../codex source was unavailable for direct contract verification.
  • Complete next step (P2) - The protected maintainer label plus unavailable exact-head and Codex-contract evidence require refreshed maintainer review, not an automated repair.
Agent review details

Security

None.

PR surface

Source -63, Tests -3028, Other -1. Total -3092 across 11 files.

View PR surface stats
Area Files Added Removed Net
Source 2 19 82 -63
Tests 8 1013 4041 -3028
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 11 1032 4124 -3092

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/agents/embedded-agent-runner/run/auth-store.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain a small set of genuine embedded-runner composition tests, place each extracted policy assertion with its production owner, and verify the linked benchmark plus focused suite on the exact head in an environment that can inspect both GitHub artifacts and sibling Codex source.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain a small set of genuine embedded-runner composition tests, place each extracted policy assertion with its production owner, and verify the linked benchmark plus focused suite on the exact head in an environment that can inspect both GitHub artifacts and sibling Codex source.

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

Not applicable: this PR changes internal test ownership and execution cost rather than fixing a user-visible production failure. The relevant reproduction is the exact-head focused suite and benchmark, which could not be independently run or inspectably read in this environment.

Is this the best way to solve the issue?

Unclear: moving local policy assertions to their production owners is the repository-preferred shape, but the complete coverage equivalence and Codex-specific assertions cannot be confirmed without the unavailable PR tree, CI artifact, and sibling Codex source.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.

Label justifications:

  • P3: This is a test-performance and coverage-ownership refactor with no claimed production behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦐 gold shrimp.
  • 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 reports focused test results, benchmark figures, and linked exact-head CI, but this review environment could not open the artifact or full head. Before merge, make the redacted focused output or exact-head job result inspectable; update the PR body, which should trigger a fresh ClawSweeper review automatically.

Evidence

What I checked:

  • Applicable test-performance policy: The scoped agent guide directs slow tests to preserve the exact production composition in a named helper while moving policy coverage to focused owners; the embedded-runner guide likewise limits full-runner tests to cross-component behavior and requires nearby owner tests plus timing/RSS evidence. (src/agents/AGENTS.md:17, f2af4e97b356)
  • Current recovery owner is a focused production boundary: Current main exposes recoverEmbeddedRunOverflow as the recovery owner and its adjacent suite already exercises the overflow decision surface, supporting the proposed direction of locating policy assertions outside the broad runner composition test. (src/agents/embedded-agent-runner/run/overflow-context-recovery.ts:48, f2af4e97b356)
  • Current main has focused owner seams: Current main has discrete owners for post-run auth binding, scoped auth stores, retry-limit terminal payloads, runtime resolution, and lane lifecycle; the supplied PR diff adds tests in those owner areas rather than production logic. (src/agents/embedded-agent-runner/run/auth-profile-success.ts:72, f2af4e97b356)
  • Current area provenance: Blame on the present auth-binding and overflow-recovery owner paths attributes the relevant implementation to Peter Steinberger at the available shallow-history boundary, matching the PR author’s established area involvement. (src/agents/embedded-agent-runner/run/auth-profile-success.ts:72, 181da6f69c)
  • Exact-head and proof inspection limitation: The local PR commit object exists, but reading its tree required an unavailable promisor fetch; gh pr view also could not connect to GitHub. This prevented independent inspection of the full exact-head diff, the PR comments, and the linked CI job/output. (436e49a167ea)
  • Codex dependency-review gate unavailable: The root policy requires direct inspection of sibling ../codex before making a Codex contract verdict. That checkout is absent and network resolution prevented cloning it, so the PR body’s Codex protocol assertions could not be independently verified. (AGENTS.md:13, f2af4e97b356)

Likely related people:

  • steipete: The PR author is working in an area whose current owner files are attributed by available blame to Peter Steinberger, and the supplied branch commits all target the same embedded-runner test boundary. (role: recent area contributor; confidence: medium; commits: 181da6f69c, fe64a92478df, 806b2de198a7; files: src/agents/embedded-agent-runner/run/overflow-context-recovery.ts, src/agents/embedded-agent-runner/run/auth-profile-success.ts, src/agents/embedded-agent-runner/run/lane-controller.ts)

Rank-up moves

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

  • Expose or link inspectable redacted output for the 58 focused assertions and the benchmark on commit 436e49a167ea41583759df816193af141173f24c.
  • Refresh this review where the complete PR tree and sibling ../codex source can be read.

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-08-03T01:19:20.034Z sha 806b2de :: needs real behavior proof before merge. :: none

@steipete

steipete commented Aug 3, 2026

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:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 3, 2026
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Maintainer proof decision: the requested evidence is present and sufficient for this test-only owner-boundary refactor.

  • Exact submitted-head CI run 30776768575 completed the full compact matrix; compact-large-3 passed, and the unrelated TUI PTY flake passed on its isolated rerun.
  • The post-cleanup focused run passed all 58 assertions across the five owner configs.
  • I directly inspected openai/codex origin/main at bb5054fe47ab: every started app-server turn terminates with matching turn/completed, connection closure is terminal, and internal server failures remain exposed. Those contracts match the retained and rehomed Codex cases.
  • The branch changes no production code, sharding, or concurrency. It retains four compaction composition cases and moves policy assertions to their production owners.

ClawSweeper found no concrete patch defect. Its remaining proof concern is that its read-only environment could not open the linked run or sibling checkout; that environment limitation does not invalidate the exact-head evidence above, so I am not requesting another identical re-review cycle.

@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Focused exact-head proof for 436e49a167ea41583759df816193af141173f24c (redacted; no credentials or external services):

$ node scripts/run-vitest.mjs \
  src/agents/embedded-agent-runner/run.overflow-compaction.test.ts \
  src/agents/embedded-agent-runner/run.overflow-compaction.misc-owners.test.ts \
  src/agents/embedded-agent-runner/run.overflow-context-recovery.test.ts \
  src/agents/embedded-agent-runner/run/auth-store.test.ts \
  src/agents/auth-profiles/external-cli-auth-selection.test.ts \
  src/agents/embedded-agent-runner/run/lane-controller.lifecycle.test.ts \
  src/agents/embedded-agent-runner/run/retry-limit.test.ts \
  src/agents/embedded-agent-runner/run/runtime-resolution.test.ts

unit-fast:                             3 files, 12 passed
agents-embedded-agent:                 2 files, 28 passed
agents-embedded-agent-overflow:        1 file,   4 passed
agents-embedded-agent-run:             1 file,   7 passed
agents-support:                        1 file,   7 passed
[test] passed 5 Vitest shards in 33.22s

The linked full CI run independently exercised the complete compact matrix. Direct sibling Codex source inspection is recorded in the preceding maintainer-proof comment.

@steipete
steipete merged commit 3f85a78 into main Aug 3, 2026
192 of 196 checks passed
@steipete
steipete deleted the codex/test-perf-compact-large-3-next branch August 3, 2026 02:08
@steipete

steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 3, 2026
* origin/main:
  refactor(agents): centralize terminal lifecycle outcomes (#118254)
  fix(scripts): warm gateway concurrency probes (#118364)
  test(discord): consolidate activity HTTP fixtures (#118314)
  fix(qa): restore prerelease validation (#118255)
  improve(tests): focus overflow compaction owner coverage (#118351)
  test(telegram): deduplicate dispatch fixtures (#118319)
  test(xai): consolidate realtime voice fixtures (#118318)
  fix(telegram): prevent durable ingress lane spins (#118357)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
…8351)

* test(agents): focus overflow compaction owner coverage

* test(agents): import run registry owners directly

* test(agents): remove retired overflow fixtures

---------

Co-authored-by: Peter Steinberger <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 3, 2026
Block 5 of the openclaw#129388 presentation cut: auth-profile tests and fixes that
travel under a continuation- prefix but carry no continuation behavior.
Home: its own PR. Upstream deliberately retired 23 of these 25 tests from
run.overflow-compaction.test.ts in openclaw#118351 (3f85a78), so that PR should
argue for them again rather than restore them silently.

Removed:
- run.continuation-auth-overlay and run.continuation-codex-auth-{bootstrap,
  forwarding,rotation,selection} test-supports. None of them calls
  continue_work, continue_delegate or request_compaction.
- auth-store.ts stale-key gate, its test and the run-attempt-dispatch wiring
  (2fe39db, e6fb763). These are restored to upstream bytes, and the
  auth-profile store resolves after admission again, as upstream does.
- external-cli-auth-selection.ts isBuiltInClaudeCliProfile bypass
  (2fe39db), restored to upstream bytes.
- status-codex-auth-profile.ts, a byte-equivalent extraction of upstream's
  resolveCodexSyntheticUsageAuthProfileId. The function is inlined back at
  upstream's position, and status-text.ts stays under the line cap.
- Harness exports used only by the removed suites (back to upstream bytes),
  plus the fixture's queueOpenAIResolvedModel and waitForRunEvent.

What stayed: every continuation hunk in status-text.ts, run-attempt-dispatch.ts
and the harness.

Forced fix: the deferred-maintenance scenario waited for session A with a
bounded setImmediate poll. It passed only because the removed auth suites ran
first and warmed the module graph. It fails on the unmodified tree when run
alone (-t 'deferred maintenance'). It now waits on a signal from the mocked
maintenance wait and fails fast if session A ends first.

Refs #1418

Co-Authored-By: Claude Opus 5.5 <[email protected]>
scribe-dandelion-cult added a commit to karmaterminal/openclaw that referenced this pull request Oct 3, 2026
Block 5 follow-up for the openclaw#129388 presentation cut. The remaining
run.continuation-* test-supports bundled 27 runEmbeddedAgent cases. 24 of them
are upstream tests from run.overflow-compaction.test.ts that upstream
deliberately retired in openclaw#118351 (3f85a78). Each one was confirmed by
grepping its name in `git show 3f85a78^:src/agents/embedded-agent-runner/
run.overflow-compaction.test.ts`. That makes them drift residue. Home:
restored to upstream (retired).

Removed, all present in 3f85a78^ and none exercising continuation:
- deferred-maintenance (2): same-session wait; global lane not held.
- lifecycle-admission (2): captured lifecycle generation; reserved harness
  ownership revalidated after the queue wait.
- model-routing (9): hook-selected models; Ultra revalidation; auth profile
  into attempts; optional attempt params; non-empty and empty request stream
  params; Ultra logical/max; session-pinned native model; undersized models.
- overflow-recovery (8): implicit Codex overflow; prompt-cache runtime
  context; preflight empty transcript; Codex promptError blocked payload;
  truncation budget; rotated compacted transcript; thrown engine-owned
  compaction; composed abort signal.
- retry-fallback (2 upstream): retry_limit; abort-wrapped prompt errors.
- retry-fallback (1 fork-added, 2273ef6): "terminates without replay
  after side effects invalidate the attempt". This is the fork's rewrite of
  upstream's retired "preserves replay invalidation when retries exhaust after
  side effects" (3f85a78^, same fixture), with no continuation content.

Kept (overflow-recovery, 3 cases): they pin the continuation-owned recovery
context-pressure path (recovery-context-pressure.ts ->
auto-reply/continuation/context-pressure):
- "passes trigger=overflow ..." (upstream name, extended by the fork with
  continuation config and [system:context-pressure] assertions)
- "does not enqueue overflow pressure guidance when continuation is disabled"
- "uses the canonical session identity when sessionKey is empty on overflow
  path"

Plumbing: run.overflow-compaction.harness.ts is restored to upstream bytes,
except that mockedLog and resetRunOverflowCompactionHarnessMocks are exported
for the kept cases and run.continuation-opts-forward.test.ts. Removed: the
logicalRef wrapper, the other mock exports, and the line-cap extraction
run.overflow-compaction.context-engine.test-support.ts. The continuation
fixture is reduced to the three record/log assertions the kept cases use.

Refs #1418

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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.

1 participant