Skip to content

fix(agents): media generation blocks channel turns sharing the main session - #160998

Merged
steipete merged 2 commits into
release/2026.9.7from
release-batch2/2026.9.7
Sep 29, 2026
Merged

steipete merged 2 commits into
release/2026.9.7from
release-batch2/2026.9.7

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: image, video, and music generation in channel sessions that share the main session (default DM scope) run in the foreground and block the turn instead of detaching, a 9.7 regression from #159179.

User Impact

Media generation in shared-main channel sessions backgrounds again and no longer blocks the conversation turn.

Why This Change Was Made

Since #159179, media detach requires a bound requester transcript, but channel sessions sharing main passed the alias key, so the entry lookup missed. The tools now receive the durable runSessionKey. A second, test-only commit restores the image-generation-lifecycle e2e wait for the terminal task state (the removed tasks.list wait) via image_generate action=status.

Evidence

  • Regression test fails before and passes after; 65 owner tests pass; autoreview (Codex, P2) scoped-clean, "patch is correct (0.88)".
  • test/e2e/qa-lab/media/image-generation-lifecycle.e2e.test.ts passes locally at eae603c; it failed in Full Release Validation release checks (jobs 109251108779, 109179390422) without the fix.
  • Release-branch first per 2026.9.7 policy; forward-port to main follows.

…n key

Image, video and music generation in channel sessions that share the main
session (for example QA-channel or Matrix direct chats under the default DM
scope) ran in the foreground and blocked the turn instead of starting a
background task. The media tools received the channel alias session key
(agent:<id>:<channel>:...:direct:<peer>) while SQLite stores the requester
under the durable run session key (agent:<id>:main). Since #159179
(6652f7e) detaching requires a bound requester transcript, and the alias
lookup found no session entry, so detach was false and the provider call ran
inline.

Pass the durable requester session key (runSessionKey, falling back to the
agent session key) to image, video and music generation, as the other
requester-scoped tools already do. Cron run keys keep their existing
behavior; transcript and cron-continuation safeguards are unchanged.

Proof: regression in openclaw-tools.tts-config.test.ts fails before and
passes after; 65 owner/sibling tests pass. image-generation-lifecycle.e2e now
reaches background start, running-duplicate dedupe and completion delivery
with internal provenance (previously stuck at the first turn); its final
"recently succeeded" duplicate check still fails separately.
…d duplicate

#159179 removed the tasks.list terminal-state wait from
image-generation-lifecycle.e2e together with the Tasks runtime. Completion
delivery precedes the task's terminal success (unchanged product order), so
the third duplicate request could arrive while the task still reported
"Generated media; delivering completion" and never saw "recently succeeded".

Restore the wait through the surviving owner: image_generate action=status
via tools.invoke on the requester's durable session. The test first asserts
that the status reports the running task (so the observable is not vacuous),
then waits for "No active image generation task" before the third request.

Proof: with d068991 the e2e file passes 1/1 (61 s).
@clawsweeper

clawsweeper Bot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant