Skip to content

test(agents): replace broad overflow loop coverage - #118184

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

steipete merged 2 commits into
mainfrom
codex/test-perf-compact-large-1

Conversation

@steipete

@steipete steipete commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace the broad runEmbeddedAgent overflow loop harness with direct tests at the extracted owners for recovery, prompt persistence, normalization/replay state, timeout payloads, auth bookkeeping, and thinking policy
  • retain a narrow top-level dispatch/replay spine for caller-owned session-manager and unsafe-state forwarding
  • remove four duplicate/redundant compositions whose behavior remains covered by existing successful/rotated recovery, usage reporting, and preassembly owner tests

No production code, test configuration, worker count, or CI sharding changes.

Performance

  • old broad file: 39/39 tests, 336.59s wall, 328.17s test bodies, 3.24GB max RSS
  • reviewed-head focused bundle: 35/35 tests, 5.91s Vitest duration, 247ms test bodies, 1.14GB max RSS
  • focused Vitest reduction: about 98%; peak RSS reduction: about 65%
  • CI baseline for the old file: 174.58s inside a 331.33s shard

Coverage

  • overflow policy branches: run.overflow-context-recovery.test.ts
  • prompt persistence and retry suppression: run.session-prompt-state.test.ts
  • handled preflight and monotonic replay state: run.attempt-normalization.direct.test.ts
  • timeout/media terminal payloads: run.terminal-timeout.test.ts
  • thinking policy, auth bookkeeping, and delivery ownership: run.overflow-compaction.misc-owners.test.ts
  • caller session-manager and exact unsafe replay forwarding: retained top-level loop suite

Proof

  • inspectable focused terminal proof: 6 files, 35/35 tests, duration and RSS on reviewed head
  • exact-head full CI: green
  • targeted oxfmt, oxlint, max-lines ratchet, touched test types, and git diff --check passed
  • autoreview clean with no accepted/actionable findings

Test-only change; no changelog entry.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Aug 2, 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 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 5:42 PM ET / 21:42 UTC.

ClawSweeper review

What this changes

This PR replaces a slow broad embedded-agent overflow-loop suite with focused tests for recovery, prompt persistence, normalization, timeout handling, and small runtime policies, while retaining a narrow dispatch-and-replay test.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep this PR open for normal maintainer acceptance. The focused tests exercise the production owners that the loop delegates to, retain one dispatch/replay integration test, and current main has not changed the touched owner paths since the PR base; no actionable patch defect was found.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, owner-aligned test refactor with direct terminal evidence and green exact-head CI; only protected-label maintainer acceptance remains.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The PR includes an inspectable reviewed-head terminal run of the six focused files with 35 passing tests and links exact-head green CI; this directly demonstrates the test-only change after the split.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR includes an inspectable reviewed-head terminal run of the six focused files with 35 passing tests and links exact-head green CI; this directly demonstrates the test-only change after the split.
Evidence reviewed 6 items Production ownership path: The run loop normalizes each dispatched attempt, and attempt recovery calls the dedicated overflow-recovery owner before returning retry or terminal behavior; the split tests target those same owners rather than a test-only copy.
Retained orchestration coverage: The PR retains a top-level dispatch test for caller-owned session-manager forwarding and unsafe replay state, the two facts that cross the remaining dispatch boundary.
Focused recovery coverage: The new recovery suite directly covers assistant-error and zero-output overflow classification, truncation and compaction fallbacks, retry caps, transcript continuation, and owns-compaction behavior.
Findings None None.
Security None None.

How this fits together

The embedded agent runner converts a prepared session prompt into model attempts, then applies overflow recovery, replay safety, delivery state, and terminal-result policies. This change moves tests from the expensive top-level loop to those production owner modules while preserving a small orchestration check.

flowchart LR
  A[Prepared session prompt] --> B[Embedded agent run loop]
  B --> C[Attempt normalization]
  B --> D[Overflow recovery]
  C --> E[Replay and terminal resolution]
  D --> E
  E --> F[Delivery and session outcome]
  G[Focused owner tests] --> C
  G --> D
Loading

Decision needed

Question Recommendation
Does the agent-runner owner approve this protected, test-only coverage split as the intended long-term boundary between helper tests and the expensive top-level loop? Approve the focused split: Accept the direct owner tests and retained orchestration spine as the canonical coverage shape for this overflow path.

Why: The maintainer label requires explicit human handling even though the review found no discrete correctness defect.

Before merge

None.

Agent review details

Security

None.

PR surface

Tests -139, Other -1. Total -140 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 6 1233 1372 -139
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 7 1233 1373 -140

Review metrics

None.

Stored data model

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

Technical review

Best possible solution:

Keep the direct owner-level suites plus the retained dispatch/replay spine, preserving the slow full-runner path only for behavior that cannot be proven at an extracted production owner.

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

Not applicable: this PR changes test structure and test cost, not a reported user-facing failure. The changed behavior is supported by an inspectable reviewed-head focused-suite transcript and exact-head CI evidence.

Is this the best way to solve the issue?

Yes. The split follows the scoped embedded-runner guidance: test production helper owners directly and retain full-runner coverage only for the caller-owned dispatch and replay facts that cross components.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR includes an inspectable reviewed-head terminal run of the six focused files with 35 passing tests and links exact-head green CI; this directly demonstrates the test-only change after the split.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR includes an inspectable reviewed-head terminal run of the six focused files with 35 passing tests and links exact-head green CI; this directly demonstrates the test-only change after the split.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is test-only performance and maintainability work with no production behavior or configuration change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR includes an inspectable reviewed-head terminal run of the six focused files with 35 passing tests and links exact-head green CI; this directly demonstrates the test-only change after the split.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR includes an inspectable reviewed-head terminal run of the six focused files with 35 passing tests and links exact-head green CI; this directly demonstrates the test-only change after the split.

Evidence

What I checked:

Likely related people:

  • steipete: Peter Steinberger authored the PR and the recent current-main commit that introduced the extracted recovery, normalization, and prompt-state owner surface used by this test split. (role: recent agent-runner contributor; confidence: high; commits: 1e10c444748a, cc8cc86dbd3b; files: src/agents/embedded-agent-runner/run-loop.ts, src/agents/embedded-agent-runner/run/attempt-recovery.ts, src/agents/embedded-agent-runner/run/overflow-context-recovery.ts)

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 (2 earlier review cycles)
  • reviewed 2026-08-02T20:39:34.587Z sha f287ad5 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T21:02:40.021Z sha cc8cc86 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 2, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Focused after-fix terminal proof on reviewed head cc8cc86dbd3b3c36e71f47e8a3e24b00732e5bad:

$ /usr/bin/time -l node scripts/run-vitest.mjs \
  src/agents/embedded-agent-runner/run.overflow-compaction.loop.test.ts \
  src/agents/embedded-agent-runner/run.attempt-normalization.direct.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.session-prompt-state.test.ts \
  src/agents/embedded-agent-runner/run.terminal-timeout.test.ts

Test Files  6 passed (6)
     Tests  35 passed (35)
  Duration  5.91s (transform 3.22s, setup 316ms, import 5.23s, tests 247ms, environment 0ms)

[test] passed 1 Vitest shard in 9.24s
       9.38 real
 1142079488 maximum resident set size

The exact-head full CI matrix is also green; compact-large-1 finished successfully in run 30766797358.

@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Inspectable reviewed-head terminal proof and the exact-head CI link are now attached and linked from the PR body.

@clawsweeper

clawsweeper Bot commented Aug 2, 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 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: 🧂 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. labels Aug 2, 2026
@steipete
steipete merged commit a6ad60a into main Aug 2, 2026
134 of 143 checks passed
@steipete
steipete deleted the codex/test-perf-compact-large-1 branch August 2, 2026 21:44
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
* test(agents): replace broad overflow loop coverage

* test(agents): satisfy overflow suite checks

---------

Co-authored-by: Peter Steinberger <[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. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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