Skip to content

feat(reply): annotate recent history images - #100866

Merged
vincentkoc merged 4 commits into
openclaw:mainfrom
Hackerismydream:codex/image-history-metadata
Jul 30, 2026
Merged

vincentkoc merged 4 commits into
openclaw:mainfrom
Hackerismydream:codex/image-history-metadata

Conversation

@Hackerismydream

@Hackerismydream Hackerismydream commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #48321.

Recent inbound history images reached ACP turns with sender and optional message ID only. The model could see an older screenshot without knowing when it was sent or where it appeared in the available history, which made stale visual context harder to weigh against newer text.

Why This Change Was Made

resolveRecentInboundHistoryImages already walks structured InboundHistory entries with timestamps and stable order. This change preserves that metadata on each resolved image and includes it in the shared prompt note generated by appendRecentHistoryImageContext.

The fix stays in the shared history-media path, so ACP-backed Slack, Discord, Telegram, and other channel turns use one implementation without a new config surface. The prompt deliberately says message N of M in available history: InboundHistory is a bounded window, not necessarily the full transport thread.

Local media paths remain excluded from model-visible text.

User Impact

When a recent history image is attached to an ACP turn, the agent now receives metadata such as:

[Recent image 1 from @reporter, message msg-2, sent at 2023-11-14T22:13:20.000Z, message 2 of 3 in available history, attached as media.]

This gives the model an unambiguous timestamp and bounded ordering signal while retaining the image for compare/debug workflows.

Evidence

Current head: 8cb3cfc9b2fe12ce7847ca72340ba7841550b22e.

  • Blacksmith Testbox tbx_01kyrmgz8wqq8kb7renr345875, run https://github.com/openclaw/openclaw/actions/runs/30513999022:
    • src/auto-reply/reply/history.test.ts: 4 passed.
    • src/auto-reply/reply/dispatch-acp.test.ts: 66 passed.
    • Total: 70 passed across two Vitest shards.
  • Exact production-path assertions verify the history image is attached, the prompt contains sent time plus available-history position, and the local media path is absent.
  • oxfmt --check passed for both changed files.
  • git diff --check passed.
  • Fresh full-branch autoreview against current origin/main: clean, no accepted/actionable findings; patch-correct confidence 0.95.

Not run: a live credentialed Slack, Discord, or Telegram model conversation. The shared ACP attachment and prompt path is covered directly by the focused runtime tests above.

@clawsweeper

clawsweeper Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 30, 2026, 3:27 AM ET / 07:27 UTC.

ClawSweeper review

What this changes

The branch preserves each recent inbound image’s timestamp and bounded position in available history, then includes those facts in the ACP prompt note while retaining the media attachment and omitting its local path.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep this PR open for maintainer review. It is a focused implementation of the linked history-image context request, carries no new configuration surface, has failing-first and runtime-oriented proof in the discussion, and the latest review cycle found no actionable patch defect; required checks were still running at the supplied snapshot.

Priority: P2
Reviewed head: 821d3b1a2994ec2a18ba00c2517546ab29325ed0

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused patch with direct regression coverage and accepted runtime-oriented proof; the remaining gate is refreshed exact-head CI and maintainer review, not a demonstrated patch defect.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The PR discussion includes a redacted production-path runtime transcript plus a failing-first A/B result, and the prior completed review accepted proof for the current reviewed head; no additional contributor proof is needed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR discussion includes a redacted production-path runtime transcript plus a failing-first A/B result, and the prior completed review accepted proof for the current reviewed head; no additional contributor proof is needed.
Evidence reviewed 5 items Shared metadata path: The PR adds sent time and bounded history position to the resolved recent-image record, then renders both values in the shared ACP prompt note without rendering the local file path.
Focused regression coverage: The PR assertions cover attached history images, ISO timestamp text, bounded message position, and absence of the local media path from prompt text.
Failing-first evidence: A reviewer reported that the PR test fails against the base implementation and passes with the proposed fix, covering the stated timestamp-and-position behavior.
Findings None None.
Security None None.

How this fits together

Channel history is converted into recent image attachments before an ACP agent turn. The history-media layer carries sender, timestamp, message identifier, and position into a model-visible note so the agent can weigh older screenshots against newer conversation state.

flowchart LR
A[Channel history] --> B[Recent image resolver]
B --> C[Image metadata]
C --> D[ACP prompt note]
D --> E[Agent turn]
E --> F[Model response]
Loading

Before merge

  • Resolve merge risk (P1) - The branch is mergeable but behind the supplied current main revision, and several required checks were still in progress; merge should use a refreshed exact-head check result rather than the earlier base-only proof.
  • Complete next step (P2) - No concrete repair is indicated; wait for the in-progress exact-head checks and normal maintainer merge review.
Agent review details

Security

None.

PR surface

Source +12, Tests +71. Total +83 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 13 1 +12
Tests 1 71 0 +71
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 84 1 +83

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/auto-reply/reply/history-media.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    After the remaining required checks finish, maintainers should review the refreshed merge result and land this single shared history-media implementation if the exact head remains clean.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

After the remaining required checks finish, maintainers should review the refreshed merge result and land this single shared history-media implementation if the exact head remains clean.

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

Yes, at source level: the linked scenario is exercised by the focused ACP dispatch test, and the PR discussion reports a failing-first base-versus-fix result. A live credentialed channel conversation was not supplied, so this is not an independently reproduced live-channel failure.

Is this the best way to solve the issue?

Yes. Carrying metadata through the existing shared history-media path is narrower and more maintainable than channel-specific prompt changes, and it preserves image attachments while making their bounded history position explicit.

AGENTS.md: unclear because the file could not be read completely.

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

Labels

Label justifications:

  • P2: This improves model handling of stale visual context across ACP-backed channel replies, but the supplied evidence does not indicate an emergency availability, security, or data-loss regression.
  • 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): The PR discussion includes a redacted production-path runtime transcript plus a failing-first A/B result, and the prior completed review accepted proof for the current reviewed head; no additional contributor proof is needed.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR discussion includes a redacted production-path runtime transcript plus a failing-first A/B result, and the prior completed review accepted proof for the current reviewed head; no additional contributor proof is needed.

Evidence

What I checked:

  • Shared metadata path: The PR adds sent time and bounded history position to the resolved recent-image record, then renders both values in the shared ACP prompt note without rendering the local file path. (src/auto-reply/reply/history-media.ts:13, 821d3b1a2994)
  • Focused regression coverage: The PR assertions cover attached history images, ISO timestamp text, bounded message position, and absence of the local media path from prompt text. (src/auto-reply/reply/dispatch-acp.test.ts:1216, 821d3b1a2994)
  • Failing-first evidence: A reviewer reported that the PR test fails against the base implementation and passes with the proposed fix, covering the stated timestamp-and-position behavior. (src/auto-reply/reply/dispatch-acp.test.ts:1259, 159556f863af)
  • Latest review continuity: The previous ClawSweeper cycle reviewed head 821d3b1, reported no findings, and requested only a refreshed exact-head merge decision after the remaining checks complete. (821d3b1a2994)
  • Canonical issue relationship: The linked open issue requests timestamp and bounded position metadata for older thread-history images; this PR implements that requested shared history-media behavior. (src/auto-reply/reply/history-media.ts:104, 821d3b1a2994)

Likely related people:

  • vincentkoc: The supplied PR history attributes the bounded-history wording update and the latest main-merge refresh to this person, making them the strongest available routing candidate for the current branch state. (role: recent area contributor; confidence: medium; commits: 8cb3cfc9b2fe, 821d3b1a2994; files: src/auto-reply/reply/history-media.ts, src/auto-reply/reply/dispatch-acp.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the in-progress required checks, then review the exact merge head against current main.

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 (4 earlier review cycles)
  • reviewed 2026-07-06T12:09:05.335Z sha 159556f :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-06T16:46:26.045Z sha 159556f :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T05:06:09.922Z sha 8cb3cfc :: needs maintainer review before merge. :: none
  • reviewed 2026-07-30T07:23:26.150Z sha 821d3b1 :: needs maintainer review before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 6, 2026
@Hackerismydream

Copy link
Copy Markdown
Contributor Author

Added the missing redacted runtime proof to the PR Evidence section.

Summary of the new proof:

  • PR head: 159556f863af0816aaa81dd57150190c8753fa26
  • Path exercised: production resolveAgentTurnAttachments plus appendRecentHistoryImageContext against a redacted threaded ACP prompt context
  • Result: one recent inbound history image was re-attached as image/png
  • Agent-facing prompt includes sent at 2023-11-14T22:13:20.000Z and thread message 2 of 3
  • Redaction check: local_path_exposed=no
  • Crabbox/Testbox note: local Crabbox entrypoints are unavailable here (crabbox missing, ../crabbox/bin/crabbox missing, wrapper failed basic --version/--help sanity checks), so this is the closest available runtime transcript proof from this environment.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 6, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 28, 2026
@vincentkoc vincentkoc self-assigned this Jul 30, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label Jul 30, 2026
* origin/main: (24 commits)
  fix(e2e): apply default service identity per flow (openclaw#116265)
  chore(android): record 2026.7.4 Play metadata
  fix(ci): accept one verified Telegram SUT launch (openclaw#116267)
  chore(android): prepare 2026.7.4 Play release
  fix(e2e): align service account state (openclaw#116254)
  refactor(qa): remove live-channel scenario registries and wrappers (openclaw#115752)
  fix(ci): let trusted Telegram QA stage runtime (openclaw#116252)
  fix(plugins): plugin install survives pnpm-only overrides (openclaw#116245)
  test(qa): recognize internal image completions (openclaw#116234)
  fix(test): review Codex runtime scan chunks (openclaw#116212)
  fix(systemd): clear start-limit latch before gateway start (openclaw#116178)
  fix(security): expose every executable call in plugin scans (openclaw#116222)
  chore(sdk): repin the API baseline after the resolver signature change
  test(e2e): delay the draft-proof final answer past the start gate
  fix(channels): resolve tool progress against the caller's stream mode
  fix(ci): satisfy docs formatting, lint, and the SDK API baseline
  test(e2e): add a progress-draft scenario to the mock provider
  docs(telegram): call out the changed default preview on upgrade
  refactor(channels): render the progress label as a block, not a line
  fix(channels): show tool lines under the progress status headline
  ...
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@vincentkoc
vincentkoc merged commit ef5be76 into openclaw:main Jul 30, 2026
189 of 191 checks passed
@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

vincentkoc added a commit that referenced this pull request Jul 30, 2026
…n-dedupe

* origin/main: (25 commits)
  fix(qqbot): use Gateway timezone for reminders (#116294)
  test(openai): cover out-of-order named mark acks
  docs(openai): clarify cumulative playback marks
  test(openai): cover sustained unnamed mark acknowledgements
  fix(openai): preserve playback acknowledgement order
  test(openai): verify bounded playback acknowledgements
  fix(openai): bound realtime playback marks
  test(agents): mock incremental registry persistence (#116307)
  fix(memory-core): MEMORY.md compaction deletes user notes written under a promotion-style heading (#116180)
  feat(reply): annotate recent history images (#100866)
  chore(ios): refresh native i18n inventory
  fix(ios): isolate capability router handlers
  docs(ios): cut 2026.7.22 release notes
  docs(hooks): document validation responses
  test(qa): assert hook account rejection reasons
  fix(gateway): validate hook delivery accounts
  perf(gateway): bound prepared runtime startup work (#116261)
  fix(agents): prevent registry stalls during large fan-outs (#116286)
  fix(sqlite): preserve replaced snapshot targets on Windows (#116284)
  fix(ci): load frozen shard runner without repository fetch (#116273)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 31, 2026
* feat(reply): annotate recent history images

* fix(reply): describe bounded history image positions

---------

Co-authored-by: martin <[email protected]>
Co-authored-by: Vincent Koc <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 31, 2026
…n-dedupe

* origin/main: (25 commits)
  fix(qqbot): use Gateway timezone for reminders (openclaw#116294)
  test(openai): cover out-of-order named mark acks
  docs(openai): clarify cumulative playback marks
  test(openai): cover sustained unnamed mark acknowledgements
  fix(openai): preserve playback acknowledgement order
  test(openai): verify bounded playback acknowledgements
  fix(openai): bound realtime playback marks
  test(agents): mock incremental registry persistence (openclaw#116307)
  fix(memory-core): MEMORY.md compaction deletes user notes written under a promotion-style heading (openclaw#116180)
  feat(reply): annotate recent history images (openclaw#100866)
  chore(ios): refresh native i18n inventory
  fix(ios): isolate capability router handlers
  docs(ios): cut 2026.7.22 release notes
  docs(hooks): document validation responses
  test(qa): assert hook account rejection reasons
  fix(gateway): validate hook delivery accounts
  perf(gateway): bound prepared runtime startup work (openclaw#116261)
  fix(agents): prevent registry stalls during large fan-outs (openclaw#116286)
  fix(sqlite): preserve replaced snapshot targets on Windows (openclaw#116284)
  fix(ci): load frozen shard runner without repository fetch (openclaw#116273)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

Feature: Inject timestamp + position metadata on images in thread history

2 participants