Skip to content

Images are silently dropped when message is sent as soft interrupt (mid-turn) #623

Closed

Description

@wiktorwiesek

Summary

Images pasted into a message that is sent while the agent is still processing (soft-interrupt path) are silently dropped. The model receives only the [image N] placeholder text, with no indication to the user that the attachment was lost.

Root cause

The soft-interrupt wire protocol has no image payload:

  • crates/jcode-protocol/src/wire.rs — Request::SoftInterrupt { id, content, urgent } carries only content: String. Compare with Request::Message { id, content, images, system_reminder }, which does carry images.
  • crates/jcode-app-core/src/agent/interrupts.rs — SoftInterruptMessage { content, urgent, source } and queue_soft_interrupt(content: String, ...) likewise have no images field.

So when the TUI submits a message with pending_images while a turn is running, it goes out as Request::SoftInterrupt and the base64 image data is discarded client-side. The [image N] placeholder that attach_image() inserted into the input (crates/jcode-tui/src/tui/app/input.rs) stays in the text and is the only thing the model sees.

Evidence (from a live session, jcode v0.61.0)

  1. User pasted a screenshot and hit Enter mid-turn. Server log at that exact timestamp:
    SERVER_SOFT_INTERRUPT_QUEUE_RESULT id=3 session=... queued=true ack_queued=true
  2. No Agent received message with N image(s) log line for that message (this line is emitted unconditionally by run_once_streaming_mpsc in crates/jcode-app-core/src/agent/turn_execution.rs when image blocks are present). On a previous day, when an image was sent while the agent was idle, the line appears and the image reaches the model.
  3. API request payload (messages_json_chars in KV_CACHE_USAGE logs) grew by only ~5.5 KB for the image turn — the text plus placeholder. A base64 screenshot would add hundreds of KB.

Expected behavior

Either:

  • (preferred) extend the soft-interrupt path to carry images: add images: Vec<(String, String)> to Request::SoftInterrupt and SoftInterruptMessage, and inject them as ContentBlock::Image blocks alongside the text at the injection point, or
  • at minimum, refuse/warn in the TUI when submitting images during a running turn ("image attachments can't be queued mid-turn, wait or cancel"), so the loss is not silent.

Repro

  1. Start any long-running turn (e.g. ask for a big analysis).
  2. While the agent is streaming/working, paste an image (screenshot) into the composer and press Enter.
  3. Observe: the message is queued as a soft interrupt, the model later responds as if no image was attached, and only sees [image 1].

Environment: jcode v0.61.0, macOS, provider = Kimi Code (openai-compatible, vision-capable model k3). Provider/model is irrelevant to the bug — the drop happens before any API call.

Activity

  1. added
    bug
    priority: medium
    triage: reproducible
    autonomous: likely
    on Jul 27, 2026
  2. 1jehuang commented on Jul 27, 2026

    @1jehuang
    Owner

    Implemented the reporter’s preferred end-to-end fix in #627. Soft interrupts now carry image payloads through the wire protocol, runtime and persisted queues, server dispatch, and both local and remote TUI submission paths. Queued attachments are injected as ContentBlock::Image entries, while legacy soft-interrupt payloads without images remain compatible through the serde default.

    Thank you to the reporter for the detailed root-cause analysis. It accurately identified the missing payload across the protocol, queue, and TUI paths and directly guided the implementation and regression coverage.


    — Jcode agent (automated triage), on behalf of @1jehuang

  3. added 2 commits that reference this issue on Jul 28, 2026
    524032d
    2e0a337
  4. added 7 commits that reference this issue on Aug 30, 2026
    8f5a6b8
    42dac5e
    9b89ca7
    a5e7ea2
    4b32ad1
    ba54d3f
    92a3d86
  5. added 2 commits that reference this issue on Sep 18, 2026
    d717eb8
    924d892
  6. added 2 commits that reference this issue on Oct 9, 2026
    125795a
    ce6e07b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    autonomous: likelybugpriority: mediumtriage: reproducible

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions