qwen-code/docs
ytahdn c0791f0450
feat: support session media references end-to-end (#9310)
* feat: support session media references end-to-end

* fix(cli): catalog session media routes and update mid-turn replay meta test

The three new media routes (POST/GET/DELETE /session/:id/media[/:mediaId])
were registered but missing from legacySessionTelemetryRoutes, tripping the
route drift guard; add them as handler_resolved like their sibling routes.
The mid-turn history-replay expectation now carries the replay meta this PR
adds (source: mid_turn_message_injected, qwenDiscreteMessage: true).

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(daemon): harden session media per review feedback

Addresses the Critical review findings on the session-media PR:

- Reject image/svg+xml uploads and serve stored media with
  Content-Disposition: attachment and X-Content-Type-Options: nosniff
  (same-origin XSS vector on the daemon/Web Shell origin).
- Keep the retained-media TTL sweep running when the session reaper is
  disabled (sessionReapIntervalMs <= 0) on the default 60s cadence.
- Record only the inline bytes the media references actually cover:
  the gate now counts image blocks only (references are image-only),
  and the strip keeps unrelated inline parts (e.g. @-mentioned files).
- Show '[User message with attachments]' on TUI resume for image-only
  mid-turn messages recorded with an empty displayText.
- Exempt mid-turn injected echoes from the Web Shell status-noise and
  plan-JSON filters.
- Degrade refresh-rebuilt queue rows to summary-only when media
  hydration failed, so editing cannot silently discard attachments.
- Retry cross-session media removal without the clientId when the
  daemon rejects the stale persisted id (invalid_client_id).
- Register session_media in the integration capabilities baseline.

Each fix carries a regression test that fails on the pre-fix code.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(daemon): bound media content and fix resume/echo edge cases

Addresses the remaining Critical review findings on the session-media PR:

- Cap media content blocks at 256 on the mid-turn and prompt routes and
  resolve each distinct mediaId once per resolveContent call — an
  unbounded array of duplicate references amplified one small request
  into gigabytes of heap at dispatch.
- Record a '[User message with attachments]' placeholder for
  inline-media-only mid-turn messages with no references, keeping ''
  only for the reference shape that replay projects.
- Restore the same placeholder for image-only ordinary prompts on TUI
  resume instead of dropping the message from the restored history.
- Treat a mid-turn injected echo as renderable when its items carry a
  non-empty text block, so the degraded-media echo (messages: [''] plus
  the placeholder text block) is not discarded as malformed.
- Release session media in killSession's force-kill and closing-session
  fallback branches instead of degrading to the crash-path detach
  retention.
- Remove the unreachable duplicate return in DaemonSessionClient.load().

Each fix carries a regression test that fails on the pre-fix code.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(daemon): resolve round-4 session media findings

Addresses the round-4 Critical review findings on the session-media PR:

- Move the mid-turn media-reference validation below the idempotent
  retry-ack rings so a same-id retry whose media was already removed
  (delete racing an in-flight POST, or a refresh re-enqueueing from the
  snapshot) settles idempotently instead of failing with
  session_media_gone (410).
- Keep image/* (unknown mime type) prompt images inline instead of
  uploading them: the media route matches concrete image types only, so
  the upload POST 400s and the whole submission hard-failed, regressing
  pre-upload behavior for untyped images.
- Project the degraded-media drain echo's placeholder text block when
  the echo text is empty, so the Web Shell shows the unavailability
  notice instead of rendering an empty bubble.

Each fix carries a regression test that fails on the pre-fix code.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(daemon): resolve round-5 session-media critical findings (#9127)

- Stop deleting a session-media blob when one queued prompt / mid-turn
  message referencing it is removed: the store has no reference counting,
  so siblings, replay metadata, or other clients may still hold the same
  mediaId. Blobs now live until session close / TTL sweep or an explicit
  removeSessionMedia.
- Reject duplicate mediaId occurrences in one message at assertReferences
  (covers the prompt and mid-turn admission paths); the serializer expands
  every reference at dispatch, so repeats amplified one upload into an
  unbounded payload even though only one read is needed.
- Align the mid-turn display-text and reference-persistence gates: compute
  the same willPersistReferences condition before finalizing displayText, so
  a partially-referenced message records the attachments placeholder instead
  of an empty displayText with no references.
- Keep the webui mid_turn_message_injected sidechannel alive for degraded
  image-only echoes whose items carry only the placeholder text block,
  mirroring the SDK normalizer's hasRenderableItemContent.

* fix(daemon): resolve round-6 session-media critical findings (#9127)

* fix(daemon): resolve round-7 session-media critical findings (#9127)

* fix(daemon): resolve round-8 session-media critical findings (#9127)

* fix(daemon): correct session media recovery and queue isolation

* fix(daemon): remove media with deleted queue items

* fix(daemon): bound repeated media in queue drains

---------

Co-authored-by: 钉萁 <dingqi.jww@alibaba-inc.com>
Co-authored-by: qwen-code-dev-bot <qwen-code-dev@service.alibaba.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
2026-08-17 07:59:41 +00:00
..
assets feat: support workspace display names (#7179) 2026-07-20 15:16:44 +00:00
design feat: support session media references end-to-end (#9310) 2026-08-17 07:59:41 +00:00
developers feat(daemon): attach skill-toggle mutation metadata to settings_changed (#9051) 2026-08-17 05:01:41 +00:00
e2e-tests feat(worktree): Phase D — startup --worktree flag + symlinkDirectories + PR refs (#4381) 2026-05-27 17:04:51 +08:00
images fix(web-shell): render built-in tag icons (#7024) 2026-07-17 15:33:34 +00:00
plans feat(daemon): Isolate the Conversations runtime boundary (#9181) 2026-08-16 17:32:45 +00:00
superpowers feat(cli): reference prior sessions via @ and add completion tabs (#7302) 2026-07-24 06:11:48 +00:00
users feat(core): add a live-session registry and qwen sessions ps (#8969) 2026-08-17 03:53:12 +00:00
verification/abort-controller-refactor fix(core): stop AbortSignal listener leak in long sessions (MaxListenersExceededWarning) (#4366) 2026-05-26 14:21:49 +08:00
_meta.ts feat: refactor docs 2025-12-05 10:51:57 +08:00
index.md fix: lint issues 2025-12-19 15:52:11 +08:00