Skip to content

Support Telegram images through Claude Code #187

Closed

Description

@owainlewis

Outcome

Telegram images supported by #185 also work when the selected agent backend is Claude Code.

Dependency

Constraints

  • Use Claude Code's native streaming JSON input for requests containing images.
  • Send images as base64 content blocks with the validated media type.
  • Keep the existing plain-text invocation for requests without images.
  • Support new and resumed Claude sessions.
  • Do not expose base64 data in logs, errors, audit events, or process arguments.
  • Enforce the shared 6 MiB raw limit before base64 expansion.
  • Preserve configured, unattended, evaluator, and session-missing behavior.
  • Do not fall back to asking Claude to open an arbitrary local path with tools.

Acceptance criteria

  • Claude receives caption text and image content in one user message.
  • Image-only requests contain a small text placeholder plus the image block.
  • New and resumed sessions support images.
  • Text-only requests continue using the existing command and output contract.
  • Malformed streaming input and Claude failures return typed backend errors.
  • Errors and logs never contain base64 content.
  • Runner tests cover JSON construction, media types, session modes, size enforcement, and output parsing.

Checks

cargo test --locked claude
cargo test --locked gateway
cargo fmt --all --check
cargo clippy --locked --all-targets -- -D warnings
cargo build --locked
cargo test --locked

Manually route Telegram to Claude, send a screenshot with a question about a visible detail, then send a second image in the same conversation and confirm session continuity.

Out of scope

  • Replacing the Claude CLI adapter with the Claude Agent SDK
  • Persisting base64 images
  • Slack, iMessage, and outbound images

Activity

  1. owainlewis commented on Aug 4, 2026

    @owainlewis
    OwnerAuthor

    Implemented in commit d494fe5 and the new pull request.

    Verification: issue-focused Claude and gateway suites pass; formatting, Clippy with warnings denied, locked build, and the full locked suite pass (456 tests across unit and integration targets). Independent review found one output-pipe deadlock risk, fixed it with concurrent stdin/output handling, and approved the regression-covered result. Live Telegram verification was not run because it requires a configured vision-capable Claude Code provider.

  2. owainlewis commented on Aug 4, 2026

    @owainlewis
    OwnerAuthor

    PR: #192 (#192).

  3. owainlewis commented on Aug 4, 2026

    @owainlewis
    OwnerAuthor

    Merged via PR #192 as 9481da5. CI passed on Ubuntu, macOS, docs, and RustSec; final automated review found no issues.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions