Skip to content

fix(reply): keep unresolved image suppression out of the persisted transcript - #126749

Closed
yetval wants to merge 2 commits into
openclaw:mainfrom
yetval:fix/media-unresolved-turn-local
Closed

yetval wants to merge 2 commits into
openclaw:mainfrom
yetval:fix/media-unresolved-turn-local

Conversation

@yetval

@yetval yetval commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Summary

When a channel turn carries an inbound image and the turn-time attachment read fails once (the 1 second read budget or the 10 MiB cap in agent-turn-attachments, a transient EACCES/ENOENT while staging finishes, or any throw from the attachment runtime), the reply executor writes hydrationSuppressed: true into the durable user-turn transcript record for that image. Every later turn of the session replays that record, so the image is never loaded again even when the file is readable, and the loader no longer even counts it as a failed attachment, so nothing ever reports the loss. The photo silently disappears from the conversation for good.

This keeps the turn-local suppression exactly where it belongs (the run-scoped prompt media that suppressUnresolvedPromptMedia already produces) and stops copying the one-turn verdict into the durable record.

Root cause

src/auto-reply/reply/get-reply-run-execute.ts (introduced by #122361):

// before
const ctxMediaForPersistence = normalizeMediaFacts(ctx.media);
const unresolvedSourceIndexes = new Set(currentTurnImages.unresolvedSourceIndexes ?? []);
const persistedCtxMedia = ctxMediaForPersistence.map((fact, index) =>
  unresolvedSourceIndexes.has(index) ? { ...fact, hydrationSuppressed: true } : fact,
);
const userTurnMediaForPersistence = [...persistedCtxMedia, ...(opts?.media ?? [])];

unresolvedSourceIndexes is a turn-scoped result of resolveCurrentTurnImages; it reports that the fast pre-resolver could not read the bytes during this turn. hydrationSuppressed on a persisted media fact, however, is read by every later replay (images.ts skips the fact and images.media-refs.ts returns hydrate: false), and buildPersistedMediaImageLayout copies the flag into the persisted layout's suppressedFactIndexes. The persisted record therefore turns "unreadable right now" into "never hydrate". The sibling call on the next lines, suppressUnresolvedPromptMedia, applies the same flag to the run-scoped prompt media copy, which is the correct, turn-local place.

Fix

// after
const ctxMediaForPersistence = normalizeMediaFacts(ctx.media);
const unresolvedSourceIndexes = new Set(currentTurnImages.unresolvedSourceIndexes ?? []);
const userTurnMediaForPersistence = [...ctxMediaForPersistence, ...(opts?.media ?? [])];

The persisted facts and the persisted image layout now describe the attachment as it arrived. The unresolved image keeps an offloaded layout slot, so later turns hydrate it again from disk. The run-scoped promptMediaForRun and promptMediaImageLayout still carry the turn-local suppression, unchanged.

Why this is the right boundary

  • The durable transcript is the one place where the flag is replayed forever; the turn-local prompt copy already existed and already expires with the run.
  • This matches the gateway path: src/gateway/agent-turn/agent-run-user-turn.ts persists image facts and layout slots without any suppression, and the embedded runner hydrates from that record on the current turn. Channel turns now persist the same shape.
  • On the current turn the embedded runner hydrates from the persisted record exactly as it does for gateway turns: an unreadable file is logged and skipped for that turn, and the next turn tries again. The CLI runner and any path without a transcript recorder keep using the run-scoped suppressed copy, so fix(media): retain resolved images when native current media partially resolves #122361's partial-batch behavior (deliver the readable images, skip the unresolved one) is unchanged there.
  • Every other producer of hydrationSuppressed (media-note.ts for images already described as text, chat-attachments.ts for non-image MIME) records a property that is genuinely permanent and is untouched.

Related: #122361 introduced the persisted mapping while fixing the all-or-nothing drop; #122101 (open) tracks the current-turn symptom of partial resolution and does not cover the durable record. No other issue or PR describes the later-turn loss.

Verification

  • node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-run.media-only.test.ts: 124 passed (new case keeps unresolved current-turn images hydratable in the persisted transcript).
  • The new case fails on pristine main (hydrationSuppressed: true received in the persisted media) and passes with this patch.
  • node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-run-helpers.media-facts.test.ts src/auto-reply/reply/current-turn-images.test.ts src/auto-reply/reply/agent-runner.media-paths.test.ts src/agents/embedded-agent-runner/run/run-attempt-dispatch.media.test.ts: 4 files, 69 passed.
  • oxfmt --check and oxlint -c .oxlintrc.json on both changed files: clean.
  • tsgo core lane: node scripts/run-tsgo.mjs -p tsconfig.core.json clean (exit 0).

Real behavior proof

Behavior addressed: A one-turn failure to read an inbound photo was written into the durable transcript as hydrationSuppressed: true, so the photo was never sent to the model on any later turn of the session.
Real environment tested: Real getReplyFromConfig channel turns (WhatsApp-shaped inbound context with an image attachment), real on-disk config, session store and transcript under an isolated OPENCLAW_HOME, real embedded agent run against scripts/e2e/mock-openai-server.mjs on loopback as the only stand-in (provider HTTP boundary); run on pristine origin/main d40cbfe and on this patch with identical inputs. Turn 1 runs while the photo is chmod 000; the file is restored before turn 2.
Exact steps or command run after this patch: OPENCLAW_DISABLE_BUNDLED_PLUGINS=1 node --import tsx proof-hydration.mts from the patched tree (driver source below), then the same driver from a pristine origin/main checkout.
Evidence after fix:

# BEFORE (pristine origin/main d40cbfef475)
== BEFORE: TURN 1 (photo unreadable while the turn runs) ==
   reply: "OK"
   provider request /v1/chat/completions: user messages=2 image parts=0 resend notice=false
   session entries: 1
   transcript events for agent:main:whatsapp:direct:+1003: 8
   durable user turn media       : [{"path":"<home>/workspace/inbound/photo.png","contentType":"image/png","kind":"image","hydrationSuppressed":true}]
   durable user turn image layout: {"slots":[],"suppressedFactIndexes":[0]}
== BEFORE: TURN 2 (photo readable again, same conversation) ==
   reply: "OK"
   provider request /v1/chat/completions: user messages=2 image parts=0 resend notice=false

# AFTER (this patch, identical inputs)
== AFTER: TURN 1 (photo unreadable while the turn runs) ==
[agent/embedded] Native image: failed to load <home>/workspace/inbound/photo.png: EACCES: permission denied, open '<home>/workspace/inbound/photo.png'
   reply: "OK"
   provider request /v1/chat/completions: user messages=2 image parts=0 resend notice=false
   session entries: 1
   transcript events for agent:main:whatsapp:direct:+1003: 8
   durable user turn media       : [{"path":"<home>/workspace/inbound/photo.png","contentType":"image/png","kind":"image"}]
   durable user turn image layout: {"slots":[{"kind":"offloaded","factIndex":0}]}
== AFTER: TURN 2 (photo readable again, same conversation) ==
   reply: "OK"
   provider request /v1/chat/completions: user messages=2 image parts=1 resend notice=false

Observed result after fix: The durable user-turn record no longer carries hydrationSuppressed, its layout keeps an offloaded slot for the photo, and the second turn's provider request contains the photo as an image part (image parts=1) where pristine main sends none (image parts=0) and has stamped hydrationSuppressed: true plus suppressedFactIndexes: [0] into the record.
What was not tested: No live third-party channel or vision provider; the plugin harness and CLI runner paths were exercised only by their existing suites, not live. The "could not be loaded" notice did not appear in either run of this loopback setup, so this patch is not claimed to change that notice.

proof-hydration.mts (driver source)
import { spawn } from "node:child_process";
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { pathToFileURL } from "node:url";

const ROOT = process.cwd();
const LABEL = process.env.PROOF_LABEL ?? "run";
const home = fs.mkdtempSync(path.join(os.tmpdir(), `oc-hydration-${LABEL}-`));
const stateDir = path.join(home, ".openclaw");
process.env.HOME = home;
process.env.OPENCLAW_HOME = home;
process.env.OPENCLAW_STATE_DIR = stateDir;
delete process.env.VITEST;
delete process.env.NODE_ENV;

const TINY_PNG_BASE64 =
  "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAAAABJRU5ErkJggg==";

async function getFreePort(): Promise<number> {
  const net = await import("node:net");
  return await new Promise((resolve, reject) => {
    const server = net.createServer();
    server.once("error", reject);
    server.listen(0, "127.0.0.1", () => {
      const address = server.address();
      const port = typeof address === "object" && address ? address.port : 0;
      server.close(() => resolve(port));
    });
  });
}

async function waitHealth(port: number) {
  for (let i = 0; i < 200; i++) {
    try {
      const res = await fetch(`http://127.0.0.1:${port}/health`);
      if (res.ok) {
        return;
      }
    } catch {}
    await new Promise((r) => setTimeout(r, 50));
  }
  throw new Error("mock provider did not start");
}

function describeRequests(logPath: string, sinceLine: number) {
  const lines = fs.existsSync(logPath)
    ? fs.readFileSync(logPath, "utf8").split("\n").filter(Boolean)
    : [];
  const out: string[] = [];
  for (const line of lines.slice(sinceLine)) {
    const entry = JSON.parse(line) as { path: string; body: unknown };
    const body = (typeof entry.body === "string" ? JSON.parse(entry.body) : entry.body) as {
      messages?: unknown[];
    };
    const messages = Array.isArray(body?.messages) ? body.messages : [];
    const userMessages = messages.filter((m) => (m as { role?: string }).role === "user");
    let imageParts = 0;
    let notice = false;
    for (const message of userMessages) {
      const content = (message as { content?: unknown }).content;
      const parts = Array.isArray(content) ? content : [{ type: "text", text: content }];
      for (const part of parts as Array<{ type?: string; text?: string }>) {
        if (part.type === "image_url" || part.type === "image") {
          imageParts++;
        }
        if (typeof part.text === "string" && part.text.includes("could not be loaded")) {
          notice = true;
        }
      }
    }
    out.push(
      `   provider request ${entry.path}: user messages=${userMessages.length} image parts=${imageParts} resend notice=${notice}`,
    );
  }
  return { out, lineCount: lines.length };
}

async function main() {
  const port = await getFreePort();
  const requestLog = path.join(home, "provider-requests.jsonl");
  const mock = spawn(process.execPath, [path.join(ROOT, "scripts/e2e/mock-openai-server.mjs")], {
    env: { ...process.env, MOCK_PORT: String(port), MOCK_REQUEST_LOG: requestLog, SUCCESS_MARKER: "OK" },
    stdio: ["ignore", "ignore", "inherit"],
  });
  try {
    await waitHealth(port);
    const workspace = path.join(home, "workspace");
    const inboundDir = path.join(workspace, "inbound");
    fs.mkdirSync(inboundDir, { recursive: true });
    const photo = path.join(inboundDir, "photo.png");
    fs.writeFileSync(photo, Buffer.from(TINY_PNG_BASE64, "base64"));

    const cfg = {
      agents: {
        defaults: {
          model: { primary: "loopback/vision-model" },
          workspace,
          humanDelay: { mode: "off" },
          blockStreamingCoalesce: { idleMs: 1 },
        },
        list: [{ id: "main", default: true }],
      },
      models: {
        providers: {
          loopback: {
            baseUrl: `http://127.0.0.1:${port}/v1`,
            apiKey: "loopback-key",
            api: "openai-completions",
            models: [
              {
                id: "vision-model",
                name: "vision-model",
                api: "openai-completions",
                input: ["text", "image"],
                contextWindow: 128000,
                maxTokens: 4096,
                cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
              },
            ],
          },
        },
      },
      plugins: { allow: ["no-plugins-for-this-proof"] },
      channels: { whatsapp: { allowFrom: ["*"] } },
      session: { store: path.join(home, "sessions.json") },
    };

    fs.mkdirSync(stateDir, { recursive: true });
    fs.writeFileSync(path.join(stateDir, "openclaw.json"), JSON.stringify(cfg, null, 2));
    const { getReplyFromConfig } = await import(
      pathToFileURL(path.join(ROOT, "src/auto-reply/reply.js")).href
    );
    const base = {
      From: "+1003",
      To: "+2000",
      CommandAuthorized: true,
      SessionKey: "agent:main:whatsapp:direct:+1003",
    };

    console.log(`== ${LABEL}: TURN 1 (photo unreadable while the turn runs) ==`);
    fs.chmodSync(photo, 0o000);
    let reply = await getReplyFromConfig(
      { ...base, Body: "what is in this photo?", media: [{ path: photo, contentType: "image/png" }] },
      {},
    );
    fs.chmodSync(photo, 0o644);
    console.log(`   reply: ${JSON.stringify(Array.isArray(reply) ? reply[0]?.text : reply?.text)}`);
    let seen = describeRequests(requestLog, 0);
    console.log(seen.out.join("\n"));

    const sessions = await import(
      pathToFileURL(path.join(ROOT, "src/config/sessions/session-accessor.js")).href
    );
    const entries = sessions.listSessionEntriesCore
      ? await sessions.listSessionEntriesCore({
          agentId: "main",
          storePath: path.join(home, "sessions.json"),
        })
      : undefined;
    const list: Array<{ sessionKey: string; entry: { sessionId: string } }> = Array.isArray(entries)
      ? entries
      : Array.isArray(entries?.entries)
        ? entries.entries
        : [];
    console.log(`   session entries: ${list.length}`);
    for (const item of list) {
      const sessionKey = item.sessionKey ?? (item as { key?: string }).key;
      const sessionId = item.entry?.sessionId ?? (item as { sessionId?: string }).sessionId;
      const events = await sessions.loadTranscriptEvents({
        agentId: "main",
        storePath: path.join(home, "sessions.json"),
        sessionKey,
        sessionId,
      });
      console.log(`   transcript events for ${sessionKey}: ${(events as unknown[]).length}`);
      for (const event of events as Array<{ message?: { role?: string; __openclaw?: unknown } }>) {
        const message = event.message;
        if (message?.role !== "user") {
          continue;
        }
        const meta = (message.__openclaw ?? {}) as { media?: unknown; mediaImageLayout?: unknown };
        if (meta.media) {
          console.log(`   durable user turn media       : ${JSON.stringify(meta.media)}`);
          console.log(`   durable user turn image layout: ${JSON.stringify(meta.mediaImageLayout)}`);
        }
      }
    }

    console.log(`== ${LABEL}: TURN 2 (photo readable again, same conversation) ==`);
    reply = await getReplyFromConfig({ ...base, Body: "what did my photo show?" }, {});
    console.log(`   reply: ${JSON.stringify(Array.isArray(reply) ? reply[0]?.text : reply?.text)}`);
    seen = describeRequests(requestLog, seen.lineCount);
    console.log(seen.out.join("\n"));
  } finally {
    mock.kill("SIGKILL");
  }
  process.exit(0);
}

main().catch((error) => {
  console.error(error);
  process.exit(1);
});

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@clawsweeper clawsweeper Bot added merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 20, 2026
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed August 22, 2026, 1:10 AM ET / 05:10 UTC.

ClawSweeper review

What this changes

This PR stops one-turn image-read failures from marking durable channel-transcript media as permanently suppressed, while retaining prompt-only suppression for the current embedded run.

Regression provenance

Possible regression — probable (reviewed change; failure trace). No predecessor PR is attributed.

Merge readiness

⚠️ Needs maintainer review before merge - 3 items remain

The direct-path repair is sound, but queued collect-mode turns replace the recorder and lose the new transient suppression indexes, so an unresolved image can still be rehydrated during the same collected prompt.

Priority: P1
Reviewed head: 664cb71cdcc432785253b77348707831513c6f56
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The supplied runtime proof is strong, but collect-mode recorder replacement leaves a P1 same-turn regression path.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body includes a before/after real embedded-run trace with an on-disk unreadable image restored before turn two, showing durable state and provider image-part recovery through the production reply boundary.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body includes a before/after real embedded-run trace with an on-disk unreadable image restored before turn two, showing durable state and provider image-part recovery through the production reply boundary.
Evidence reviewed 6 items Current-main defect: Current main persists hydration suppression onto unresolved media facts, so the durable layout records those facts as suppressed rather than offloaded for later hydration.
Direct-path repair: The PR leaves persisted media unsuppressed and places unresolved source indexes on the ephemeral transcript recorder.
Prompt consumer: Embedded prompt assembly reads recorder media in preference to queued prompt media and applies only the recorder's prompt-suppressed indexes.
Findings 1 actionable finding [P1] Propagate suppression through collected queued turns
Security None None.

Live Verification

Command: pnpm openclaw --help

Result: PASS (completed)

pnpm openclaw --help
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126749-Pvjubc/target$ pnpm openclaw --help
$ node scripts/run-node.mjs --help
pnpm openclaw --help
[openclaw] Building TypeScript (dist is stale: missing_build_stamp - build stamp missing).
[openclaw] Building bundled plugin assets.
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 108.11 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[tsdown-build] invocation 1/2 finished in 0.7s
node_modules/web-tree-sitter/web-tree-sitter.js (2343:30) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2343:31 ]
      │
 2343 │           ASM_CONSTS[start] = eval(func);
      │                               ──┬─
      │                                 ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/web-tree-sitter/web-tree-sitter.js (2366:32) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
      ╭─[ node_modules/web-tree-sitter/web-tree-sitter.js:2366:33 ]
      │
 2366 │           moduleExports[name] = eval(func);
      │                                 ──┬─
      │                                   ╰─── Use of direct ˋevalˋ here.
      │
      │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
──────╯

node_modules/playwright-core/lib/coreBundle.js (65821:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65821:29 ]
       │
 65821 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

node_modules/playwright-core/lib/coreBundle.js (65828:28) [EVAL] Use of direct ˋevalˋ function is strongly discouraged as it poses security risks and may cause
issues with minification.
       ╭─[ node_modules/playwright-core/lib/coreBundle.js:65828:29 ]
       │
 65828 │               const value = eval(ˋ(${expr})ˋ);
       │                             ──┬─
       │                               ╰─── Use of direct ˋevalˋ here.
       │
       │ Help: Consider using indirect eval. For more information, check the documentation: https://rolldown.rs/guide/troubleshooting#avoiding-direct-eval
───────╯

[tsdown-build] invocation 2/2 finished in 14.4s
[plugin-control-plane-loads] verified 35 built modules with native require and checked doctor closures
runtime-postbuild: 10 phases completed in 4295ms (slowest: built plugin control-plane loads 3545ms)

OpenClaw 2026.8.1 (664cb71) — All your chats, one OpenClaw.

Usage: openclaw [options] [command]

Options:
  --container ‹name›   Run the CLI inside a running Podman/Docker container named ‹name› (default: env OPENCLAW_CONTAINER)
  --dev                Dev profile: isolate state under ~/.openclaw-dev, default gateway port 19001, and shift derived ports (browser/canvas)
  -h, --help           Display help for command
  --log-level ‹level›  Global log level override for file + console
… output truncated …

Assertions:

  • PASS expect_output: Usage:

How this fits together

Channel replies persist inbound media for session replay, while the embedded runner reads that record to build the current model prompt. This patch separates a transient attachment-read failure from durable media state reused by later turns.

flowchart LR
  A[Inbound channel image] --> B[Reply image resolution]
  B --> C[Durable transcript media]
  B --> D[Prompt-only suppression]
  C --> E[Embedded prompt assembly]
  D --> E
  E --> F[Model request]
Loading

Decision needed

Question Recommendation
Should this repair remain forward-only, or should maintainers define a safe recovery policy for older transcript records already stamped with transient hydration suppression? Ship forward-only: Fix the collect-mode propagation bug and preserve existing ambiguous records unchanged.

Why: Clearing stored suppression blindly could rehydrate images intentionally suppressed because they were already described or are not image payloads.

Before merge

  • Propagate suppression through collected queued turns (P1) - Collect mode replaces source recorders with a new recorder in queue/drain.ts, but it does not copy or offset promptSuppressedFactIndexes. Because prompt submission prefers that aggregate recorder's durable media over the collected prompt media, the unresolved fact is rehydrated again; plugin harnesses throw on it and other embedded runs register a current-turn failure. Carry the ephemeral indexes into the aggregate recorder and cover a collected batch. This was visible on the previously reviewed head.
  • Resolve merge risk (P1) - Existing transcript records already stamped with hydration suppression remain unrecoverable without a safe discriminator between transient failures and intentional permanent suppression.

Findings

  • [P1] Propagate suppression through collected queued turns — src/auto-reply/reply/get-reply-run-execute.ts:317-319
Agent review details

Security

None.

PR surface

Source +9, Tests +80. Total +89 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 4 13 4 +9
Tests 2 80 0 +80
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 93 4 +89

Review metrics

Metric Value Why it matters
Production versus tests production +13/-4; tests +80/-0 The production growth introduces an ephemeral recorder field, but its missing collect-mode propagation leaves the intended current-turn invariant incomplete.

Stored data model

Persistent data-model change detected: serialized state: src/agents/embedded-agent-runner/run/run-attempt-dispatch.media.test.ts, serialized state: src/auto-reply/reply/get-reply-run.media-only.test.ts, serialized state: src/sessions/user-turn-transcript.ts, serialized state: src/sessions/user-turn-transcript.types.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Preserve suppression through collection (recommended)
    Carry and offset prompt-only unresolved-media indexes when collect mode synthesizes its aggregate recorder, then add a collected-turn regression.
  2. Accept forward-only legacy handling
    Merge only after documenting that previously stamped transcript records remain unchanged because their stored suppression reason is ambiguous.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Carry prompt-only unresolved-media indexes through collected transcript recorders with durable-media offsets; add collect-mode coverage proving the durable record stays clean and the current prompt skips the unresolved fact.

Technical review

Best possible solution:

Propagate prompt-only suppression indexes through collected transcript recorders with durable-media offsets, while keeping persisted media clean; handle existing ambiguous records only under an explicit upgrade decision.

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

Yes. Source inspection shows collect mode synthesizes a new recorder without the ephemeral indexes that the embedded prompt consumer requires; a two-item collect regression can reproduce the failure.

Is this the best way to solve the issue?

No. The direct recorder boundary is appropriate, but the same transient state must survive the queue collector that replaces that recorder before prompt assembly.

Full review comments:

  • [P1] Propagate suppression through collected queued turns — src/auto-reply/reply/get-reply-run-execute.ts:317-319
    Collect mode replaces source recorders with a new recorder in queue/drain.ts, but it does not copy or offset promptSuppressedFactIndexes. Because prompt submission prefers that aggregate recorder's durable media over the collected prompt media, the unresolved fact is rehydrated again; plugin harnesses throw on it and other embedded runs register a current-turn failure. Carry the ephemeral indexes into the aggregate recorder and cover a collected batch. This was visible on the previously reviewed head.
    Confidence: 0.96
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body includes a before/after real embedded-run trace with an on-disk unreadable image restored before turn two, showing durable state and provider image-part recovery through the production reply boundary.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P1: Queued channel batches can still turn a transient unreadable image into a current-turn prompt failure.
  • merge-risk: 🚨 session-state: The patch changes durable transcript media and the ephemeral metadata that governs its same-turn replay.
  • merge-risk: 🚨 message-delivery: The affected prompt assembly determines whether an inbound image reaches the model during a collected channel turn.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): The PR body includes a before/after real embedded-run trace with an on-disk unreadable image restored before turn two, showing durable state and provider image-part recovery through the production reply boundary.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes a before/after real embedded-run trace with an on-disk unreadable image restored before turn two, showing durable state and provider image-part recovery through the production reply boundary.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs src/auto-reply/reply/queue.collect.test.ts.
  • [P1] node scripts/run-vitest.mjs src/auto-reply/reply/get-reply-run.media-only.test.ts src/agents/embedded-agent-runner/run/run-attempt-dispatch.media.test.ts.
  • [P1] node scripts/run-tsgo.mjs -p tsconfig.core.json.

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the persisted media mapping to the recent refactor commit that carries this behavior. (role: recent area contributor; confidence: high; commits: 980e67e2aee8; files: src/auto-reply/reply/get-reply-run-execute.ts)
  • SunnyShu0925: Authored the merged partial-image-resolution repair whose unresolved-image contract this PR is refining. (role: related feature contributor; confidence: medium; commits: 9594fe4623db; files: src/auto-reply/reply/get-reply-run-execute.ts, src/auto-reply/reply/current-turn-images.ts)

Rank-up moves

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

  • Propagate the prompt-only indexes through collect-mode recorder construction and add the corresponding regression.
  • State the chosen handling for older transcripts whose stored suppression reason cannot be safely inferred.

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 (3 earlier review cycles)
  • reviewed 2026-08-20T17:06:11.517Z sha 22958783b0426ba6a25b61717bdc8259084f766e :: needs changes before merge. :: [P1] Preserve current-turn suppression for plugin harnesses
  • reviewed 2026-08-20T18:25:31.411Z sha 664cb71 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-20T18:47:34.806Z sha 664cb71 :: needs maintainer review before merge. :: none

yetval added 2 commits August 20, 2026 13:56
…anscript

A turn-time failure to read an inbound image was written into the durable user-turn record as hydrationSuppressed, so every later turn skipped the image and the resend notice never fired. Persist the media facts as they arrived and keep the turn-local suppression on the run-scoped prompt media only.
…lugin harnesses

Plugin-owned harness preparation hydrates the current turn from the persisted user-turn record. Carry the unresolved fact indexes on the transcript recorder as a prompt-only view so that path still skips the unreadable attachment without the flag reaching the durable transcript.
@yetval
yetval force-pushed the fix/media-unresolved-turn-local branch from 2295878 to 664cb71 Compare August 20, 2026 18:18
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S and removed size: XS labels Aug 20, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. 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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. 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 Aug 20, 2026
@yetval

yetval commented Aug 22, 2026

Copy link
Copy Markdown
Contributor Author

Closing this PR. The defect is real and still reproduces on current main 259352aaf27, so I have filed it as a standalone bug report with the same before/after runtime proof: #127968.

Why close rather than keep iterating: the review is right that removing the persistence mapping here is not sufficient on its own. Queued collect-mode turns replace the transcript recorder and lose the run-scoped unresolved indexes, so an unresolved image can still be rehydrated inside the same collected prompt. Threading the turn-local verdict through recorder replacement means this fix does not live at this call site; the ownership of turn-scoped media suppression belongs with the recorder and prompt-assembly boundary, and picking that shape is a maintainer decision rather than something to keep patching from here.

The branch is left in place if anyone wants to pick it up. Happy to reopen or resubmit against whatever boundary the maintainers prefer.

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

Labels

agents Agent runtime and tooling merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant