fix(media): pin requester delivery route when task starts#89949
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 21, 2026, 9:12 PM ET / 01:12 UTC. Summary PR surface: Source +7, Tests +183. Total +190 across 2 files. Reproducibility: yes. at source level: current main and v2026.6.9 compute deliverability before requester-session state can backfill Review metrics: none identified. Stored data model 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:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this PR only after maintainers explicitly accept same-channel requester-session fallback as the recovery target, or revise it to bound stale same-channel targets before merge. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main and v2026.6.9 compute deliverability before requester-session state can backfill Is this the best way to solve the issue? Yes for the missing- AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4f7d1f497777. Label changesLabel justifications:
Evidence reviewedPR surface: Source +7, Tests +183. Total +190 across 2 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
|
Mantis Telegram Desktop ProofSummary: Mantis captured native Telegram Desktop before/after GIF evidence: main does not show the generated image completion, while this PR delivers it back to the chat.
Motion-trimmed clips: |
CI feedback request
|
|
@clawsweeper re-review PR body updated with live Mantis Telegram Desktop proof (run 26902454818, Overall: true, both baseline + candidate pass). The earlier 'Real behavior proof' policy check ran before Mantis published, so the artifact link was not yet in the body — that should now satisfy the proof gate. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
@clawsweeper re-review |
2 similar comments
|
@clawsweeper re-review |
|
@clawsweeper re-review |
|
Land-ready verification for
Known scope: this lands only the missing-target mechanism. Retry asymmetry and other #86034 mechanisms remain open. |
…ter session entry When a media-generation task is created off the direct-reply path (heartbeat, cron, subagent spawn), `agentTo` is undefined and the persisted `requesterOrigin` lacks `to`. Every downstream `Boolean(channel && to)` gate then short-circuits, so the generated artifact is never delivered even though the artifact exists on disk and `task_runs.status` is later marked failed with `completion delivery failed after successful generation`. The requester session entry already carries `lastTo`/`lastChannel`/ `lastAccountId` and is loaded in the same function further down. Merge that context back into `effectiveDirectOrigin` before the deliverability decision, as the existing comment at the same site already promises. Fixes openclaw#86034 (Hypothesis A). Hypothesis B (wake-false skips direct fallback) remains a separate follow-up - see issue thread for details.
…gram delivery (openclaw#86034) Locks the mergeDeliveryContext channelsConflict guard so a stale lastChannel that differs from the completion origin's channel cannot import its lastTo. Addresses ClawSweeper's contract question on PR openclaw#89949. node_modules not available in this worktree; vitest was not run locally. CI is the gate.
oxlint(curly) rejected the bare `if (!params) continue;` continue inside the regression test added for openclaw#86034. Wrap the body in braces. No logic change.
|
Landed via rebase onto main.
Thanks @wangwllu! |




What Problem This Solves
Detached media generation can start from a requester origin that has a channel but no target. The artifact is generated, but completion delivery fails because the downstream route is incomplete.
Addresses #86034 (missing-target mechanism only; the issue tracks additional delivery mechanisms).
Why This Change Was Made
The requester session already has the complete route when detached work starts. This change snapshots that route into the media task handle by merging the supplied origin with the session delivery context at task creation.
Pinning at task start is important: reading mutable session routing at completion could select a different peer in shared-DM session configurations. The completion path now consumes only the pinned task route; no transport-specific fallback or steady-state session lookup is added.
User Impact
Generated image, video, and music results launched off the direct-reply path can return to the initiating conversation when the supplied origin omitted its target. Later session activity cannot redirect that task's media to another peer.
Evidence
Real behavior proof
Current head targeted proof:
Result: 5 files, 138 tests passed. The regressions pin
lastChannel/lastTo/lastAccountIdat task creation, mutate the mocked session route before completion, prove delivery still uses the original peer, reject a target from a conflicting account, strip stale cross-target thread ids, and recover an external session route from an internal requester origin.Native Telegram Desktop Mantis proof succeeded on attempt 2: https://github.com/openclaw/openclaw/actions/runs/27971069903. Its direct production-runtime probe shows main omitting the generated image completion while candidate
0010944da9ba7fdf8452f8cd24d1cb35c8342187delivers it back to the requester chat; paired screenshots/GIFs and raw evidence are linked in the Mantis PR comment. Final head606c94e36b6cb35a20dd6476c78a8307dfe02bd2is an ancestry-only rebase with the identical changed production blob (162e2d7828d22241e33b3e4f2cd68bb890e81070).Known scope: this fixes the missing-target mechanism only. Retry asymmetry and other #86034 mechanisms remain separate follow-up work.