Skip to content

fix(outbound): blank media lists silently drop valid channel attachments - #128372

Merged
steipete merged 1 commit into
mainfrom
codex/outbound-blank-media-fallback-qa
Aug 23, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/outbound-blank-media-fallback-qa

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where channel replies containing a valid attachment in mediaUrl would silently lose that attachment when mediaUrls existed but contained only whitespace. Discord skipped the file upload, Feishu sent text without its attachment, and attachment-only replies could disappear on other channels sharing the same outbound owner.

Why This Change Was Made

Select the plural attachment array only when it contains an actual nonblank media reference; otherwise use the existing singular attachment field. The shared owner preserves the public SDK’s original array identity, raw strings, whitespace, duplicates, ordering, precedence, and unchanged type/signature for every valid plural input.

User Impact

Discord, Feishu, Slack, LINE, and other shared-owner channel paths now retain a valid attachment instead of silently discarding it when stale plural metadata is blank. Existing multi-attachment and WhatsApp delivery behavior remain unchanged.

Evidence

  • Pre-fix red: public SDK resolution and actual media-send callback fail; a real local Discord interaction multipart HTTP POST never uploads its file; Feishu’s actual reply dispatcher never calls its media sender.
  • Post-fix green: 72 public SDK tests, 13 Discord tests including real loopback HTTP multipart upload and MIME proof, 131 Feishu dispatcher tests, and 20 WhatsApp sibling tests all pass.
  • Public SDK contract regression explicitly verifies that valid arrays retain their exact identity, raw spacing, duplicates, order, and precedence.
  • Core and plugin-platform test TypeScript, focused lint/format, and assertion-safety/max-lines ratchets pass.
  • Production delta +2/-5, net -3 lines; no public SDK signature/export change, no channel-specific workaround, and no new compatibility shim.
  • Fresh independent in-session source-aware review covers shared owner/callers, every affected channel, SDK compatibility, actual local Discord HTTP delivery, and preserved WhatsApp behavior; the external review CLI was unavailable under the session approval boundary.

@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord channel: feishu Channel integration: feishu size: S maintainer Maintainer-authored PR labels Aug 23, 2026
@steipete
steipete marked this pull request as ready for review August 23, 2026 21:11
@clawsweeper clawsweeper Bot added P1 High-priority user-facing bug, regression, or broken workflow. 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 23, 2026
@clawsweeper

clawsweeper Bot commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 5:18 PM ET / 21:18 UTC.

ClawSweeper review

What this changes

The PR makes an all-blank mediaUrls list fall back to a valid legacy mediaUrl so channel replies retain their attachment.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open for normal maintainer handling. Current main still gives any non-empty plural list precedence over a valid singular attachment; the branch repairs that shared owner and its focused tests cover the SDK and Discord/Feishu paths without introducing a blocking defect.

Priority: P1
Reviewed head: d379494688e17162dc4604ae6162c08ccb661680

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused shared-owner repair with relevant SDK and channel coverage; await the in-progress exact-head checks.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its existing Discord loopback and Feishu dispatcher regressions remain useful supporting evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its existing Discord loopback and Feishu dispatcher regressions remain useful supporting evidence.
Evidence reviewed 7 items Current-main defect: Current main selects any non-empty plural array before mediaUrl; an all-whitespace array therefore suppresses the valid legacy attachment before later normalization drops the blank entry.
Owner-boundary repair: The branch changes the shared selector to require at least one nonblank plural entry and otherwise returns the singular attachment, preserving the raw plural array when it is valid.
Channel callers: Discord derives sendability and uploaded files from the shared normalized parts, while Feishu obtains its media-send list from the same helper; both receive the repaired selection without channel-specific policy.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs src/plugin-sdk/reply-payload.test.ts

Result: PASS (completed)

node scripts/run-vitest.mjs src/plugin-sdk/reply-payload.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128372-gtC77d/target$ node scripts/run-vitest.mjs src/plugin-sdk/reply-payload.test.ts
node scripts/run-vitest.mjs src/plugin-sdk/reply-payload.test.ts
[test] starting test/vitest/vitest.plugin-sdk.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-128372-gtC77d/target

 ✓  plugin-sdk  src/plugin-sdk/reply-payload.test.ts (72 tests) 119ms

 Test Files  1 passed (1)
      Tests  72 passed (72)
   Start at  21:19:15
   Duration  1.54s (transform 1.15s, setup 943ms, import 118ms, tests 119ms, environment 0ms)

[test] passed 1 Vitest shard in 7.51s
runner@runnervm76f27:/tmp/clawsweeper-live-proof-128372-gtC77d/target$ node scripts/run-vitest.mjs src/plugin-sdk/reply-payload.test.ts



































Assertions:

  • PASS expect_output: Test Files

How this fits together

The shared outbound reply helper selects media from agent reply payloads before Plugin SDK channel adapters normalize and send them. Discord, Feishu, LINE, Slack, and other channel paths consume that selected media list for their transport-specific delivery.

flowchart LR
  A[Agent reply payload] --> B[Shared media selector]
  B --> C{Plural list has a usable URL}
  C -->|Yes| D[Keep plural attachment list]
  C -->|No| E[Use legacy single attachment]
  D --> F[Channel delivery adapters]
  E --> F
  F --> G[Visible channel attachment]
Loading

Before merge

  • Resolve merge risk (P1) - The supplied context still showed exact-head CI in progress; merge should wait for its completion.
Agent review details

Security

None.

PR surface

Source -3, Tests +40. Total +37 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 2 5 -3
Tests 3 102 62 +40
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 104 67 +37

Review metrics

Metric Value Why it matters
Production versus test LOC production +2/-5 (net -3); tests +102/-62 The bug repair reduces production code while adding owner-level and channel-boundary regression coverage.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the shared-selector fix after exact-head checks complete, retaining the raw valid plural-array contract and the focused channel regressions.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the shared-selector fix after exact-head checks complete, retaining the raw valid plural-array contract and the focused channel regressions.

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

Yes from source: current main returns mediaUrls: [" "] before considering a valid mediaUrl, and subsequent normalization removes the blank entry; the branch changes that decision.

Is this the best way to solve the issue?

Yes. Repairing the shared media selector is the canonical fix because Discord and Feishu consume its normalized result; channel-specific fallbacks would duplicate policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P1: The defect can silently suppress valid attachments in active channel reply workflows.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its existing Discord loopback and Feishu dispatcher regressions remain useful supporting evidence.

Label justifications:

  • P1: The defect can silently suppress valid attachments in active channel reply workflows.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its existing Discord loopback and Feishu dispatcher regressions remain useful supporting evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Current-main blame and history tie the media-selection surface and its earlier refactor to this contributor. (role: shared outbound helper contributor; confidence: high; commits: 917fab24a50d, ecc49b5a870b; files: src/infra/outbound/reply-payload-parts.ts, src/plugin-sdk/reply-payload.ts)
  • vincentkoc: History shows sustained work across the shared payload and channel-delivery area, including a recent related Plugin SDK-path commit. (role: recent adjacent contributor; confidence: medium; commits: 2b75806197ab; files: src/plugin-sdk/reply-payload.ts, extensions/discord/src/monitor/native-command-reply.ts, extensions/feishu/src/reply-dispatcher.ts)

Rank-up moves

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

  • Let exact-head CI finish before merge.

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.

@steipete
steipete merged commit 4d00dc4 into main Aug 23, 2026
308 checks passed
@steipete
steipete deleted the codex/outbound-blank-media-fallback-qa branch August 23, 2026 21:35
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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

Labels

channel: discord Channel integration: discord channel: feishu Channel integration: feishu maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant