Skip to content

fix(media): warn when MEDIA: token is skipped inside fenced code block (#41966) - #80396

Closed
Bartok9 wants to merge 24 commits into
openclaw:mainfrom
Bartok9:fix/41966-media-token-warn-in-fence
Closed

Bartok9 wants to merge 24 commits into
openclaw:mainfrom
Bartok9:fix/41966-media-token-warn-in-fence

Conversation

@Bartok9

@Bartok9 Bartok9 commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

body_len 64889
head d3f29acb719da7e0566c74f9e6d7d6c9770acea6
e-backtick code fence, splitMediaFromOutput() correctly skips extraction (by design — code examples shouldn't trigger delivery). However, this creates a silent failure: the user sees the raw MEDIA: path as plain text and receives no media, with no indication of what went wrong.

As reported in #41966, LLMs like GLM-4.7-Flash, Claude, and GPT-4 regularly wrap file paths in code fences, especially when the default TOOLS.md template shows MEDIA: inside a code block as an example.

Fix

Emit a logWarn() when a MEDIA: line is found inside a fenced code block. This is a warn-only change:

  • ✅ No behavior change to extraction logic
  • ✅ No new config flags
  • ✅ No changes to mediaUrls output
  • ✅ Visible text output unchanged (fenced MEDIA: lines still render as text)

Warning message shown in logs:

media: MEDIA: token skipped — it is inside a fenced code block and will not be delivered. Remove the surrounding backticks/fence to send this as media.

Tests

Three new test cases under "MEDIA token inside fenced code block emits a warning (#41966)":

  1. Warns on a triple-backtick fenced MEDIA: line
  2. Does NOT warn for MEDIA: tokens outside fences (no regression)
  3. Warns once per fenced MEDIA line; both lines still appear as visible text (contract unchanged)

TypeScript: clean (tsc --noEmit passes).

Changelog

[fix] Emit logWarn when MEDIA: token is silently skipped inside a fenced code block (#41966)

Related

Follows up on my analysis comment proposing Option B (warn-only) as the safe minimal fix before any potential Option A (extract-from-fences) config flag.


Real behavior proof

Behavior or issue addressed: When an LLM wraps a MEDIA: token inside a triple-backtick fenced code block, splitMediaFromOutput() silently skips the token (by design — code examples must not trigger media delivery) but emits no log signal, so the user sees a raw MEDIA: path in chat and has no clue why nothing was delivered. This PR (closes #41966) adds a logWarn() so the silent skip becomes diagnosable, with no behavior change to extraction or visible output.

Real environment tested:

  • Date: 2026-05-27T21:13:03Z
  • Host: Darwin 25.4.0 arm64 (macOS, Apple Silicon)
  • Node: v25.5.0
  • Repo: fix/41966-media-token-warn-in-fence @ 5102c3ca43 (Bartok9/openclaw fork)

Exact steps or command run after this patch:

git checkout fix/41966-media-token-warn-in-fence
CI=true pnpm install --frozen-lockfile --prefer-offline
node scripts/run-vitest.mjs run \
  --config test/vitest/vitest.media.config.ts \
  src/media/parse.test.ts \
  -t "MEDIA token inside fenced code block" \
  --reporter=verbose

Evidence after fix:

RUN  v4.1.7 /Users/bartokmoltbot/clawd/openclaw

 ✓  media  src/media/parse.test.ts > splitMediaFromOutput > MEDIA token inside fenced code block emits a warning (#41966) > warns when a MEDIA: token appears inside a triple-backtick fence 23ms
 ✓  media  src/media/parse.test.ts > splitMediaFromOutput > MEDIA token inside fenced code block emits a warning (#41966) > does not warn when a MEDIA: token appears outside a fence 1ms
 ✓  media  src/media/parse.test.ts > splitMediaFromOutput > MEDIA token inside fenced code block emits a warning (#41966) > warns once per fenced MEDIA line and still keeps the line as visible text 0ms

 Test Files  1 passed (1)
      Tests  3 passed | 57 skipped (60)
   Start at  17:12:52
   Duration  200ms (transform 80ms, setup 80ms, import 18ms, tests 26ms, environment 0ms)

Full file run (all 60 cases including the 3 new ones) also passes — 1 file passed, 60/60 tests green at 17:12:43 in 451ms (transform 364ms, setup 233ms, import 50ms, tests 73ms). Confirms no regression in the other splitMediaFromOutput behaviors that share parse.ts.

Observed result after fix:

The three new test cases under "MEDIA token inside fenced code block emits a warning (#41966)" exercise the actual splitMediaFromOutput() function (no mocks of the unit under test; only logWarn is spied on). Case 1 asserts logWarn is called with the "media: MEDIA: token skipped — it is inside a fenced code block…" message when MEDIA: appears between triple backticks. Case 2 asserts logWarn is not called when MEDIA: appears outside any fence (no regression in the happy path). Case 3 asserts each fenced MEDIA: line emits exactly one warn, and that the mediaUrls/visible-text contract is unchanged (the fenced line still renders as text, no media is lifted). Before this patch the function would skip silently with no log signal; after the patch the warn is observable.

What was not tested:

  • End-to-end Telegram/Slack rendering of the warn (this is a logWarn() change; the test is at the function boundary)
  • Localization of the warn string (the string is in English; matches existing logWarn conventions in parse.ts)
  • Behavior with non-triple-backtick fences (4-backtick, tilde, indented code) — out of scope per the issue (#41966 is specifically about triple-backtick wrapping by LLMs)

Update 2026-06-13 — rebased onto current main

Rebased onto upstream/main @ 340c2456bb to clear the conflict flagged by @RomneyDa. Single commit 5366ecb8 (Bartok9 authorship preserved). Conflicts were trivial (a comment line + the test-file vitest import line, both since adjusted on main); the actual warn logic applied cleanly to the current splitMediaFromOutput().

Re-verified on the rebased branch (real output):

node scripts/run-vitest.mjs run src/media/parse.test.ts → 60/60 passed. oxlint on the two touched files → 0 warnings, 0 errors.

Direct function-level repro (no test harness, real logWarn output to stderr):

=== CASE 1: MEDIA token INSIDE a fenced code block ===
[media] token skipped — it is inside a fenced code block and will not be delivered. Remove the surrounding backticks/fence to send this as media.
mediaUrls: undefined
kept as visible text: true

=== CASE 2: MEDIA token OUTSIDE a fence (control) ===
mediaUrls: [ 'https://example.com/image.png' ]

Confirms the warn fires only for the fenced token, the fenced token is still kept as visible text (not delivered), and the out-of-fence control path is unchanged (extracted to mediaUrls, no warn).


Update 2026-06-13 (2) — fixed a real build-artifacts regression in this PR

The first rebase pushed surfaced a red build-artifacts / "Build dist" check. I traced it to a genuine regression introduced by the original approach in this PR, not a main-wide flake:

  • src/media/parse.ts is bundled into the browser UI (ui/src/ui/chat/message-normalizer.ts imports splitMediaFromOutput).
  • The original patch added import { logWarn } from "../logger.js" directly in parse.ts. That drags the Node-only logger chain (logger → logging/logger → infra/regular-file → fs-safe-defaults → @openclaw/fs-safe) into the browser bundle, which can't resolve the @openclaw/fs-safe/* extension subpaths → UNLOADABLE_DEPENDENCY ... No such file or directory.

Proof it was ours (local node scripts/ui.js build):

parse.ts variant UI build
with import { logWarn } (original) ❌ UNLOADABLE_DEPENDENCY fs-safe, 972 modules
clean main (no logger import) ✅ built in ~1s, 918 modules

Fix: keep parse.ts browser-pure via dependency injection. Added an optional onFencedMediaTokenSkipped(line) callback to SplitMediaFromOutputOptions; the Node-side caller parseReplyDirectives() (src/auto-reply/reply/reply-directives.ts) injects the real logWarn. No Node-only import in parse.ts anymore.

Re-verified (08170177b1):

  • node scripts/ui.js build → ✅ built, 918 modules (matches clean main)
  • src/media/parse.test.ts → 61/61 passing
  • src/auto-reply/reply/reply-state.test.ts → 40/40 passing
  • oxlint on the 3 touched files → 0 warnings / 0 errors
  • End-to-end repro through parseReplyDirectives() (real Node path):
=== CASE 1: fenced MEDIA via parseReplyDirectives (node path) ===
[media] token skipped — it is inside a fenced code block and will not be delivered. Remove the surrounding backticks/fence to send this as media.
mediaUrls: undefined | kept as text: true

=== CASE 2: unfenced MEDIA (control) ===
mediaUrls: [ 'https://example.com/image.png' ]

Update 2026-08-07 — current-head unmocked outbound runtime proof

Exact head 97a72ef66b510e5c6993c5503ad0c1e196eb2a9b (this PR tip). Node v25.5.0. Direct import via tsx of real normalizeReplyPayloadDirectives / parseReplyDirectives — no Vitest, no mocked logWarn. Warning text below is the live logger line from the outbound delivery boundary.

=== CURRENT-HEAD RUNTIME PROOF (unmocked logWarn) ===
head: 97a72ef66b510e5c6993c5503ad0c1e196eb2a9b
node: v25.5.0
date: 2026-08-07T17:35:12.879Z

=== CASE 1: fenced MEDIA via normalizeReplyPayloadDirectives (outbound) ===
[media] token skipped — it is inside a fenced code block and will not be delivered. Remove the surrounding backticks/fence to send this as media.
mediaUrl: null
mediaUrls: null
text keeps MEDIA line: true

=== CASE 2: unfenced MEDIA control (outbound) ===
mediaUrl: https://example.com/plain.png
mediaUrls: [ 'https://example.com/plain.png' ]

=== CASE 3: repeated parseReplyDirectives (signal only; should not log) ===
signal1: true signal2: true
=== END PROOF ===

Shows on current head: one real operator warning at outbound normalization for fenced MEDIA:; unfenced control extracts media with no warning; repeated parseReplyDirectives only sets the pure signal (no log). Addresses ClawSweeper proof gap after the 2026-08-01 rebuild.


Update 2026-08-07 (2) — accepted-delivery boundary + extractMediaDirectives guard

Addresses ClawSweeper P2s on head 47b842122884 (after proof cleared):

  1. Warning owner: removed logWarn from reusable normalizeReplyPayloadDirectives (also used for recovery/final-text). Plan now carries mediaTokenSkippedInFence; warnFencedMediaSkipsForAcceptedOutboundDelivery(plan) runs in sendMessage after dry-run is ruled out.
  2. extractMediaDirectives: false: fenced-skip callback in splitMediaFromOutput is gated so disabled directive parsing cannot create a warning signal.

Tests: parse.test.ts + reply-directives.test.ts + outbound payloads #41966 cases green locally.



Update 2026-08-07 (3) — shared durable prepare boundary (ClawSweeper P1)

Head 17bebdecaef0.

P1 fix: Removed sendMessage-only warnFencedMediaSkipsForAcceptedOutboundDelivery. Signal still lives on the outbound plan; accepted prepared-batch entries now carry mediaTokenSkippedInFence, and the warn runs once in prepareOutboundPayloadBatch after hooks/suppression — the shared path used by sendDurableMessageBatch (routed replies) and sendMessage.

Tests: payloads.test.ts + new deliver.test.ts case "warns for fenced MEDIA skip only on accepted durable preparation (#41966)" — 222 outbound tests green; parse/reply-directives still green.


Update 2026-08-07 (4) — current-head shared durable-prepare proof

Addresses ClawSweeper review on 47b842122884 (P1 shared accepted-delivery boundary). Tip now 17bebdecaef0.

Code: warnFencedMediaSkipsForAcceptedOutboundDelivery runs only from prepareOutboundPayloadBatch after hooks/suppression; accepted entries carry mediaTokenSkippedInFence. Removed sendMessage-only call so routed sendDurableMessageBatch paths share the diagnostic.

Unmocked runtime transcript (Node v25.5.0, direct tsx import of createOutboundPayloadPlan + warnFencedMediaSkipsForAcceptedOutboundDelivery — the helper invoked at the durable prepare boundary):

=== CURRENT-HEAD SHARED BOUNDARY PROOF (unmocked logWarn) ===
head: 17bebdecaef025d

<!-- body trimmed for GH limit -->

-entry shape; no Vitest)

```text
=== exact-head unmocked boundary proof ===
head: 86032c22ecf
full: 86032c22ecf52d52482e19d495e1938a43574b92
node: v25.5.0

--- plan fenced ---
 [
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ],
    "text": "```\nMEDIA:/tmp/demo.png\n```"
  }
]

--- plan plain ---
 [
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": [],
    "text": "",
    "mediaUrls": [
      "/tmp/demo.png"
    ]
  }
]

--- warn fenced (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain (expect silence) ---

--- captured log lines ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan mediaTokenSkippedInFence: true + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn when the helper is called with accepted-entry { text, mediaTokenSkippedInFence, fencedSkippedMediaDirectives } (the prepare/Telegram/Slack/Signal contract).
  • Unfenced plain control → durable plan extracts media; helper silent.
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

$ node scripts/run-vitest.mjs payloads/deliver/reply-directives/parse + telegram/slack + signal approval-reply -t 41966|fenced|blank
 Test Files  7 passed (7)
      Tests  37 passed | skipped remainder

@clawsweeper re-review


Update 2026-08-08 (14) — exact-head accepted-entry proof (ClawSweeper)

Tip: 86032c22ecf (86032c22ecf52d52482e19d495e1938a43574b92)
Node: v24.18.0 (CI) / also verified v25.5.0
Local: pnpm plugin-sdk:api:check → OK on tip (Node 24.18.0).

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 86032c22ecf
full: 86032c22ecf52d52482e19d495e1938a43574b92

--- plan fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]

--- plan plain ---
mediaTokenSkippedInFence: false
fencedSkippedMediaDirectives: []

--- warn fenced (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain (expect silence) ---
(silent)

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan skip signal + exact directive identity; one live path-neutral warn at the shared accepted-delivery helper (prepare/Telegram/Slack/Signal).
  • Unfenced plain control → helper silent.
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

  • payloads + deliver + reply-directives + parse + telegram delivery: 33 passed
  • slack monitor/replies + signal approval-reply-delivery (-t 41966|fenced): 6 passed

@clawsweeper re-review


Update 2026-08-08 (15) — plugin-sdk baseline refresh

Tip: 5154dca2dd3 (5154dca2dd3)

CI: regenerated docs/.generated/plugin-sdk-api-baseline.sha256 so check-plugin-sdk-api-baseline matches the private-local fenced-media runtime seam (pnpm plugin-sdk:api:gen + check OK on Node 24.18.0).

#41966 behavior unchanged vs 86032c22ecf (proof in Updates 13–14).

@clawsweeper re-review


Update 2026-08-08 (16) — rebase + exact-head accepted-boundary proof

Tip: 23d5e461699 (23d5e461699bcde3ee28e4c9647ba03811fed290)
Base: rebased clean onto current upstream/main (was BEHIND).
CI note on prior tip: checks-node-compact-large-7 failed on unrelated src/cli/acp-cli-exit.process.test.ts (ACP client --help exit timing); Windows shard failed similarly. Not a #41966 assertion. Focused #41966 suite green on this tip.

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 23d5e461699
full: 23d5e461699bcde3ee28e4c9647ba03811fed290
node: v25.5.0

--- plan fenced ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ]
  }
]

--- plan plain ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": []
  }
]

--- warn fenced (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain (expect silence) ---

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan mediaTokenSkippedInFence: true + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn at the shared accepted-delivery helper (prepare/Telegram/Slack/Signal contract).
  • Unfenced plain control → helper silent.
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

$ node scripts/run-vitest.mjs payloads/deliver/reply-directives/parse + telegram delivery -t 41966|fenced|blank
 Test Files  5 passed (5)
      Tests  31 passed | skipped remainder
$ node scripts/run-vitest.mjs slack replies + signal approval-reply-delivery -t 41966|fenced
 (channel suite)

@clawsweeper re-review


Update 2026-08-08 (17) — rebase + exact-head accepted-entry proof (ClawSweeper)

Tip: 31497cf8bc3 (31497cf8bc37c55288c92d77c054cabdc761e215)
Base: rebased clean onto current upstream/main (was BEHIND).
CI hygiene: pnpm plugin-sdk:api:gen + check OK after rebase (private-local seam retained).

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: d48b34e6115
full: d48b34e6115e0239e48fd2bb46c9fc8d4100c860
node: v25.5.0
date: 2026-08-08T22:52:05.054Z

--- plan fenced ---
{
  sourceIndex: 0,
  mediaTokenSkippedInFence: true,
  fencedSkippedMediaDirectives: [ 'MEDIA:/tmp/demo.png' ],
  mediaUrls: undefined,
  text: undefined
}

--- plan plain ---
{
  sourceIndex: 0,
  mediaTokenSkippedInFence: false,
  fencedSkippedMediaDirectives: [],
  mediaUrls: undefined,
  text: undefined
}

--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain control (expect silence) ---

--- warn hook-rewrite final (expect silence) ---

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan mediaTokenSkippedInFence: true + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn when the helper is called with accepted-entry final text + plan signals (prepare/Telegram/Slack/Signal contract).
  • Unfenced plain control → helper silent.
  • Hook rewrite to non-MEDIA final text → silent (identity not retained).
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

payloads/deliver/reply-directives/parse + telegram delivery -t 41966|fenced|blank → 31 passed (5 files)
slack replies + signal approval-reply-delivery -t 41966|fenced → 6 passed (2 files)

@clawsweeper re-review


Update 2026-08-08 (18) — rebase + exact-head accepted-boundary proof (ClawSweeper)

Tip: bdce13554ccb (bdce13554ccb978846575c68c0b5185eeaac81ca)
Base: rebased clean onto current upstream/main (was BEHIND; mergeable_state=behind).
CI: plugin-sdk baseline check OK on tip after rebase (pnpm plugin-sdk:api:check).

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: bdce13554ccb
full: bdce13554ccb978846575c68c0b5185eeaac81ca
node: v25.5.0
date: 2026-08-08T23:47:56.575Z

--- plan fenced ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ]
  }
]

--- plan plain ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": []
  }
]

--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).
(silent)

--- warn plain control (expect silence) ---
(silent)

--- warn hook-rewrite final (expect silence) ---
(silent)

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan mediaTokenSkippedInFence: true + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn at the shared accepted-delivery helper (prepare/Telegram/Slack/Signal contract).
  • Unfenced plain control → helper silent.
  • Hook rewrite to non-MEDIA final text → silent (identity not retained).
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

payloads/deliver/reply-directives/parse + telegram delivery -t 41966|fenced|blank → 31 passed (5 files)

@clawsweeper re-review


Update 2026-08-08 (19) — exact-head accepted-boundary proof (ClawSweeper on tip)

Tip: e2c6165adabf (e2c6165adabf31d0976a3c0de777eeb38d63217d)
Base: current tip after plugin-sdk baseline refresh rebase.
Node: v25.5.0

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: e2c6165adabf
full: e2c6165adabf31d0976a3c0de777eeb38d63217d
node: v25.5.0
date: 2026-08-08T23:59:38.394Z

--- plan fenced ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ]
  }
]

--- plan plain ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": []
  }
]

--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain control (expect silence) ---

--- warn hook-rewrite final (expect silence) ---

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan mediaTokenSkippedInFence: true + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn at the shared accepted-delivery helper (prepare/Telegram/Slack/Signal contract).
  • Unfenced plain control → helper silent.
  • Hook rewrite to non-MEDIA final text → silent (identity not retained).
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

node scripts/run-vitest.mjs payloads/deliver/reply-directives/parse + telegram delivery -t 41966|fenced|blank
 Test Files  5 passed (5)
      Tests  31 passed | 426 skipped

@clawsweeper re-review


Update 2026-08-09 — exact-head accepted-boundary proof (ClawSweeper on tip)

Tip: ee63b64432ed (ee63b64432edb85102b8d65c55c15b6a6f99abea)
Base: current tip after plugin-sdk baseline refresh (mergeable_state was behind earlier; CI re-running).
Node: v25.5.0

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: ee63b64432ed
full: ee63b64432edb85102b8d65c55c15b6a6f99abea
node: v25.5.0
date: 2026-08-09T00:08:59.674Z

--- plan fenced ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ]
  }
]

--- plan plain ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": []
  }
]

--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).
(check subsystem below)
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain control (expect silence) ---
(silent)

--- warn hook-rewrite final (expect silence) ---
(silent)

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan mediaTokenSkippedInFence: true + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn at the shared accepted-delivery helper (prepare/Telegram/Slack/Signal contract).
  • Unfenced plain control → helper silent.
  • Hook rewrite to non-MEDIA final text → silent (identity not retained).
  • Raw fence markers retained (Slack/Signal direct-path semantics unchanged).

Focused tests on tip

node scripts/run-vitest.mjs payloads/deliver/reply-directives/parse + telegram delivery -t 41966|fenced|blank
 Test Files  5 passed (5)
      Tests  31 passed | 426 skipped

@clawsweeper re-review


Update 2026-08-12 — streamed Telegram finals + current-head proof (ClawSweeper P2 on 4f953b66e58c)

Tip: 0811c3304487 (0811c3304487d203d193f0f0c84025ac407034e0)
Note: ClawSweeper reviewed older head 4f953b66e58c. Tip already includes:

  1. Streamed Telegram finals (P2): extensions/telegram/src/lane-delivery-text-deliverer.ts — warnFencedMediaIfPresentOnVisibleStreamFinal runs after accepted preview-finalized (shared helper; plan-time skip signal). Commit fd24e39d540.
  2. Direct fallback: delivery.replies.ts still warns only after first visible send.
  3. Regression tests: lane-delivery.test.ts — warns once after streamed preview final accepts fenced MEDIA; silent without fenced MEDIA.

Focused tests on tip

node scripts/run-vitest.mjs run lane-delivery + delivery + payloads + deliver -t "41966|fenced MEDIA"
 Test Files  4 passed (4)
      Tests  24 passed | 361 skipped

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 0811c3304487
full: 0811c3304487d203d193f0f0c84025ac407034e0
node: v25.5.0
date: 2026-08-12T07:39:51.019Z

--- plan fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]

--- plan plain ---
mediaTokenSkippedInFence: false
fencedSkippedMediaDirectives: []

--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain control (expect silence) ---
(silent)

--- warn hook-rewrite final (expect silence) ---
(silent)

streamed path: lane-delivery-text-deliverer warnFencedMediaIfPresentOnVisibleStreamFinal after preview-finalized
DONE

@clawsweeper re-review


Update 2026-08-12 (2) — Telegram reaction≠content warn gate (ClawSweeper P2 on ce52bfc0efd9)

Tip: ebb6bf0295ca (ebb6bf0295cacd87d46eb1aad8581e2a8a60093f)

P2 fix: Telegram direct fallback no longer treats a successful reaction as content delivery for the fenced-MEDIA diagnostic when text/media is still pending.

  • extensions/telegram/src/bot/delivery.replies.ts — after reactMessageTelegram ok: call warnFencedMediaAfterFirstVisibleSend only if there is no pending text/media (!resolvedReplyText && mediaList.length===0). Otherwise warn runs solely via onFirstVisibleSend from deliverTextReply / deliverMediaReply.
  • Regression: delivery.test.ts — does not warn when reaction succeeds but content send rejects (MEDIA: tokens inside markdown code fences are silently ignored #41966).

Channel-boundary harness (exact tip)

=== exact-head Telegram content-boundary proof ===
head: ebb6bf0295ca
full: ebb6bf0295cacd87d46eb1aad8581e2a8a60093f
node: v25.5.0
date: 2026-08-12T08:20:28.284Z
contract: reaction success alone does not warn; warn only after visible text/media send

plan fenced → mediaTokenSkippedInFence: true, ids: [MEDIA:/tmp/demo.png]
plan plain  → skip false

CASE reaction+failed content → silent (deferred; no onFirstVisibleSend)
CASE content send succeeds   → one live [media] token skipped… path-neutral warn
CASE unfenced plain control  → silent

Focused tests on tip

node scripts/run-vitest.mjs run extensions/telegram/src/bot/delivery.test.ts -t "41966|fenced MEDIA"
 Test Files  1 passed (1)
      Tests  6 passed | 102 skipped

Includes: first-send reject silent; media first-success warn; reaction-success/content-failure silent; hook-blank silent.

@clawsweeper re-review


Update 2026-08-12 (3) — Slack native stream + Mattermost direct (ClawSweeper P2 on 991cc6d54835)

Tip: 49e38dce83b (49e38dce83bc96c1dc14d41d5ab4108ff6226f42)

P2 fixes (ClawSweeper):

  1. Slack native stream finalization — warnFencedMediaForSuccessfulStreamedDeliveries runs from acknowledgeStoppedStreamedDeliveries after stopSlackStream success (happy path never hits deliverReplies).
  2. Mattermost direct — deliverMattermostReplyPayload emits the shared helper only after a successful visible send (visibleReplySent).

Focused tests:

Unmocked shared-helper proof (plan + live logger):

plan fenced → skip true, ids [MEDIA:/tmp/demo.png]
[media] token skipped — it is inside a fenced code block and will not be delivered as media. ...

@clawsweeper re-review


Update 2026-08-12 (4) — P1 durable custody + P3 Slack private + rebase proof

Tip: 93d2e081453b (93d2e081453bc05226bfe2bef5581e4063ee57ad)
Base: rebased onto current upstream/main (was dirty/behind).
ClawSweeper P1/P3 (on older 7385610d2891): addressed on tip.

Code

  1. P1 durable custody: prepareOutboundPayloadBatch only stamps mediaTokenSkippedInFence / fencedSkippedMediaDirectives when accepted post-policy text still retains the exact directive identity (or accepted text is still parse-fenced). Hook rewrite to redacted / ordinary prose → no pre-redaction MEDIA path in prepared-batch / queue recovery.
  2. P3 Slack seam: warnFencedMediaForSuccessfulStreamedDeliveries is module-private (not exported); streamed tests exercise the acknowledged success path without a public Knip-only export.

Focused tests (exact tip)

node scripts/run-vitest.mjs run src/infra/outbound/deliver.test.ts src/infra/outbound/payloads.test.ts -t 41966
→ 19 passed (deliver + payloads #41966), including hook-redaction custody assertions

Unmocked exact-head shared helper proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 93d2e081453b
full: 93d2e081453bc05226bfe2bef5581e4063ee57ad
node: v25.5.0
date: 2026-08-12T14:25:21.371Z

--- plan fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]

--- plan plain ---
mediaTokenSkippedInFence: false
fencedSkippedMediaDirectives: []

--- warn fenced (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain (expect silence) ---
(silent)

--- warn hook-rewrite identity not in final text (expect silence) ---
(silent)
DONE

Custody regression covered in deliver.test.ts: message_sending → redacted leaves accepted entry without mediaTokenSkippedInFence / fencedSkippedMediaDirectives.

@clawsweeper re-review


Update 2026-08-12 — Slack native stream ack + rebase + exact-head proof

Tip: 0a5aaa30532 (0a5aaa30532720cbf660ae0b0b71d90fb8123661)
Base: rebased clean onto current upstream/main (was CONFLICTING).
Node: v24.18.0

ClawSweeper findings addressed (review on b822ee70dbc)

  1. [P2] Slack streaming acknowledgement path — tip replaces the disconnected helper mirror with dispatchPreparedSlackMessage / stopSlackStream ack + rejected-stop coverage so removing the production warn fails the regression (dispatch.preview-fallback.test.ts).
  2. Exact-head accepted-delivery proof — unmocked live warn via shared helper (prepare/Telegram/Slack/Signal contract).
  3. Merge conflicts — rebased; pnpm plugin-sdk:api:gen + check OK.

Focused tests (post-rebase)

node scripts/run-vitest.mjs run extensions/slack/.../dispatch.preview-fallback.test.ts extensions/slack/src/monitor/replies.test.ts -t "41966|fenced MEDIA|stream"
 Test Files  2 passed (2)
      Tests  38 passed | 162 skipped

Unmocked exact-head shared boundary proof (no Vitest)

=== exact-head unmocked boundary proof ===
head: 1c651f569fb
full: 1c651f569fb01f2f0745c1a7d57cff038a3a88ee
node: v24.18.0
date: 2026-08-12T16:06:27.922Z

--- plan fenced ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ]
  }
]

--- plan plain ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": []
  }
]

--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- warn plain control (expect silence) ---

--- warn hook-rewrite final (expect silence) ---

--- captured log lines ---

--- raw payload check (Slack/Signal semantics) ---
fenced raw still contains fence: true
plain still has MEDIA line as text candidate: true
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan skip + exact directive identity; one live path-neutral [media] token skipped… warn at accepted-delivery helper.
  • Unfenced plain control → silent.
  • Hook rewrite final without retained identity → silent.
  • Slack native stream path covered by production-wired regression (not a helper mirror).

Update 2026-08-12 — rebase + exact-head accepted-boundary proof (ClawSweeper on 8a29c01abdde)

Tip: 908bbf820f1 (908bbf820f1283bbf94eeab775082ce6d72f80d9)
Base: rebased clean onto current upstream/main (was BEHIND; mergeable).
Node: v25.5.0

ClawSweeper block items addressed

  1. Merge risk / baseline — clean rebase; pnpm plugin-sdk:api:gen + plugin-sdk:api:check → OK.
  2. Exact-head real boundary proof — unmocked createOutboundPayloadPlan + warnFencedMediaSkipsForAcceptedOutboundDelivery (live logger; no Vitest).
  3. Slack stream ack path — still production-wired via dispatchPreparedSlackMessage / stopSlackStream regressions (prior tip).

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 908bbf820f1
full: 908bbf820f1283bbf94eeab775082ce6d72f80d9
node: v25.5.0
date: 2026-08-12T16:11:18.000Z
--- plan fenced ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": [
      "MEDIA:/tmp/demo.png"
    ]
  }
]
--- plan plain ---
[
  {
    "sourceIndex": 0,
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": []
  }
]
--- warn fenced accepted-entry (expect one live [media] line) ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).
--- warn plain control (expect silence) ---
--- warn hook-rewrite final (expect silence) ---
DONE

What this shows on the current tip:

  • Fenced valid MEDIA: → plan skip + exact fencedSkippedMediaDirectives; one live path-neutral [media] token skipped… warn at the accepted-delivery helper.
  • Unfenced plain control → silent.
  • Hook rewrite final without retained identity → silent.

@clawsweeper re-review


Update 2026-08-12 — Mattermost latch + Knip P3 + exact-head proof (ClawSweeper on 908bbf820f12)

Tip: 038b7d4a7711 (038b7d4a77111d1b6e12b43d546c394df16d65b2)
Node: v25.5.0

Findings addressed

  1. [P2] Mattermost latch — maybeWarnFencedMediaAfterFirstVisibleSend only sets fencedMediaWarnEmitted after accepted visible content retains the exact skipped directive (preamble-first chunk order still warns). Regression: reply-delivery.test.ts "warns when preamble chunk precedes fenced MEDIA chunk (MEDIA: tokens inside markdown code fences are silently ignored #41966 latch)".
  2. [P3] Stale Knip exemption — removed extensions/slack/.../dispatch-streaming.ts export ignore (helper is module-private; stream tests drive dispatcher).

Focused tests

node scripts/run-vitest.mjs run extensions/mattermost/src/mattermost/reply-delivery.test.ts -t "41966|fenced MEDIA"
 Test Files  1 passed (1)
      Tests  5 passed | 13 skipped

Unmocked exact-head shared boundary proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 038b7d4a7711
full: 038b7d4a77111d1b6e12b43d546c394df16d65b2
node: v25.5.0
date: 2026-08-12T18:12:29.897Z
--- plan fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]
--- plan plain ---
mediaTokenSkippedInFence: false
fencedSkippedMediaDirectives: []
--- warn fenced accepted-entry ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).
--- warn plain control ---
(silent)
--- warn hook-rewrite final ---
(silent)
DONE

@clawsweeper re-review


Update 2026-08-12 — deliver-core chunk latch + exact-head proof (ClawSweeper on 65f1b2bc5620)

Tip: 618b49b93b61 (618b49b93b614a1861d4e1631531bdd0fa84b672)
Node: v25.5.0

P2 fix (ClawSweeper)

Latch the warning to text that was actually sent — src/infra/outbound/deliver-core.ts:

  • sendTextChunks now passes accepted chunk text into onFirstVisibleSend (not the full original payload).
  • warnFencedMediaAfterPhysicalSend accumulates accepted visible chunks per sourceIndex and only latches / warns when accumulated text retains the exact fencedSkippedMediaDirectives identity (same rule as Mattermost).
  • Successful preamble + failed fenced MEDIA chunk → silent (no false warn).

Regression

deliver.test.ts — "does not warn when preamble chunk succeeds but fenced MEDIA chunk fails (#41966 latch)" → passed on tip.

Unmocked exact-head proof (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 618b49b93b61
full: 618b49b93b614a1861d4e1631531bdd0fa84b672
node: v25.5.0
date: 2026-08-12T19:39:12.215Z
--- plan fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]
--- plan plain ---
mediaTokenSkippedInFence: false
fencedSkippedMediaDirectives: []
--- CASE preamble-only chunk (expect silent) ---
retains: false
--- CASE accumulated preamble+fenced (expect one warn) ---
retains: true
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).
--- CASE plain control (expect silent) ---
DONE

@clawsweeper re-review


Update 2026-08-12 — Slack stream rotation dedupe (ClawSweeper P2)

Tip: d3f29acb719d (d3f29acb719da7e0566c74f9e6d7d6c9770acea6)
P2 fix: warnFencedMediaForNewlySuccessfulStreamedDeliveries marks each streamed delivery with fencedMediaWarnEmitted after the first successful diagnostic consideration. Later native stream stops / rotations that retain prior successful deliveries stay silent.

Code: extensions/slack/src/monitor/message-handler/dispatch-streaming.ts (acknowledgeStoppedStreamedDeliveries).

Tests (exact-head):

$ node scripts/run-vitest.mjs run \
    extensions/slack/src/monitor/message-handler/dispatch-streaming.fenced-media.test.ts \
    extensions/slack/src/monitor/message-handler/dispatch.preview-fallback.test.ts \
    -t "41966|fenced MEDIA|NewlySuccessful"
 Test Files  2 passed (2)
      Tests  4 passed | 144 skipped

Rotation unit proof: first successful fenced delivery → one warnFencedMediaSkipsForAcceptedOutboundDelivery call; second call with the same retained array (stream rotation) → still one call total; unfenced/failure → silent.

@clawsweeper re-review

Update 2026-08-13 — exact-head Matrix transport owner proof (ClawSweeper gate)

Tip: ()
Node: v25.5.0 · Darwin arm64
Date: 2026-08-13T23:25:55Z

What ClawSweeper asked for

Prior gate: terminal proof exercised helpers rather than an injected fenced directive through a changed transport owner to an accepted send. This update adds that path on the current head.

Owner path proven

→ → matrix (physical accepted send). Reject path uses the same owner with transport throw.

Focused transport regressions (exact-head)

^[[1m^[[30m^[[46m RUN ^[[49m^[[39m^[[22m ^[[36mv4.1.10 ^[[39m^[[90m/Users/bartokmoltbot/clawd/openclaw^[[39m

^[[32m✓^[[39m ^[[30m^[[42m infra ^[[49m^[[39m src/infra/outbound/deliver.test.ts ^[[2m(^[[22m^[[2m187 tests^[[22m^[[2m | ^[[22m^[[33m176 skipped^[[39m^[[2m)^[[22m^[[32m 80^[[2mms^[[22m^[[39m

^[[2m Test Files ^[[22m ^[[1m^[[32m1 passed^[[39m^[[22m^[[90m (1)^[[39m
^[[2m Tests ^[[22m ^[[1m^[[32m11 passed^[[39m^[[22m^[[2m | ^[[22m^[[33m176 skipped^[[39m^[[90m (187)^[[39m
^[[2m Start at ^[[22m 19:26:23
^[[2m Duration ^[[22m 2.69s^[[2m (transform 1.17s, setup 308ms, import 2.15s, tests 80ms, environment 0ms)^[[22m
Covers: warn only after durable physical send succeeds; silent on reject; preamble/chunk latch; hook rewrite silence; SMS fence flatten retains identity; queue recovery facts.

Unmocked exact-head transport transcript (no Vitest; live delivery owner)

Reading the transcript

  1. Plan fenced — + exact identity before send.
  2. Accepted Matrix send — physical retains fenced as visible text (, ); live logger emits exactly one line after that accepted send.
  3. Unfenced control — media extracted to ; no fenced-skip warn.
  4. Transport reject — same fenced payload; throw ; no warn (diagnostic latched to accepted visible send only).

Note: the proof script’s spy under-counts because also writes via the subsystem file logger; the live warn line is visible in the same transcript immediately before for the fenced case.

@clawsweeper re-review

Update 2026-08-17 — exact-head runtime proof (779b15757fd)

ClawSweeper on 779b15757fd3b0704cb98584ca0a4b2983054f57: no discrete code findings; blocked on current-head real behavior proof + maintainer scope decision for durable/direct diagnostic breadth.

Exact-head focused vitest (#41966 filter) — green

Host: Darwin arm64, Node v25.5.0, head 779b15757fd3b0704cb98584ca0a4b2983054f57 @ 2026-08-17T20:38–20:41Z.

# deliver durable owner
✓ does not warn for fenced MEDIA during durable preparation alone (#41966)
✓ warns for fenced MEDIA only after durable physical send succeeds (#41966)
✓ does not warn for fenced MEDIA when durable first send rejects (#41966)
✓ does not warn when preamble chunk succeeds but fenced MEDIA chunk fails (#41966 latch)
✓ warns when hard-split fenced MEDIA chunks reassemble across durable sends (#41966)
✓ warns for fenced MEDIA after first visible send even if a later send rejects (#41966)
✓ does not warn for fenced MEDIA when a message hook rewrites final text (#41966)
✓ does not warn when hook rewrites fenced MEDIA to ordinary media: prose (#41966)
✓ retains fenced MEDIA identity through plain-text sanitizers without prepare-time warn (#41966 SMS)
✓ warns for fenced MEDIA after durable queue recovery from prepared-batch facts (#41966)
✓ warns for fenced MEDIA after fence-stripping SMS adapter physical send (#41966)
✓ does not warn for invalid fenced MEDIA examples (#41966)
# → 12 passed (deliver.test.ts #41966)

# shared direct owner (private-local latch)
✓ warns once after accepted fenced MEDIA text on the shared direct owner (#41966)
✓ stays silent for unfenced MEDIA control on shared direct owner (#41966)
✓ does not warn when caption-bearing media fails then later media succeeds (#41966)
✓ warns once after accepted formatted direct send (IRC/Nextcloud owner) (#41966)
✓ does not warn when formatted direct send rejects (#41966)
✓ stays silent for unfenced MEDIA on formatted direct owner (#41966)
✓ sendPayloadWithChunkedTextAndMedia leaves fenced-MEDIA warn to core (#41966)
✓ stays silent for preamble-only accepted text when fenced identity is not sent
✓ sendTextMediaPayload leaves fenced-MEDIA warn to core delivery owner (#41966)
✓ warns when hard-split chunks reassemble the directive without synthetic newlines
# → 10/10 passed (reply-payload.fenced-media.test.ts)

# Telegram Bot API direct
✓ warns once after accepted Telegram Bot API text retains fenced MEDIA identity
✓ stays silent when Telegram send fails before acceptance
# → 2/2 passed (delivery.fenced-media.test.ts)

# Slack text-only direct
✓ warns after successful text-only fenced MEDIA send
✓ stays silent for unfenced MEDIA text-only control
# → 2/2 passed (replies.test.ts #41966)

Unmocked current-head transcript (parser + plan + latch/durable warn)

node --import tsx <<'EOF'
# parseReplyDirectives + createOutboundPayloadPlan + createDirectAcceptedFencedMediaWarnLatch
# + warnFencedMediaSkipsForAcceptedOutboundDelivery on head 779b15757fd
EOF

Observed (redacted):

[media] token skipped — it is inside a fenced code block and will not be delivered as media. ...
# (latch afterAcceptedVisibleText once on retained fenced identity; second identical call stayed silent)
# (separate intentional durable-helper call also emits the same operator line)

{
  "head": "779b15757fd3b0704cb98584ca0a4b2983054f57",
  "fencedDirectives": {
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": ["MEDIA:/tmp/demo.png"],
    "mediaUrls": null
  },
  "unfencedDirectives": {
    "mediaTokenSkippedInFence": false,
    "fencedSkippedMediaDirectives": [],
    "mediaUrls": ["/tmp/demo.png"]
  },
  "fencedPlan": {
    "mediaTokenSkippedInFence": true,
    "fencedSkippedMediaDirectives": ["MEDIA:/tmp/demo.png"],
    "mediaUrls": null,
    "textIncludesMedia": true
  },
  "unfencedPlan": {
    "mediaTokenSkippedInFence": false,
    "mediaUrls": ["/tmp/demo.png"],
    "textIncludesMedia": false
  }
}

Contract shown on this head: parser stays pure (signal only); fenced path keeps text + skip identities and does not extract; unfenced extracts /tmp/demo.png; warn fires only after accepted-visible / durable helper path with retained identity.

Still waiting on maintainer: product scope decision (durable + direct diagnostic breadth vs narrower owner). No further product surface this wake.

@clawsweeper re-review

Update 2026-08-17 (2) — exact-head runtime proof (ac846cceca7)

ClawSweeper reviewed 779b15757fd needing current-head proof after durable/direct path changes. Tip is now ac846cceca71f54bbea0199cb61dbbb93605c0bd (closes Slack text-only + hard-split + TG pre-hook gaps).

Focused vitest on exact tip — green

Host: Darwin arm64, Node v25.5.0, head ac846cceca71f54bbea0199cb61dbbb93605c0bd @ 2026-08-17T20:53Z.

deliver.test.ts + payloads.test.ts -t 41966|fenced MEDIA → 22 passed
reply-payload.fenced-media.test.ts → 10/10 passed (shared direct owner latch)
telegram delivery.fenced-media.test.ts → 2/2 passed
slack replies.test.ts -t 41966 → 2/2 passed
# 4 Vitest shards, ~35s

Unmocked exact-head transcript (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: ac846cceca71f54bbea0199cb61dbbb93605c0bd
node: v25.5.0
date: 2026-08-17T20:54:29.679Z

--- parse fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]
mediaUrls: null

--- parse plain ---
mediaTokenSkippedInFence: false
fencedSkippedMediaDirectives: []
mediaUrls: ["/tmp/demo.png"]

--- plan fenced ---
mediaTokenSkippedInFence: true
fencedSkippedMediaDirectives: ["MEDIA:/tmp/demo.png"]

--- plan plain ---
mediaTokenSkippedInFence: false

--- CASE durable helper fenced accepted-entry ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- CASE durable helper plain ---
(silent)

--- CASE direct latch fenced (once-only) ---
[media] token skipped — … (exactly one warn; second afterAcceptedVisibleText silent)

--- CASE direct latch plain ---
(silent)

--- CASE hook rewrite silent ---
(silent)
DONE

Contract on this head: parser pure signal; durable helper warns once for retained fenced identity; direct latch (createDirectAcceptedFencedMediaWarnLatch) warns once after accepted visible text; plain/unfenced and hook-rewrite stay silent. Focused channel suites cover Telegram Bot API + Slack text-only accepted-send paths.

Still waiting on maintainer: product scope decision (durable + direct diagnostic breadth). No further product surface this wake.

@clawsweeper re-review

Update 2026-08-17 (3) — exact-head runtime proof (717b32b03d79)

ClawSweeper (review @ 717b32b03d79, 2026-08-18T01:03Z) asked for a redacted exact-head accepted-send transcript covering durable/direct + post-policy redaction suppression after durable-redaction and Slack-block latch work.

Focused vitest on exact tip — green

Host: Darwin arm64, Node v25.5.0, head 717b32b03d798a22c9ecdce39c9929b6a88811e4.

deliver.test.ts + payloads.test.ts -t 41966|fenced MEDIA → 22 matched / green (12+10)
reply-payload.fenced-media.test.ts → 10/10 passed
# 32 passed, 219 skipped across 3 files

Unmocked exact-head transcript (no Vitest; live defaultRuntime.log / logWarn)

=== exact-head unmocked boundary proof ===
head: 717b32b03d798a22c9ecdce39c9929b6a88811e4
node: v25.5.0
date: 2026-08-18T01:10:23.522Z

--- parse fenced ---
{"mediaTokenSkippedInFence":true,"fencedSkippedMediaDirectives":["MEDIA:/tmp/demo.png"],"mediaUrls":null}

--- parse plain ---
{"mediaTokenSkippedInFence":false,"fencedSkippedMediaDirectives":[],"mediaUrls":["/tmp/demo.png"]}

--- plan fenced ---
{"mediaTokenSkippedInFence":true,"fencedSkippedMediaDirectives":["MEDIA:/tmp/demo.png"],"textIncludesMedia":true}

--- plan plain ---
{"mediaTokenSkippedInFence":false,"fencedSkippedMediaDirectives":[],"mediaUrls":["/tmp/demo.png"]}

--- CASE durable helper fenced accepted-entry ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- CASE durable helper plain ---
(silent)

--- CASE durable helper post-policy redaction suppresses ---
(silent)

--- CASE direct latch fenced (once-only) ---
[media] token skipped — … (one warn; second afterAcceptedVisibleText silent)

--- CASE direct latch plain ---
(silent)

--- CASE Slack-style structured block retained identity ---
[media] token skipped — … (one warn on retained identity)

DONE

Contract on this head: parser pure signal; durable helper warns once for retained fenced identity; silent for plain and for post-policy/hook text that drops the directive identity; direct latch (createDirectAcceptedFencedMediaWarnLatch) warns once after accepted visible text; Slack-style structured-block retained identity still warns. Tip includes strip of fenced-MEDIA facts from durable nested payloads + Slack block latch (this SHA).

Still waiting on maintainer: product scope decision (durable-only vs durable + selected direct diagnostic breadth / private SDK seam). No further product surface this wake.

@clawsweeper re-review

Update 2026-08-18 (4) — exact-head proof after durable extractMediaDirectives:false (114a31c79c1b)

ClawSweeper durable on 196b238e682 (P2: durable prepare must honor disabled media parsing). Tip 114a31c79c1b316e435f41a6033a1c62ae11326b carries that fix + direct-latch mode + green focused suite.

Focused vitest on exact tip — green

deliver.test.ts + payloads.test.ts -t 41966|fenced MEDIA|extractMediaDirectives → 23 passed
reply-payload.fenced-media.test.ts → 13/13 passed

Unmocked exact-head transcript (no Vitest; live logger)

=== exact-head unmocked boundary proof ===
head: 114a31c79c1b316e435f41a6033a1c62ae11326b
node: v25.5.0
date: 2026-08-18T02:25:21.959Z

--- parse fenced ---
{"mediaTokenSkippedInFence":true,"fencedSkippedMediaDirectives":["MEDIA:/tmp/demo.png"],"mediaUrls":null}
--- parse plain ---
{"mediaTokenSkippedInFence":false,"fencedSkippedMediaDirectives":[],"mediaUrls":["/tmp/demo.png"]}
--- plan fenced enabled ---
{"mediaTokenSkippedInFence":true,"fencedSkippedMediaDirectives":["MEDIA:/tmp/demo.png"],"mediaUrls":null}
--- plan plain ---
{"mediaTokenSkippedInFence":false,"fencedSkippedMediaDirectives":[],"mediaUrls":null}
--- plan fenced extractMediaDirectives:false ---
{"mediaTokenSkippedInFence":false,"fencedSkippedMediaDirectives":[],"mediaUrls":null}

--- CASE durable helper fenced accepted-entry ---
[media] token skipped — it is inside a fenced code block and will not be delivered as media. Fenced MEDIA lines stay visible text by design; delivery of legacy MEDIA: depends on the outbound path (some direct channel paths keep unfenced MEDIA: as literal text too).

--- CASE durable helper plain ---

--- CASE durable helper disabled-mode plan facts ---

--- CASE direct latch extractMediaDirectives:false ---
(silent expected)
DONE

Contract on this head: enabled fenced → skip facts + warn after accepted helper; plain → silent; extractMediaDirectives: false plan produces no skip facts and no warn (durable replan + direct latch). ClawSweeper P2 on durable prepare addressed.

@clawsweeper re-review

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

This PR records fenced MEDIA directives and warns after accepted outbound delivery while preserving them as literal text.

Example: An assistant replies with \nMEDIA:/tmp/demo.png\n.

  • Before: The reply contains the literal path, no attachment, and no skipped-directive warning.
  • After: The reply remains literal text, and accepted delivery produces an operator warning.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Useful diagnostic work with supporting helper traces, an unresolved policy defect, duplicated bookkeeping, and unsettled persistence/SDK scope.
Proof confidence 🦪 silver shellfish (2/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦪 silver shellfish (2/6) 2 actionable review findings remain.

Product

Kind: Bug fix · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: An intended attachment appears as a literal fenced MEDIA path with no explanation in operator logs.
Reason: The original warning direction has maintainer support; the later durable metadata and bundled SDK scope needs acceptance separately.

Merge readiness

⛔ Blocked before merge - 8 items remain

Keep this PR open: its diagnostic remains absent from main, it has maintainer review engagement, and the outstanding hook defect still blocks merge.

Priority: P2
Reviewed head: b1f478805478326c83e3a5273588f797ddb0d0f6
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should the warning retain optional durable prepared-batch facts and a bundled-only SDK seam, or remain transient at a narrower delivery boundary?
  • Recommendation: Keep shared coverage with one implementation: Accept durable recovery and direct-send coverage, consolidate their diagnostic bookkeeping, and retain the compatibility proof gate.
  • Why: The maintainer requested pure parsing and delivery-boundary logging, but the recorded review does not settle the later persistence and SDK expansion.

Before merge

  • Add real behavior proof - Unmocked terminal output exercises parsing, planning, and warning helpers, but the claimed Matrix delivery transcript is empty and no supplied artifact establishes the changed path through a shipped send entry point. Provide redacted delivery logs showing accepted-send warning and rejected/unfenced silence. Existing-queue reopen and older-reader compatibility runs are also absent. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Preserve disabled media parsing across message hooks (P2) - For a payload containing \nMEDIA:/tmp/demo.png\n with extractMediaDirectives:false, a message_sending hook returning {content: originalText} removes the false flag here. prepareOutboundPayloadBatch then reparses accepted text with extraction enabled, persists skipped-media facts, and emits a warning after sending even though parsing was intentionally disabled. Preserve the policy flag while clearing stale diagnostic identities, and cover this combined path. This repeats the prior late-discovered finding; the code is unchanged from the earlier reviewed head.
  • Give operators a recovery action in the warning (P3) - After a fenced MEDIA reply is accepted, the new diagnostic says attachment handling depends on the outbound path but gives no action to send the intended file. Add the documented recovery: use structured attachment fields, or a standalone unfenced MEDIA line for supported automatic final replies, with the rich-output documentation link. This missing recovery guidance was equally visible on the earlier reviewed head and is a late discovery.
  • Resolve merge risk - Consolidate the repeated identity matching and batch-to-map reconstruction before merge: the net +793 production lines currently introduce separate durable and direct latches plus multiple reconstruction paths for one diagnostic.
  • Complete next step - Resolve the merge conflicts GitHub reports for the reviewed head against current main.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.
  • Explain or restore the original intent of Content-returning message hooks - 6f6c2ac: The existing hook path carries the payload forward while replacing text; the PR explains removal of stale diagnostic identities but does not justify removing extraction policy.

Findings

  • [P2] Preserve disabled media parsing across message hooks — src/infra/outbound/deliver-hooks.ts:213
  • [P3] Give operators a recovery action in the warning — src/infra/outbound/fenced-media-skip-warn.ts:6-8

Provenance

  • Content-returning message hooks changes intended behavior without addressing why it exists (6f6c2ac: The existing hook path carries the payload forward while replacing text; the PR explains removal of stale diagnostic identities but does not justify removing extraction policy.)

Tests

  • Low-value test extensions/telegram/src/bot/delivery.fenced-media.test.ts: Remove the copied latch implementation from the mock and exercise the production latch with a narrow logger mock; the copy can pass while the real latch regresses.
  • Low-value test extensions/slack/src/monitor/replies.test.ts: Replace the duplicated identity-matching latch mock with the production implementation so channel acceptance coverage validates the actual diagnostic.
  • Missing end-to-end proof: Supply a shipped delivery run showing accepted-send warning, unfenced and rejected-send silence, hook-policy preservation, and queue reopen compatibility; a base-failing combined hook regression is not shown.
Agent review details

How this fits together

Assistant text enters reply parsing and outbound planning; policy hooks and durable queue preparation precede channel sends, whose accepted results trigger the diagnostic.

flowchart LR
A[Assistant reply] --> B[Pure directive parser]
B --> C[Outbound plan]
C --> D[Policy and queue custody]
D --> E[Channel send]
C --> F[Direct delivery helpers]
F --> E
E --> G[Accepted send warning]
Loading

Technical review

Best possible solution:

Preserve parsing policy through hooks and use one shared accepted-send diagnostic implementation with only the owner-approved queue and SDK surface.

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

Current main source and existing tests establish literal fenced MEDIA output without a diagnostic; the introduced hook-policy failure is also traceable in source, but no target code was executed.

Is this the best way to solve the issue?

Warning-only handling respects the documented literal-code contract, but the implementation needs policy preservation and consolidation rather than additional downstream guards.

Full review comments:

  • [P2] Preserve disabled media parsing across message hooks — src/infra/outbound/deliver-hooks.ts:213
    For a payload containing \nMEDIA:/tmp/demo.png\n with extractMediaDirectives:false, a message_sending hook returning {content: originalText} removes the false flag here. prepareOutboundPayloadBatch then reparses accepted text with extraction enabled, persists skipped-media facts, and emits a warning after sending even though parsing was intentionally disabled. Preserve the policy flag while clearing stale diagnostic identities, and cover this combined path. This repeats the prior late-discovered finding; the code is unchanged from the earlier reviewed head.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.
  • [P3] Give operators a recovery action in the warning — src/infra/outbound/fenced-media-skip-warn.ts:6-8
    After a fenced MEDIA reply is accepted, the new diagnostic says attachment handling depends on the outbound path but gives no action to send the intended file. Add the documented recovery: use structured attachment fields, or a standalone unfenced MEDIA line for supported automatic final replies, with the rich-output documentation link. This missing recovery guidance was equally visible on the earlier reviewed head and is a late discovery.
    Confidence: 0.94
    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 medium; reviewed against 2dd328a2a0cc.

Merge-risk options

Maintainer options:

  1. Consolidate diagnostic bookkeeping (recommended)
    Share the accepted-text identity matcher and latch between durable and direct delivery, and reconstruct batch facts once instead of maintaining parallel implementations.

Provenance checked

  • Literal fenced-code behavior and media validation keeps the original intent (unknown: Current source, shipped source, and documentation deliberately keep code examples inert; the deeper symbol-history search failed on an unavailable historical blob.)
  • Post-policy durable custody keeps the original intent (4219ece: Persist accepted policy results so recovery does not rerun modifiers or restore redacted content.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 2f071c9 adds src/infra/outbound/deliver-core.ts:214 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 2f071c9371bd; files: src/infra/outbound/deliver-core.ts)
  • Josh Avant: Raw commit 4219ece adds src/infra/outbound/deliver-prepare.ts:126 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4219ece28185; files: src/infra/outbound/deliver-prepare.ts)
  • Peter Steinberger: Raw commit 6f6c2ac adds src/infra/outbound/deliver-core.ts:54 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6f6c2acec3b9; files: src/infra/outbound/deliver-core.ts)

PR surface

Source +796, Tests +1211, Config +11, Other +1. Total +2019 across 44 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 28 1091 295 +796
Tests 10 1213 2 +1211
Docs 0 0 0 0
Config 3 11 0 +11
Generated 0 0 0 0
Other 3 5 4 +1
Total 44 2320 301 +2019

Review metrics

Metric Value Why it matters
Production versus tests Production net +793 LOC; tests net +1211 LOC. Computed from the pinned introduced diff; JSON/package/baseline metadata is excluded, and parser-validation relocation is not treated as new capability. Boundary regressions are useful, but duplicated production bookkeeping and copied latch mocks add avoidable maintenance.
Added compatibility surface 2 optional persisted diagnostic fields; 1 bundled-only SDK subpath; 0 operator config options. The warning extends prepared queue records and plugin loading surfaces despite preserving visible reply text.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: A bounded legacy-media diagnostic improvement remains useful, with a false-warning regression rather than a demonstrated core outage.
  • merge-risk: 🚨 compatibility: Optional prepared-batch fields and a new bundled-only SDK subpath change persisted and plugin contracts that ordinary unit coverage does not establish across upgrades.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (117 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-18T04:33:25.541Z sha 1186a51c93dde2ddd8b730305a4d4c9c78692595 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T04:46:17.577Z sha 3fd976c2ea3ab1397915436ebc3ebe7d60aed550 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T05:06:50.062Z sha b1f4788 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T05:21:20.997Z sha b1f4788 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-23T23:04:13.444Z sha b1f4788 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-30T00:15:03.445Z sha b1f4788 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-21T23:53:37.226Z sha b1f4788 :: blocked before merge. :: [P2] Preserve disabled media parsing across message hooks
  • reviewed 2026-09-26T07:58:50.215Z sha b1f4788 :: blocked before merge. :: [P2] Preserve disabled media parsing across message hooks

Reviewed October 10, 2026, 10:17 AM ET / 14:17 UTC (Revision 118).

@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 May 25, 2026
@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 May 25, 2026
@clawsweeper

clawsweeper Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 26, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. label May 26, 2026
@Bartok9
Bartok9 force-pushed the fix/41966-media-token-warn-in-fence branch from 5dea644 to 5102c3c Compare May 27, 2026 20:41
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 27, 2026
@Bartok9

Bartok9 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 27, 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.

Re-review progress:

@Bartok9

Bartok9 commented May 27, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented May 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Command router queued. I will update this comment with the next step.

Re-review progress:

@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@Bartok9
Bartok9 force-pushed the fix/41966-media-token-warn-in-fence branch from 5102c3c to 5366ecb Compare June 14, 2026 01:44
@Bartok9

Bartok9 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor Author

@RomneyDa Done — rebased onto current main (now at 340c2456bb) and resolved the conflicts. They were minor (an adjacent comment line in parse.ts plus the vitest import line in parse.test.ts); the actual warn logic applied cleanly to the current splitMediaFromOutput(). Single commit, authorship preserved.

Verification on the rebased branch:

  • src/media/parse.test.ts → 60/60 passing (includes the 3 new MEDIA: tokens inside markdown code fences are silently ignored #41966 cases)
  • oxlint on both touched files → 0 warnings / 0 errors
  • Added a function-level repro to the PR body showing the warning actually fires for a fenced MEDIA: token (and stays silent for the out-of-fence control). Fresh CI is running now.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jun 14, 2026
@Bartok9
Bartok9 force-pushed the fix/41966-media-token-warn-in-fence branch from 5366ecb to 3c3a2bc Compare June 14, 2026 01:52
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 14, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 14, 2026
Bartok9 added 16 commits August 18, 2026 00:54
…latch test mock

- Drop unnecessary Boolean() around boolean merge in reply directive merge
- Telegram fenced-media test: mock latch with real plan builder so warn spy
  receives fencedSkippedMediaDirectives (relative warn import bypassed mock)
Drop === true boolean-literal compares for mediaTokenSkippedInFence merge.
ClawSweeper P2 on openclaw#80396: pending assistant reply directives now retain
mediaTokenSkippedInFence / fencedSkippedMediaDirectives, hasReplyDirectiveMetadata
treats them as real metadata, and createOutboundPayloadPlan merges payload-carried
facts so embedded streamed block replies still warn after accepted send.

Also drop !! boolean coercion that failed oxlint on the merge helper.
…G pre-hook)

ClawSweeper on 7756f33: latch Slack text-only sends; join accepted chunks
without synthetic newlines and match directive identity contiguously; build
Telegram latch from pre-hook plan facts.
…law#41966)

deliverTextOrMediaReply already owns the accepted-caption latch; Slack
must not also fire its outer latch for the same caption. Keep the outer
latch for text/block-only paths and pass cfg/surface into the shared helper.
- oxlint curly on Slack/Telegram fenced-MEDIA test latch mocks
- keep AgentRuntimeReplyPayload keys in sync with ReplyPayload fence signals
…#41966)

Remove static import of channel-outbound-fenced-media-runtime from the
public reply-payload entrypoint to break the reply-payload → latch →
payloads → reply-payload ESM cycle and avoid loading outbound planning
on every plugin import. Latch loads only inside async direct-delivery
helpers.
…law#41966)

ClawSweeper P1 on 934b1e7d3615: createOutboundPayloadPlan only reads
extractMarkdownImages from context, so cfg/surface on public reply-payload
helpers and the private direct latch widened the SDK surface with no effect.

Remove those parameters and caller plumbing; keep payload-only latch identity.
…cks (openclaw#41966)

P1: omit mediaTokenSkippedInFence/fencedSkippedMediaDirectives from compact
nested payload and drop them on message_sending text rewrite so redacted
paths cannot enter queue custody.
P2: latch fenced MEDIA warn after accepted Slack structured-block sends.
Assertion-safety ratchet requires // SAFETY immediately above `as never`
in channel-outbound-fenced-media-latch.ts (openclaw#41966).
…openclaw#41966)

ClawSweeper P2 on openclaw#80396: block replies disable MEDIA directive parsing, but
the direct-delivery latch reparsed with defaults and could false-warn.

- Stamp extractMediaDirectives:false onto normalized block payloads
- Thread the mode through createOutboundPayloadPlan / direct latch
- Skip latch entirely when extraction is disabled
- Regressions: latch unit + deliverTextOrMediaReply + reply-delivery stamp
…plan

ClawSweeper P2 on openclaw#80396: prepareOutboundPayloadBatch replan of accepted
text must carry extractMediaDirectives:false so disabled block-reply
parsing cannot false-mark fenced MEDIA as skipped for durable diagnostics.
- Place // SAFETY immediately above `as never` for assertion-safety ratchet
  in channel-outbound-fenced-media-latch (openclaw#41966).
- Cast extractMediaDirectives test bags as never so OutboundReplyPayload
  typing accepts the private latch option without expanding the public type.
…ctives

- assertion-safety: // SAFETY above LatchPayload cast
- AgentRuntimeReplyPayload: add extractMediaDirectives so keyof ReplyPayload stays in sync
CI shard auto-reply-reply-state-routing failed: block delivery now stamps
extractMediaDirectives:false on normalized payloads; update expectations.
@Bartok9

Bartok9 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Wake 2026-08-18 — ClawSweeper owner-gate + clean rebase

Latest durable ClawSweeper (reviewed 3fd976c2ea3a, ~04:46 UTC): no actionable code findings; proof confidence high. Merge readiness remains ⚠️ maintainer decision only:

Should fenced-MEDIA diagnostics permanently cover all accepted durable + bundled direct-send paths, or be narrowed to one canonical outbound owner?

ClawSweeper recommendation: keep all accepted-send paths. Author cannot self-approve that product/architecture scope.

This wake:

  • Tip rebased clean onto current upstream/main → 0 behind.
  • Exact head: b1f478805478 (b1f478805478326c83e3a5273588f797ddb0d0f6) — same MEDIA: tokens inside markdown code fences are silently ignored #41966 warn-only contract; latest commit still honors extractMediaDirectives: false on durable replan + direct latch.
  • No further product-surface change without owner direction.

Please re-score exact head b1f478805478326c83e3a5273588f797ddb0d0f6 after the rebase (no code delta intended vs prior tip beyond main integration).

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 18, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@Bartok9

Bartok9 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Fast wake (ClawSweeper re-review @ 04:48 UTC)

Human gate still open: Vincent’s earlier request (warn once at outbound delivery, not on every parseReplyDirectives call) is already on tip via accepted-send latching (warnFencedMediaSkipsForAcceptedOutboundDelivery) + regressions.

ClawSweeper standing item: owner decision on all-path durable + bundled direct-send diagnostic ownership vs a single canonical outbound owner. No new mechanical code defect in the latest review — merge readiness is that product/architecture call.

Happy to narrow to one owner path if maintainers prefer that over the current all accepted-send coverage.

@Bartok9

Bartok9 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

ClawSweeper latest pass (head b1f47880547)

Thanks for the refreshed review.

  • Actionable code findings: none on current tip (per durable review).
  • Proof: prior unmocked terminal transcript remains in the PR body (fenced → one warn + text kept; unfenced → extract, no warn); durable/shared-boundary ownership as previously landed.
  • Still owner-gated: permanent scope — keep warn on all accepted-send paths (core durable + bundled direct helpers) vs narrow to one outbound owner. Contributor recommendation stays accept all accepted-send paths so the diagnostic fires wherever the retained fenced MEDIA: is visibly delivered; will reshape if owners prefer a single owner.

CI: watching openclaw/ci-gate / compact shard noise on the latest push; will chase red tests if they reproduce on this head after the gate settles.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 18, 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 exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@Bartok9

Bartok9 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the refreshed ClawSweeper pass — agree this is now maintainer product/ownership, not more author code churn.

Status (author):

  • Vincent’s P2 (warn once at delivery, pure parser signal) remains addressed on head.
  • Behavior is warn-only; no extraction change; browser-pure parse.ts via callback injection.
  • Proof stays in the PR body + unit coverage (parse.test.ts / reply-directives.test.ts).

CI note: latest red on checks-node-compact-large-7 looks unrelated to this diff — src/audit/message-delivery-progress-store.test.ts terminal-only reader contract timed out at 120s (not a media/parse path). Will re-run if it stays flaky after the next main rebase.

Deferring to outbound/SDK owners on the remaining durable/direct delivery + exported subpath acceptance items.

@Bartok9

Bartok9 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

Fast wake (mention) — still maintainer-gated

Latest ClawSweeper (head b1f478805478): no actionable code findings; proof sufficient (platinum hermit). Remaining gate is owner Decision only — durable + bundled-direct accepted-send diagnostic scope vs narrow single outbound owner (ClawSweeper recommends keep all accepted-send paths).

Author stance: no further product-surface churn this wake. Vincent P2 (pure parser signal + warn once at accepted delivery) remains on tip. CI compact-large-7 timeout previously noted as unrelated audit store flake — will chase only if it reproduces after next main rebase.

mergeable but behind main (~13); will rebase on next actionable CI/code finding, not for owner-decision noise.

No @clawsweeper re-review requested (no code delta).

@Bartok9

Bartok9 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor Author

ClawSweeper 2026-08-18 re-review noted

Latest durable review (head b1f478805478): no actionable contributor findings; proof confidence sufficient (terminal). Remaining items are owner/maintainer product decisions only:

  • permanent diagnostic ownership (durable + bundled direct vs single canonical outbound owner)
  • breadth / private-local SDK subpath as compatibility surface

No further contributor code changes pending from this pass. Standing by for maintainer direction.

@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

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

agents Agent runtime and tooling channel: slack Channel integration: slack channel: telegram Channel integration: telegram extensions: xai merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: blank-template Candidate: PR template appears mostly untouched.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MEDIA: tokens inside markdown code fences are silently ignored

4 participants