fix(video): skip delivering tasks in active-task prompt guard#96018
Conversation
faeac9b to
e334d55
Compare
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 8:35 AM ET / 12:35 UTC. Summary PR surface: Source +16, Tests +126. Total +142 across 5 files. Reproducibility: yes. The linked production report plus current source show a generated media task remains running while wakeTaskCompletion awaits the requester turn, and the session prompt/tool guards can still see that active task; I did not run a live provider reproduction. Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this narrow progress-marker prompt-guard fix after redacted sequential video_generate proof or an explicit maintainer proof waiver; keep the broader status-machine sibling non-canonical unless maintainers choose that design. Do we have a high-confidence way to reproduce the issue? Yes. The linked production report plus current source show a generated media task remains running while wakeTaskCompletion awaits the requester turn, and the session prompt/tool guards can still see that active task; I did not run a live provider reproduction. Is this the best way to solve the issue? Yes, subject to proof. The narrow progress-marker approach avoids a persisted task-status/schema change while preserving completion-delivery closeout and same-prompt duplicate protection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e4763b0631bf. Label changesLabel justifications:
Evidence reviewedPR surface: Source +16, Tests +126. Total +142 across 5 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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. How this review workflow works
|
e334d55 to
0ce6805
Compare
|
maintainer refresh on current The narrower existing PR remains the canonical fix for #95701. I refreshed the The fix keeps the existing task status schema and completion-delivery ordering: Validation:
|
0ce6805 to
1898652
Compare
|
rebased again because
The fix still preserves the existing task status schema and same-prompt |
1898652 to
e1a5228
Compare
|
final base refresh: The branch is rebased cleanly at |
e1a5228 to
8b7d479
Compare
|
rebased onto current |
8b7d479 to
8b23552
Compare
|
Maintainer update: rebased the focused fix onto current Fresh proof on the rebased head:
The fix remains scoped to delivery-phase prompt guards and prompt-aware duplicate guards. Hosted checks are being rerun on the rebased head before guarded landing. |
Dependency graph guard clearedThis PR no longer has blocked dependency graph changes. A future dependency graph change requires a fresh
|
|
Maintainer update: the merge guard caught a stale PR parent after The PR diff is back to the intended five files; the earlier dependency-guard failure came from inherited mainline drift in the stale parent, not from this fix. Fresh hosted checks are running for the corrected exact head before merge. |
|
Maintainer update: Fresh exact-head hosted checks are running before the merge retry. |
|
Maintainer update: the final merge guard identified one newly landed merge-critical file ( Fresh exact-head hosted checks are running before the final merge retry. |
|
Merged via squash.
Thanks @palomyates516-alt! |
Fixes #95701.
What Problem This Solves
Sequential
video_generateworkflows blocked the next segment for ~4-5 min after each clip's video was ready. The active-task prompt guard treated the still-runningtask as blocking until the completion wake finished (self-deadlock), so crews producing clips 01, 02, 03 back-to-back paid a ~3.5-4 min "release tax" per segment on top of actual generation (~60-90s). The task only flippedrunning -> succeededafter the woken agent turn gave up and yielded.Evidence
state/openclaw.sqlitetask_runsfor one session - taskc6043e3fran 12:54:07 -> 12:59:25 (5m18s) with providerbyteplus/doubao-seedance, where actual generation+download is ~60-90s. The requester trajectory shows the woken turn (12:54:35 -> 12:59:23, 4m48s) reporting "stale state machine, 5 retries intercepted", and the task flips tosucceededonly at 12:59:25 - after the woken turn ended, not when the video was ready.a182811070):scheduleMediaGenerationTaskCompletion(src/agents/tools/media-generate-background-shared.ts:382) gatescompleteTaskRun(:487) behindwakeTaskCompletion(expectFinal:true)(:431); the label-less prompt guard (buildActiveMediaGenerationTaskPromptContextForSessionatmedia-generation-task-status-shared.ts:447) suppresses the next segment'svideo_generatewhile the task is stillrunning.listActiveexcludes delivering tasks when the flag is set;buildActivereturns no prompt when the only active task is delivering, still warns when mid-generation; existing video/image generation suites unchanged.Fix
media-generate-background-shared.ts:418since the wake gatescompleteTaskRun) into a shared constantMEDIA_GENERATION_DELIVERING_COMPLETION_PROGRESS.listActiveMediaGenerationTasksForSession/findActiveMediaGenerationTaskForSessiongain an optionalexcludeDeliveringCompletionflag; the prompt guardbuildActiveMediaGenerationTaskPromptContextForSessionpassestrue, so a distinct next segment is no longer suppressed once media is ready.findDuplicateGuardMediaGenerationTaskForSession, already label-aware) and thecompleteTaskRundelivery-confirmation gate are unchanged.Scope / non-goals
deliveringstate),TaskRecordschema, duplicate guard, or thecompleteTaskRunsafety contract ("generated result without confirmed delivery is terminally unsafe for closeout").Test plan
media-generation-task-status-shared.test.ts)pnpm tsgo+pnpm check(oxlint/oxfmt)video_generateof 2 distinct prompts - confirm 2nd isn't suppressed, task A flips tosucceededafter the wake.