Skip to content

fix(agents): preserve mixed image attachment order#99902

Merged
vincentkoc merged 1 commit into
mainfrom
fix/current-turn-image-order
Jul 4, 2026
Merged

fix(agents): preserve mixed image attachment order#99902
vincentkoc merged 1 commit into
mainfrom
fix/current-turn-image-order

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Jul 4, 2026

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where users sending a mix of inline and offloaded image attachments could have the attachment order truncated before the model run.

Why This Change Was Made

The reply image resolver now preserves every inline/offloaded order slot while associating concrete payloads only with inline slots. This restores the producer contract expected by the shared prompt-image merger.

User Impact

Mixed image attachments keep their original order instead of losing offloaded slots when only inline images have in-memory payloads.

Evidence

  • node scripts/run-vitest.mjs src/auto-reply/reply/current-turn-images.test.ts passed 6 tests.
  • Scoped oxfmt and oxlint passed.
  • Autoreview passed with no accepted/actionable findings.
  • After rebasing onto main at be95bb72d459, check:changed passed on Blacksmith Testbox tbx_01kwp69wbwd2pc7y8cfv7w0pek (exit 0).

@vincentkoc
vincentkoc marked this pull request as ready for review July 4, 2026 09:06
@vincentkoc vincentkoc self-assigned this Jul 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Jul 4, 2026
@vincentkoc

vincentkoc commented Jul 4, 2026

Copy link
Copy Markdown
Member Author

Land-ready verification:

  • Head: e8e10134811
  • Focused proof: node scripts/run-vitest.mjs src/auto-reply/reply/current-turn-images.test.ts passed 6 tests.
  • Scoped oxfmt and oxlint passed.
  • Structured autoreview returned no accepted/actionable findings.
  • After rebasing onto main at be95bb72d459, Blacksmith Testbox tbx_01kwp69wbwd2pc7y8cfv7w0pek passed pnpm check:changed with exit 0.
  • Review artifacts validated with recommendation READY FOR /prepare-pr.

Known proof gaps: none for this two-file contract repair.

@clawsweeper

clawsweeper Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 4, 2026, 5:25 AM ET / 09:25 UTC.

Summary
This branch updates resolveCurrentTurnImages and its tests so mixed inline/offloaded image attachment order slots are preserved before the model run.

PR surface: Source +20, Tests +53. Total +73 across 2 files.

Reproducibility: yes. Source inspection shows current main drops all-offloaded order slots when no inline payloads exist and truncates mixed offloaded slots by indexing order entries only against inline images.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • none.

Next step before merge

  • No ClawSweeper repair lane is needed; this maintainer-labeled PR has no actionable review findings and should continue through normal maintainer landing.

Security
Cleared: The diff only changes TypeScript image-order bookkeeping and focused tests; it does not alter dependencies, CI, permissions, secrets, downloads, or package metadata.

Review details

Best possible solution:

Land the focused producer-side repair through normal maintainer landing for the exact PR head, keeping the shared prompt-image merger contract unchanged.

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

Yes. Source inspection shows current main drops all-offloaded order slots when no inline payloads exist and truncates mixed offloaded slots by indexing order entries only against inline images.

Is this the best way to solve the issue?

Yes. Preserving the full imageOrder stream in resolveCurrentTurnImages is the narrowest maintainable fix because the gateway producer and embedded-runner consumer already agree on that contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f27d494d00e7.

Label changes

Label changes:

  • add P2: This is a focused bug fix for mixed image attachment ordering with limited blast radius and no evidence of an urgent release-blocking outage.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior proof gate; the PR body and comment include focused test and Testbox evidence.

Label justifications:

  • P2: This is a focused bug fix for mixed image attachment ordering with limited blast radius and no evidence of an urgent release-blocking outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is not subject to the external-contributor real-behavior proof gate; the PR body and comment include focused test and Testbox evidence.
Evidence reviewed

PR surface:

Source +20, Tests +53. Total +73 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 26 6 +20
Tests 1 53 0 +53
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 79 6 +73

What I checked:

Likely related people:

  • joshavant: Live GitHub history shows recent scanned-PDF current-turn image work touching the central resolver and its tests. (role: recent area contributor; confidence: high; commits: 07b934901a32; files: src/auto-reply/reply/current-turn-images.ts, src/auto-reply/reply/current-turn-images.test.ts)
  • marchhao: Live GitHub history links earlier current-turn image hydration behavior to this resolver path. (role: feature introducer; confidence: medium; commits: b5ada806dddc; files: src/auto-reply/reply/current-turn-images.ts)
  • vincentkoc: The PR author also appears in prior merged history on gateway and embedded-runner image-order surfaces consumed by this contract. (role: recent adjacent owner; confidence: medium; commits: e62b0122e7ad, 1f71e922972c; files: src/agents/embedded-agent-runner/run/images.ts, src/gateway/chat-attachments.ts, src/auto-reply/reply/current-turn-images.ts)
  • steipete: Recent broad agent-runtime and gateway/media refactors shaped the producer and consumer paths around image handling. (role: adjacent area contributor; confidence: medium; commits: bb46b79d3c14, 77f1359612f6; files: src/auto-reply/reply/current-turn-images.ts, src/agents/embedded-agent-runner/run/images.ts, src/gateway/chat-attachments.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.
Review history (1 earlier review cycle)
  • reviewed 2026-07-04T09:16:08.787Z sha e8e1013 :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/current-turn-image-order branch from bebd5f5 to e8e1013 Compare July 4, 2026 09:10
@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. labels Jul 4, 2026
@vincentkoc
vincentkoc merged commit a0e6048 into main Jul 4, 2026
126 of 128 checks passed
@vincentkoc
vincentkoc deleted the fix/current-turn-image-order branch July 4, 2026 09:32
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S 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