Skip to content

fix(infra): stop post-test ENOENT in session-cost checks - #102704

Merged
steipete merged 1 commit into
mainfrom
codex/fix-session-cost-stream-enoent
Jul 9, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-session-cost-stream-enoent

Conversation

@steipete

@steipete steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Related: #101062
Related: #102082

What Problem This Solves

Fixes an issue where unrelated pull requests could fail the checks-node-compact-small-5 shard after all tests passed because the session-cost stream-error regression test left a real file stream opening while its temporary directory was removed.

Why This Change Was Made

Replace both mocked real file streams with in-memory PassThrough streams that provide partial input and then fail through destroy(error). This follows the Node stream lifecycle contract, removes the pending file-open race, and leaves production session-cost behavior unchanged.

The first stabilization pattern was contributed by Agent Jack in #102082 commit 926a6eb205; this focused change preserves that credit and applies the same correction to the adjacent durable-cache regression test.

User Impact

No runtime behavior changes. CI no longer intermittently reports a post-test ENOENT from this regression test, and both best-effort and strict cache stream-error paths retain deterministic coverage.

Evidence

  • Before: run 29010470619, attempt 1, job 86092626040 passed all 229 tests, then Vitest reported the deleted transcript path as an unhandled ENOENT.
  • Prior-art CI: after the same in-memory-stream correction for the first test, run 28968876538, job 85959205112 passed checks-node-compact-small-5.
  • Blacksmith Testbox tbx_01kx381mq54s3atqr7pm7ayv6m: focused test repeated 25 times successfully.
  • Blacksmith Testbox: pnpm test src/infra/session-cost-usage.stream-errors.test.ts src/infra/session-cost-usage.test.ts -> 2 files, 70 tests passed.
  • Blacksmith Testbox: path-scoped pnpm check:changed -> core-test typecheck, lint, and repository guards passed.
  • oxfmt --check src/infra/session-cost-usage.stream-errors.test.ts and git diff --check passed.
  • Fresh Codex autoreview: no accepted/actionable findings.

AI-assisted with Codex; implementation, failure provenance, upstream stream contract, and validation reviewed by the maintainer.

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Jul 9, 2026
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Land-ready on exact head b29af1a119c3911fc11c8f2f9018652ad1871421.

Proof completed:

  • Blacksmith Testbox tbx_01kx381mq54s3atqr7pm7ayv6m: pnpm test src/infra/session-cost-usage.stream-errors.test.ts repeated 25 times; all passed.
  • Blacksmith Testbox: pnpm test src/infra/session-cost-usage.stream-errors.test.ts src/infra/session-cost-usage.test.ts -> 2 files, 70 tests passed.
  • Blacksmith Testbox: path-scoped pnpm check:changed -- src/infra/session-cost-usage.stream-errors.test.ts -> repository guards, core-test tsgo typecheck, and oxlint passed.
  • oxfmt --check src/infra/session-cost-usage.stream-errors.test.ts and git diff --check passed.
  • Fresh Codex autoreview reported no accepted/actionable findings.
  • Exact-head CI run 29013839922 passed, including the formerly flaky checks-node-compact-small-5 job 86103830394.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 102704 passed the hosted exact-head gates.

No proof gaps. Test-only change; no production or user-visible runtime behavior changed.

@steipete
steipete merged commit 09a6b5e into main Jul 9, 2026
113 of 115 checks passed
@steipete
steipete deleted the codex/fix-session-cost-stream-enoent branch July 9, 2026 11:15
@steipete

steipete commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant