Skip to content

fix(media): make transcode pool saturation test deterministic - #122279

Merged
steipete merged 1 commit into
mainfrom
codex/fix-media-pool-retry-flake
Aug 11, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/fix-media-pool-retry-flake

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a timing-dependent media test failure where the saturated playback transcode pool test could observe only two mocked ffmpeg calls after releasing one mock. Releasing ffmpeg does not release pool capacity: output validation and cache persistence still have to settle first.

Why This Change Was Made

The pool now retains its authoritative job promises instead of boolean occupancy markers. Test support can observe the same settlement boundary used by pool admission, while deferred mock-start signals preserve the exact two-job capacity and three-job scheduling assertions without wall-clock polling.

The wait is order-independent because the two initial transcodes legitimately race; it observes the next pool completion and then all remaining jobs rather than assuming the first mock finisher belongs to a particular source.

User Impact

No user-visible runtime behavior changes. CI no longer depends on output validation and cache persistence finishing inside Vitest's one-second polling window.

Evidence

  • Deterministic before/after proof: injecting a 1.25-second post-ffmpeg validation delay made the old test fail with expected 3 calls, got 2; the repaired test passed under the identical delay.
  • src/media/playback-transcode.test.ts: 27/27 passed.
  • Saturation test: 25 independent process runs passed after the final order-independent synchronization fix.
  • Targeted Oxfmt, diff check, and Oxlint passed.
  • Blacksmith Testbox changed gate passed on frozen base 2f071c9371bdf7b7163660fc58361edc42db6154: https://github.com/openclaw/openclaw/actions/runs/31537040507
  • Autoreview: clean, no accepted/actionable findings (confidence 0.98).

Production LOC: +7/-4 (net +3) | Tests/test support: +31/-15

Root cause and owner: resolvePlaybackTranscode owns capacity through the complete transcode promise, but the test synchronized only on the inner mocked ffmpeg promise. Recording the owner promise makes pool occupancy and test observation share one lifecycle fact.

Provenance: the original saturation test and pool behavior were introduced together in #115987 (4229e96e0ec3394ab9d154d09992d825c64d8685, authored and merged by @steipete on 2026-07-29). The timing gap became visible under loaded exact-head CI; no runtime regression was introduced by the Android PR whose gate exposed it.

Best-fix verdict: best. Increasing the timeout, retrying the test, or weakening the third-call assertion would retain the wrong synchronization boundary. Automatically queueing saturated requests would change runtime behavior unnecessarily.

ClawSweeper is waived for this repair per the standing deployment request.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 11, 2026
@steipete
steipete merged commit 9a8a65b into main Aug 11, 2026
286 of 290 checks passed
@steipete
steipete deleted the codex/fix-media-pool-retry-flake branch August 11, 2026 22:20
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete

Copy link
Copy Markdown
Contributor Author

Post-merge manual full-gate note (informational): run 31537799228 targeted exact source head 00ad7c11e1f7dcaa9f8cdb22c640dd391910448c. It did not replace the normal exact-head openclaw/ci-gate, which completed successfully and was accepted by scripts/pr prepare-run.

  • check-lint was canceled by runner shutdown: the log reports a shutdown signal, oxlint exit 143, and “The operation was canceled.” Targeted local lint and the Blacksmith Testbox changed gate passed.
  • macos-swift failed in the OpenClawKit tests step. This PR changed only TypeScript media runtime/test-support files; the exact normal PR gate, focused media proof, Testbox gate, and autoreview were green.
  • The manual run remained open after merge solely on unrelated ios-build screenshot capture; no additional repair was attributed to this PR.

vincentkoc added a commit that referenced this pull request Aug 11, 2026
* origin/main: (1725 commits)
  fix(agents): preserve reply cleanup when cancellation throws (#122252)
  fix(ui): render disallowed link schemes as plain text (#122311)
  fix(test): isolate gateway helper env stubs (#122319)
  fix(ui): keep chat Markdown block rhythm consistent (#122289)
  test(cli): trim duplicate Hooks process cases (#122278)
  fix(ui): retain identity while agent roster loads
  fix(ui): preserve configured agent labels
  fix(plugins): keep startup convergence read-only (#122330)
  fix: preserve WebChat reply context after reloads (#122169)
  fix(ui): make DONE moves visibly reversible (#122303)
  fix(ui): keep inline-code punctuation attached (#122291)
  fix(google-meet): publish exports atomically (#122306)
  fix(channels): preserve failed agent run reactions (#122009)
  fix(ui): label patch file operations accurately (#122287)
  fix(windows): preserve Unicode LAN route aliases (#122263)
  test(media): synchronize transcode pool completion (#122279)
  fix(android): keep completed subagent activity visible for sixty seconds (#122089)
  fix(ui): humanize bare GitHub item links (#122285)
  refactor(qqbot): install plugin from Tencent package (#107295)
  chore: scope SQLite session lifecycle CI (#121917)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 12, 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: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant