Skip to content

fix(qwen): prevent elapsed-time flakes in video generation tests - #150523

Merged
steipete merged 1 commit into
mainfrom
upd/flake-qwen-video-timeout-equality
Sep 17, 2026
Merged

steipete merged 1 commit into
mainfrom
upd/flake-qwen-video-timeout-equality

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #117781 and #150427.

What Problem This Solves

Fixes the flaky Qwen Wan generation test when request preparation consumes part of the default timeout, as seen in the extensions-bundle-11 failure on #150427.

User Impact

No user-visible behavior changes. The shared 120,000 ms deadline continues to cover submission, polling, and download.

Why This Change Was Made

#117781 correctly applied the operation deadline to requests using the default timeout. The existing test still expected the entire budget at submission, so a single elapsed millisecond made it fail.

Bound the submission timeout by observed elapsed time, force the clock to advance so the regression is deterministic, and verify that exhausting the default budget prevents polling. All other request, polling, and result assertions remain intact. Production code is unchanged.

Evidence

  • Baseline on 388584f9d9f27d466b6ba793b132b3a0353d3baa: 4/10 normal runs and 3/7 completed shard runs failed with expected 119999 to be 120000.
  • With the controlled clock and old equality: 1 failed, 27 passed, reproducing the same assertion deterministically. With the fix: all 125 focused tests passed across Qwen, DashScope lifecycle, and the shared HTTP deadline owner.
  • Qwen: 20/20 shard invocations passed, with all 28 Qwen cases passing each time (560 passing test executions). Each invocation used the original provider config, --shard=4/4, and two workers: 71 files and 1,297 tests, on macOS with Node 26.8.2.
  • Full shards: 17/20 green. Runs 1, 3, and 4 failed only the unchanged Google test “retries when a pending response callback reaches the Gemini first-response deadline.” It failed before Qwen ran, with file isolation enabled. Its 5-second safety timer appears to race recovery under load: failing durations were 6.3–7.1 seconds; the exact abort reason was not logged. All 20 invocations ran once with the full composition.
  • Fresh Codex review with --mode branch --base origin/main --max-priority P1: scoped-clean, no actionable P0/P1 findings.
  • Changed checks passed except the documented nested-checkout extension-lint preparation error. Direct lint rejected an unused-variable canary with exit 1 and passed the restored real file with exit 0. Extension test typechecking and all other changed gates passed.
CANARY exit 1: eslint(no-unused-vars): 'l519LintCanary' is declared but never used.
RESTORED REAL FILE exit 0
  • LOC: production +0/-0; tests +66/-26 (net +40).

@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 17, 2026 02:44
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Sep 17, 2026
@clawsweeper

clawsweeper Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 11:02 PM ET / September 17, 2026, 03:02 UTC (Revision 2).

ClawSweeper review

What this changes

The PR makes Qwen video-generation tests account for elapsed preparation time and adds coverage that an exhausted default timeout prevents polling.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused test repair: current main retains the incorrect exact-timeout assertion. No actionable correctness or security defects were found, and the maintainer-owned PR is protected from automatic closure.

Priority: P3
Reviewed head: 5daddf1265959e39a7fd399e40aa1827c20fa77b

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, maintainable test repair with meaningful deterministic coverage and substantial reported repeat-run validation.
Proof confidence 🌊 off-meta tidepool Not applicable: The maintainer-authored PR changes only tests and has no authority change; the external-contributor runtime-proof gate does not apply. Reported focused and repeated shard runs directly address test reliability but do not establish live provider behavior.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The maintainer-authored PR changes only tests and has no authority change; the external-contributor runtime-proof gate does not apply. Reported focused and repeated shard runs directly address test reliability but do not establish live provider behavior.
Evidence reviewed 7 items Current main still needs the assertion repair: Fetched main still requires submission timeoutMs to equal 120000, although preparation can consume part of the operation budget.
Production deadline contract: The shared task owner establishes the deadline before preparing submission and passes its remaining budget to postJsonRequest. The timeout resolver subtracts Date.now() and throws when the budget is exhausted; the production owner is unchanged between the reviewed head and fetched main.
Introduced tests preserve meaningful behavior: The success case advances Date.now deterministically, bounds the submission timeout by measured elapsed time, and preserves request, polling, and result assertions. The additional case expires the budget during submission release and verifies no guarded polling request occurs. Both clock spies restore in finally blocks.
Findings None None.
Security None None.

How this fits together

Qwen’s video plugin passes generation requests to OpenClaw’s shared DashScope implementation, which submits a task, polls its status, and downloads the video under one operation deadline. These tests exercise that plugin boundary with mocked HTTP transport.

flowchart LR
  A[Prompt and reference images] --> B[Qwen video plugin]
  B --> C[Shared operation deadline]
  C --> D[Submit generation task]
  D --> E{Budget remains?}
  E -->|Yes| F[Poll and download video]
  E -->|No| G[Timeout error]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +40. Total +40 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 66 26 +40
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 66 26 +40

Review metrics

None.

Technical review

Best possible solution:

Keep deadline enforcement in the shared runtime owner and make plugin tests validate the remaining budget without depending on wall-clock scheduling.

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

Yes: advancing the clock between deadline creation and submission makes current main’s exact 120000 assertion fail. Source supports the reported deterministic reproduction; this read-only review did not run tests.

Is this the best way to solve the issue?

Yes: the bounded assertion matches the shared deadline contract, while the expiry case checks the real plugin entrypoint and preserves production behavior.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9ca2d1dfcd16.

Labels

Label justifications:

  • P3: This repairs an internal test flake without changing production behavior or user settings.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The maintainer-authored PR changes only tests and has no authority change; the external-contributor runtime-proof gate does not apply. Reported focused and repeated shard runs directly address test reliability but do not establish live provider behavior.

Evidence

What I checked:

  • Current main still needs the assertion repair: Fetched main still requires submission timeoutMs to equal 120000, although preparation can consume part of the operation budget. (extensions/qwen/video-generation-provider.test.ts:74, 9ca2d1dfcd16)
  • Production deadline contract: The shared task owner establishes the deadline before preparing submission and passes its remaining budget to postJsonRequest. The timeout resolver subtracts Date.now() and throws when the budget is exhausted; the production owner is unchanged between the reviewed head and fetched main. (src/media-understanding/shared.ts:141, 5daddf126595)
  • Introduced tests preserve meaningful behavior: The success case advances Date.now deterministically, bounds the submission timeout by measured elapsed time, and preserves request, polling, and result assertions. The additional case expires the budget during submission release and verifies no guarded polling request occurs. Both clock spies restore in finally blocks. (extensions/qwen/video-generation-provider.test.ts:241, 5daddf126595)
  • Related merged work establishes intent: The supplied GitHub record confirms fix(video): enforce one deadline across DashScope generation #117781 merged the shared operation deadline and explicitly retained the 120-second default. That runtime repair does not replace this remaining test correction. (src/video-generation/dashscope-compatible.ts:579, b89afd2b2bcb)
  • Latest release comparison: The supplied latest release, v2026.9.4, also contains the exact 120000 assertion; it does not contain this test repair. (extensions/qwen/video-generation-provider.test.ts:74, 3a9d69db306c)
  • Captured validation and review continuity: The complete supplied body reports deterministic failure with the old equality, 125 focused passing tests, and 20/20 Qwen shard invocations passing. It separately records three full-shard failures in an unchanged Google test. The prior completed ClawSweeper review contains no findings or published rank-up moves. Its earlier head was unavailable locally, so no patch-equivalence claim is made.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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-09-17T02:51:35.383Z sha 7f7bc9a09589e0292d74b019037e518fc5d20465 :: needs maintainer review before merge. :: none

Follow #117781's shared operation deadline in the Qwen submission assertion.
Bound the request timeout by observed elapsed time and force a clock tick
so the former 119999-versus-120000 failure reproduces deterministically.
Verify that exhausting the default budget prevents polling. Preserve the
other request and result assertions without changing production behavior.

Failing job: https://github.com/openclaw/openclaw/actions/runs/35170534804/job/105041242550
@steipete
steipete force-pushed the upd/flake-qwen-video-timeout-equality branch from 7f7bc9a to 5daddf1 Compare September 17, 2026 02:55
@steipete
steipete merged commit 26d2daa into main Sep 17, 2026
91 checks passed
@steipete
steipete deleted the upd/flake-qwen-video-timeout-equality branch September 17, 2026 03:16
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

fuller-stack-dev added a commit to 849261680/openclaw that referenced this pull request Sep 17, 2026
Use the current-main Qwen fixture from openclaw#150523 and openclaw#82290 unchanged. Remove the final temporary prerequisite delta while preserving the eleven-file alias repair and original contributor history.
fuller-stack-dev added a commit that referenced this pull request Sep 17, 2026
* fix(plugin-runtime): restore channel turn alias

* test(plugin-sdk): type channel turn alias override

* fix(plugin-sdk): preserve legacy turn mock overrides

* test(plugin-sdk): refresh channel turn alias gates

* Align legacy channel compatibility paths for current-main repair

Preserve the original contributor ancestry while resolving stale paths before the current-source alias repair. Intermediate branch preparation; not acceptance evidence.

* fix: preserve complete legacy channel runtime alias

Restore the complete five-member alias, including exact runtime-bound dispatch and scoped context construction. Preserve lazy loading, generic signatures and canonical override precedence. Keep deprecated compatibility metadata and current documentation aligned.

Closes #91122

Co-authored-by: Yzx <[email protected]>

* fix(ci): integrate canonical channel alias prerequisites

Consume the reviewed file-preview lazy-English extraction from #150424,
the cold worktree input closure, and the Qwen initial-deadline fixture
from #150026. Native manifest closure is now also present on main via
#150453. Keep the original channel alias implementation and accepted
built-runtime proof unchanged.

Co-authored-by: Peter Steinberger <[email protected]>

* fix(ci): consume landed canonical UI startup repair

Replace the temporary file-preview extraction with the current-main implementation from #150491 before merging main. Preserve the channel alias repair and existing contributor ancestry.

Co-authored-by: Peter Steinberger <[email protected]>

* fix(ci): consume landed canonical Qwen fixture

Use the current-main Qwen fixture from #150523 and #82290 unchanged. Remove the final temporary prerequisite delta while preserving the eleven-file alias repair and original contributor history.

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Yzx <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
Follow openclaw#117781's shared operation deadline in the Qwen submission assertion.
Bound the request timeout by observed elapsed time and force a clock tick
so the former 119999-versus-120000 failure reproduces deterministically.
Verify that exhausting the default budget prevents polling. Preserve the
other request and result assertions without changing production behavior.

Failing job: https://github.com/openclaw/openclaw/actions/runs/35170534804/job/105041242550
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
* fix(plugin-runtime): restore channel turn alias

* test(plugin-sdk): type channel turn alias override

* fix(plugin-sdk): preserve legacy turn mock overrides

* test(plugin-sdk): refresh channel turn alias gates

* Align legacy channel compatibility paths for current-main repair

Preserve the original contributor ancestry while resolving stale paths before the current-source alias repair. Intermediate branch preparation; not acceptance evidence.

* fix: preserve complete legacy channel runtime alias

Restore the complete five-member alias, including exact runtime-bound dispatch and scoped context construction. Preserve lazy loading, generic signatures and canonical override precedence. Keep deprecated compatibility metadata and current documentation aligned.

Closes openclaw#91122

Co-authored-by: Yzx <[email protected]>

* fix(ci): integrate canonical channel alias prerequisites

Consume the reviewed file-preview lazy-English extraction from openclaw#150424,
the cold worktree input closure, and the Qwen initial-deadline fixture
from openclaw#150026. Native manifest closure is now also present on main via
openclaw#150453. Keep the original channel alias implementation and accepted
built-runtime proof unchanged.

Co-authored-by: Peter Steinberger <[email protected]>

* fix(ci): consume landed canonical UI startup repair

Replace the temporary file-preview extraction with the current-main implementation from openclaw#150491 before merging main. Preserve the channel alias repair and existing contributor ancestry.

Co-authored-by: Peter Steinberger <[email protected]>

* fix(ci): consume landed canonical Qwen fixture

Use the current-main Qwen fixture from openclaw#150523 and openclaw#82290 unchanged. Remove the final temporary prerequisite delta while preserving the eleven-file alias repair and original contributor history.

---------

Co-authored-by: Jason (Json) <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Co-authored-by: Yzx <[email protected]>
steipete added a commit that referenced this pull request Sep 17, 2026
…50663)

Fix flaky Google pending-response callback coverage when a loaded worker spends long enough in transport setup for the fixture's parent safety abort to fire first. Parent cancellation correctly suppresses deadline recovery, so that competing timer could make the test fail despite correct runtime behavior.

Wait for callback entry and advance fake time across the existing first-response deadline. Preserve cancellation, retry, callback-count and recovered-content checks, and assert a successful stop. Production behavior, timeout settings and configuration are unchanged; the one existing test changes by +24/-24 lines.

Related: #150523

Validation: exact-head CI run 35193375763 passed; the validated test bytes are unchanged. The PR records 20/20 Google deadline passes, a controlled setup-delay reproduction and a deadline mutation failure. Codex autoreview and the exact-head ClawSweeper review found no actionable issues.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 18, 2026
…enclaw#150663)

Fix flaky Google pending-response callback coverage when a loaded worker spends long enough in transport setup for the fixture's parent safety abort to fire first. Parent cancellation correctly suppresses deadline recovery, so that competing timer could make the test fail despite correct runtime behavior.

Wait for callback entry and advance fake time across the existing first-response deadline. Preserve cancellation, retry, callback-count and recovered-content checks, and assert a successful stop. Production behavior, timeout settings and configuration are unchanged; the one existing test changes by +24/-24 lines.

Related: openclaw#150523

Validation: exact-head CI run 35193375763 passed; the validated test bytes are unchanged. The PR records 20/20 Google deadline passes, a controlled setup-delay reproduction and a deadline mutation failure. Codex autoreview and the exact-head ClawSweeper review found no actionable issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: qwen maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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