Skip to content

fix(btw): side questions ignore the image attached to the message - #150020

Merged
obviyus merged 3 commits into
mainfrom
fix/btw-current-turn-images
Sep 16, 2026
Merged

obviyus merged 3 commits into
mainfrom
fix/btw-current-turn-images

Conversation

@obviyus

@obviyus obviyus commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

Most changed lines move existing tests into sibling files; all coverage remains.

What Problem This Solves

/btw asks for an image already attached to its message or supplied as reply context.

Why This Change Was Made

/btw now reuses the main turn's image resolver. Direct-provider requests and the bundled app-server side thread receive those images. Prompt assembly and shared test setup move into sibling files to avoid growing oversized files. This state has one writer; side questions still write no transcript.

User Impact

Questions can use the attached image. Text-only CLI runtimes receive an omitted-image count. Other harness plugins may ignore images.

Evidence

Telegram Test Server, mock provider: send hello, then a photo captioned /btw what color is this image?. On 42951671d, the side-question request has text only. On the final combined candidate abb9329291e, it includes input_image and the bot answers. The reply-to-photo case also passes with #150028; this PR alone does not repair Telegram's native-command delivery. Combined tests: 121 side-question, 952 shared-state, and 3,349 Telegram tests pass.

Compatibility

Optional images on AgentHarnessSideQuestionParams; no config, schema, or protocol change. The same external consumer compiles against shipped 2026.9.4 and candidate package declarations. Candidate image/no-image callbacks pass with matching candidate dependencies; this is not a release-installation test.

Consumers

The direct request and bundled side-thread input consume images; the CLI prompt consumes the omitted count. Shared internal reply options own extracted file images.

Invalidation

None: images are per-call data.

Tests

Command, direct-request, harness, CLI, and app-server input regressions; existing tests moved without removing cases. An image already described by media understanding remains excluded; passing that description to /btw is a separate gap.

@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling extensions: codex size: S maintainer Maintainer-authored PR labels Sep 16, 2026
@clawsweeper

clawsweeper Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 16, 2026, 12:02 PM ET / 16:02 UTC (Revision 6).

ClawSweeper review

What this changes

Passes attached images into /btw provider and Codex requests, explains omitted images to CLI runtimes, documents support limits, and extracts existing prompts and test setup.

Merge readiness

⛔ Blocked before merge - 1 item remains

This remains a useful fix: current main and the latest release still omit current-message images from side questions. No blocking introduced defect was found, and the earlier documentation finding is resolved.

Priority: P2
Reviewed head: 4fe803e1dcfb42ba59266783feebfb4bd4a76d33

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with relevant behavior evidence, preserved regression coverage, and clearly stated runtime limits.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): Recorded Telegram Test Server observations exercise the attachment-to-provider path and show input_image reaching the request with a delivered answer after the fix. The combined candidate also contains the separate Telegram ingress repair; Codex coverage is supplemental protocol-input testing and source verification, not a claimed live Codex run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Recorded Telegram Test Server observations exercise the attachment-to-provider path and show input_image reaching the request with a delivered answer after the fix. The combined candidate also contains the separate Telegram ingress repair; Codex coverage is supplemental protocol-input testing and source verification, not a claimed live Codex run.
Evidence reviewed 9 items Current main still needs the fix: The fetched main command forwards question text without resolving or forwarding current-message images.
Latest release retains the omission: The same text-only side-question handoff exists in v2026.9.4; this is not an already-shipped repair.
Existing attachment owner reused: The introduced command call reuses current-turn image resolution. Its existing implementation excludes described images and recent-history fallback, and delegates local-root and byte-limit enforcement to the attachment owner.
Findings None None.
Security None None.

How this fits together

OpenClaw’s /btw command answers a side question using the active conversation without adding the exchange to its history. The command resolves message attachments and passes them to the selected provider or harness.

flowchart TD
  A[Side question and attachments] --> B[Authorized command]
  B --> C[Existing image resolver]
  C --> D{Selected runtime}
  D --> E[Provider or Codex image input]
  D --> F[CLI omission notice]
  E --> G[Ephemeral side answer]
  F --> G
Loading

Before merge

  • Resolve merge risk (P1) - Third-party harnesses may ignore the new optional image input; image support outside the documented provider and Codex paths remains implementation-dependent.
Agent review details

Security

None.

PR surface

Source +18, Tests +472, Docs +9. Total +499 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 8 122 104 +18
Tests 9 1670 1198 +472
Docs 1 9 0 +9
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 18 1801 1302 +499

Review metrics

Metric Value Why it matters
Harness input contract 1 optional image parameter; 0 new configuration options Existing harness callbacks can continue unchanged while image-aware implementations consume the new input.

Merge-risk options

Maintainer options:

  1. Retain the documented optional contract (recommended)
    Accept that existing third-party harnesses can remain text-only, with the PR’s compatibility evidence and runtime-specific documentation defining the supported behavior.

Technical review

Best possible solution:

Keep one attachment resolver and the existing runtime adapters, preserving text-only compatibility and the explicitly documented image-support limits.

Do we have a high-confidence way to reproduce the issue?

Yes: an active session followed by a photo captioned /btw reaches a current-main handler that forwards only question text. Source inspection and the recorded Telegram comparison support the failure; this review did not execute it.

Is this the best way to solve the issue?

Yes: reusing the main turn’s image resolver and existing provider/Codex adapters is a narrow repair. The separate Telegram native-command ingress problem remains owned by the related PR.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against ca086327834a.

Labels

Label justifications:

  • P2: Repairs a bounded side-question attachment failure without evidence of a broader runtime outage.
  • merge-risk: 🚨 compatibility: The public harness parameter contract expands, while third-party image handling remains optional and explicitly qualified.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Recorded Telegram Test Server observations exercise the attachment-to-provider path and show input_image reaching the request with a delivered answer after the fix. The combined candidate also contains the separate Telegram ingress repair; Codex coverage is supplemental protocol-input testing and source verification, not a claimed live Codex run.
  • proof: sufficient: Contributor real behavior proof is sufficient. Recorded Telegram Test Server observations exercise the attachment-to-provider path and show input_image reaching the request with a delivered answer after the fix. The combined candidate also contains the separate Telegram ingress repair; Codex coverage is supplemental protocol-input testing and source verification, not a claimed live Codex run.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Attached-image side answers are Telegram-visible, and the supplied Test Server evidence covers the photo-caption flow.

Evidence

What I checked:

  • Current main still needs the fix: The fetched main command forwards question text without resolving or forwarding current-message images. (src/auto-reply/reply/commands-btw.ts:90, ca086327834a)
  • Latest release retains the omission: The same text-only side-question handoff exists in v2026.9.4; this is not an already-shipped repair. (src/auto-reply/reply/commands-btw.ts:90, 3a9d69db306c)
  • Existing attachment owner reused: The introduced command call reuses current-turn image resolution. Its existing implementation excludes described images and recent-history fallback, and delegates local-root and byte-limit enforcement to the attachment owner. (src/auto-reply/reply/commands-btw.ts:50, 4fe803e1dcfb)
  • Provider and Codex consumption: Direct-provider input appends sanitized images after the question. Codex turn/start now uses the existing sanitized user-input builder; that protocol call establishes the affirmative dependency on Codex. (extensions/codex/src/app-server/side-question.ts:894, 4fe803e1dcfb)
  • Dependency contract inspected: The sibling checkout’s backing repository remote identifies openai/codex. Its app-server UserInput accepts image URLs and converts them into core image input, matching the existing OpenClaw builder used by this patch. (codex-rs/app-server-protocol/src/protocol/v2/turn.rs:401, 6b9826e3aa83)
  • Recorded behavior and compatibility evidence: The captured PR body reports Telegram Test Server observations with a mock provider: photo-caption requests changed from text-only at 4295167 to input_image plus a delivered answer on combined candidate abb9329291e. Reply-to-photo coverage also includes fix(telegram): typed slash commands lose the replied-to message and its photo #150028. It separately reports an unchanged external consumer compiling against shipped and candidate declarations, plus candidate image/no-image callbacks; it explicitly does not claim release-installation testing.

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-16T11:50:25.021Z sha 0954665 :: blocked before merge. :: [P3] Qualify the documented image-support guarantee
  • reviewed 2026-09-16T12:09:31.614Z sha 0954665 :: blocked before merge. :: [P3] Qualify the documented image-support guarantee
  • reviewed 2026-09-16T12:19:30.189Z sha 8a2a9a3 :: blocked before merge. :: none
  • reviewed 2026-09-16T14:39:16.958Z sha 4fe803e :: blocked before merge. :: none
  • reviewed 2026-09-16T14:53:51.289Z sha 4fe803e :: blocked before merge. :: none

@obviyus
obviyus marked this pull request as ready for review September 16, 2026 11:57
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 16, 2026
/btw resolved only the question text, so a photo with a /btw caption (or a
replied-to photo a channel supplies as reply media) never reached the side
question and the model asked the user to resend the image.

Reuse the main run's current-turn image owner in the /btw command and carry
the images into the side question: direct provider calls append sanitized
image blocks after the question, harness side questions receive them
through the side-question params (Codex builds its turn input with the same
user-input builder the main turn uses), and CLI runtimes get a text note
with the omitted image count instead of guessing.
@obviyus
obviyus force-pushed the fix/btw-current-turn-images branch from 8a2a9a3 to 4fe803e Compare September 16, 2026 14:30
@obviyus
obviyus merged commit f597402 into main Sep 16, 2026
340 of 343 checks passed
@obviyus
obviyus deleted the fix/btw-current-turn-images branch September 16, 2026 16:14
@obviyus

obviyus commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

Proof: A photo captioned /btw what color is this image? on the Telegram Test Server now reaches the side-question request as image content. The replied-to photo case also passes when combined with #150028.

  • Bug: Side questions asked for an image already attached to the message.
  • Fix: Side questions use the shared current-message image resolver and pass its images to supported runtimes.
Before After
Side-question request contains text only Side-question request contains the attached image

obviyus added a commit that referenced this pull request Sep 16, 2026
…ts photo (#150028)

The broad diff removes the parallel native-command dispatcher and moves its coverage onto the shared message pipeline.

## What Problem This Solves

Typed Telegram commands lose replied-to photos, quoted text, and conversation context. Caption commands already use the full message pipeline.

## Why This Change Was Made

Native handlers keep `/login` and argument keyboards; other commands continue through message admission, reply-media hydration, and chat-session dispatch. The bespoke turn plan and duplicate delivery policy are removed. One ingress rule owns command authorization. The registered command map translates `/export_session` to `/export-session` without changing raw text. This state has one writer.

## User Impact

Typed commands get normal message context. Command-only allowlists and owners retain access outside account-level sender lists; explicit chat and topic sender restrictions still apply. Disabled chats and topics stay disabled. Replies follow `replyToMode` and ordinary tool-progress policy. Session metadata is awaited before dispatch, and hook-suppressed final replies no longer trigger an empty-response fallback.

## Evidence

Telegram Test Server, mock provider: hello, bare photo, then `/btw what color is the image I replied to?` replying to it. On `42951671d`, the side-question request has no image; with this change and #150020 at `abb9329291e`, it contains `input_image` and the bot answers. The caption case also passes. Combined tests: 3,349 Telegram, 952 shared-state, and 121 side-question tests pass.

Live Telegram authorization check: a command-only sender receives `/status` and the `/think` keyboard. After an explicit chat restriction excludes them, status dispatch is dropped and `/think` returns only an authorization denial. Before the correction, both commands still executed. All 24 direct/group/topic, owner/command-list, included/excluded command tests pass.

`node openclaw.mjs qa run --repo-root . --qa-profile smoke-ci --concurrency 1 --scenario telegram-command-prompt-context` fails before the correction and passes after it: export acknowledgement and Telegram prompt context remain in the topic.

## Compatibility

Native commands now use the chat session, not `telegram:slash:<userId>`. Menu applicability adds one plugin SDK export; the maintainer approved its exact +1 export and callable budgets. The unchanged menu consumer compiles against shipped 2026.9.4 and candidate package declarations; the new helper compiles against the candidate. No config, schema, or protocol change.

## Consumers

Builtin commands use the shared pipeline. Login, keyboards, and plugin commands retain their native executors.

## Invalidation

None: context is built per message.

## Tests

Registered bot updates cover photo replies, captions, menu/login routing, command-name translation, command-only access, rejected senders, disabled topics, topic sessions, and progress. Removed dispatcher coverage is moved or retired with its deleted behavior.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…enclaw#150020)

Most changed lines move existing tests into sibling files; all coverage remains.

## What Problem This Solves

`/btw` asks for an image already attached to its message or supplied as reply context.

## Why This Change Was Made

`/btw` now reuses the main turn's image resolver. Direct-provider requests and the bundled app-server side thread receive those images. Prompt assembly and shared test setup move into sibling files to avoid growing oversized files. This state has one writer; side questions still write no transcript.

## User Impact

Questions can use the attached image. Text-only CLI runtimes receive an omitted-image count. Other harness plugins may ignore images.

## Evidence

Telegram Test Server, mock provider: send hello, then a photo captioned `/btw what color is this image?`. On `c509330cb`, the side-question request has text only. On the final combined candidate `abb9329291e`, it includes `input_image` and the bot answers. The reply-to-photo case also passes with openclaw#150028; this PR alone does not repair Telegram's native-command delivery. Combined tests: 121 side-question, 952 shared-state, and 3,349 Telegram tests pass.

## Compatibility

Optional `images` on `AgentHarnessSideQuestionParams`; no config, schema, or protocol change. The same external consumer compiles against shipped 2026.9.4 and candidate package declarations. Candidate image/no-image callbacks pass with matching candidate dependencies; this is not a release-installation test.

## Consumers

The direct request and bundled side-thread input consume images; the CLI prompt consumes the omitted count. Shared internal reply options own extracted file images.

## Invalidation

None: images are per-call data.

## Tests

Command, direct-request, harness, CLI, and app-server input regressions; existing tests moved without removing cases. An image already described by media understanding remains excluded; passing that description to `/btw` is a separate gap.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 17, 2026
…ts photo (openclaw#150028)

The broad diff removes the parallel native-command dispatcher and moves its coverage onto the shared message pipeline.

## What Problem This Solves

Typed Telegram commands lose replied-to photos, quoted text, and conversation context. Caption commands already use the full message pipeline.

## Why This Change Was Made

Native handlers keep `/login` and argument keyboards; other commands continue through message admission, reply-media hydration, and chat-session dispatch. The bespoke turn plan and duplicate delivery policy are removed. One ingress rule owns command authorization. The registered command map translates `/export_session` to `/export-session` without changing raw text. This state has one writer.

## User Impact

Typed commands get normal message context. Command-only allowlists and owners retain access outside account-level sender lists; explicit chat and topic sender restrictions still apply. Disabled chats and topics stay disabled. Replies follow `replyToMode` and ordinary tool-progress policy. Session metadata is awaited before dispatch, and hook-suppressed final replies no longer trigger an empty-response fallback.

## Evidence

Telegram Test Server, mock provider: hello, bare photo, then `/btw what color is the image I replied to?` replying to it. On `c509330cb`, the side-question request has no image; with this change and openclaw#150020 at `abb9329291e`, it contains `input_image` and the bot answers. The caption case also passes. Combined tests: 3,349 Telegram, 952 shared-state, and 121 side-question tests pass.

Live Telegram authorization check: a command-only sender receives `/status` and the `/think` keyboard. After an explicit chat restriction excludes them, status dispatch is dropped and `/think` returns only an authorization denial. Before the correction, both commands still executed. All 24 direct/group/topic, owner/command-list, included/excluded command tests pass.

`node openclaw.mjs qa run --repo-root . --qa-profile smoke-ci --concurrency 1 --scenario telegram-command-prompt-context` fails before the correction and passes after it: export acknowledgement and Telegram prompt context remain in the topic.

## Compatibility

Native commands now use the chat session, not `telegram:slash:<userId>`. Menu applicability adds one plugin SDK export; the maintainer approved its exact +1 export and callable budgets. The unchanged menu consumer compiles against shipped 2026.9.4 and candidate package declarations; the new helper compiles against the candidate. No config, schema, or protocol change.

## Consumers

Builtin commands use the shared pipeline. Login, keyboards, and plugin commands retain their native executors.

## Invalidation

None: context is built per message.

## Tests

Registered bot updates cover photo replies, captions, menu/login routing, command-name translation, command-only access, rejected senders, disabled topics, topic sessions, and progress. Removed dispatcher coverage is moved or retired with its deleted behavior.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: codex maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant