Repository navigation
fix(agents): don't fail media completion when wake deadline expires with pending handoff - #152114
synthalorian wants to merge 2 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesThis PR carries durable queue receipts through media completion and keeps confirmed queued handoffs pending beyond the 120-second wake deadline. Example: An image finishes generating while its requester remains active for more than 120 seconds.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it addresses a current upstream media-completion bug, but both previously reported P1 findings remain unresolved. Priority: P1 Before merge
Findings
Tests
Agent review detailsHow this fits togetherBackground image, music, and video generation hands results to the durable session-delivery queue, which resumes the requesting session and records delivery settlement. flowchart TD
A[Requester turn] --> B[Media generation]
B --> C[Completion scheduler]
C --> D[Durable session queue]
D --> E[Requester continuation]
E --> F[Media delivery]
D --> G[Receipt observation]
G --> C
Technical reviewBest possible solution: Let confirmed queue custody release the requester wait and obtain terminal delivery status from the queue owner without declaring delivery early. Do we have a high-confidence way to reproduce the issue? The official-release report and current-main deadline path establish the original failure; source inspection establishes both patch defects, without executing target code. Is this the best way to solve the issue? Distinguishing durable custody from delivery is appropriate, but the repair must reach both terminal receipt reads and the requester wait owner. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against f049a3655f6d. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +93, Tests +156. Total +249 across 6 files. Added test files: 1. View PR surface stats
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 13, 2026, 5:49 PM ET / 21:49 UTC (Revision 4). |
Live behavior proof — deadline expiry with a pending handoff completes deferred, not failedEnvironment: worktree pinned to PR head Without the fix (upstream
|
Follow-up: deferral now gated on positive queue ownershipPushed The hole: the first revision treated every deadline-expired The fix: the wake outcome now carries Verified locally (2 files, 39/39 green):
The net behavior matrix:
|
|
ClawSweeper recorded closeout evidence for this proposed close.
|
6373bda to
f52fbbd
Compare
Live proof — queued handoff stays pending past the wake deadlineHead The real completion scheduler was run with a pending handoff held through the 120s wake deadline: At the deadline the operation was still When the media never lands, the same deadline does not mark success. After a later permanent failure the terminal outcome is
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
A session_queued completion is already owned by the durable delivery queue. The 120s caller deadline was recording a blocked failure even though that handoff was still pending. Keep the receipt until delivery or a permanent queue failure, and do not mark the turn successful when the media never lands. Unconfirmed pending handoffs still fail closed. Fixes openclaw#151964
The assertion-safety ratchet rejects a new unchecked cast. The failed delivery tombstone stores failedAt outside the live payload type.
533a6ef to
5666c9a
Compare
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Thank you for this fix. The same problem (#151964) was resolved on |
What Problem This Solves
When a media generation completion is accepted into the durable session-delivery queue behind the requester's own active run, the handoff is already owned by that queue and drains when the run ends. The caller-side retry loop still threw at the 120s handoff deadline, and the scheduler recorded a blocked delivery failure plus a false "completion wake failed after successful generation" log. The queued handoff was not actually lost, but the task looked failed. Marking the turn successful at that deadline would also be wrong: queue custody is not delivery.
Why This Change Was Made
wakeMediaGenerationTaskCompletionnow reportsqueueOwnedonly when the delivery disposition issession_queued, and includes the durablequeueEntryId. Until the deadline, admission retries are unchanged. If that deadline expires while the handoff is still pending:User Impact
image_generate/video_generate/music_generateno longer record a false delivery failure when the requester's own turn still holds a queue-owned completion past 120s. The generated media stays queued for delivery. The turn is not marked successful unless the media actually lands, and a later permanent delivery failure is still recorded as blocked.Evidence
Head
533a6ef485e373f8f9c3d54dfa88da50a0709bef.Real scheduler run (
src/agents/tools/media-generate-background-shared.queue-deadline.test.ts):Real durable-queue admission (
src/gateway/server-restart-sentinel.media-binding.test.ts, 12 passed) now requiresqueueOwned: trueand the samequeueEntryIdas the pending queue row. Unconfirmed pending handoffs still stop at the deadline with a blocked result (stops pending handoff retries at the completion deadline).Fixes #151964