Skip to content

fix(slack): infer file extensions for unnamed media uploads - #119399

Merged
steipete merged 1 commit into
mainfrom
codex/auto-qa-slack-upload-mime-filename-owner-735
Aug 5, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/auto-qa-slack-upload-mime-filename-owner-735

Conversation

@steipete

@steipete steipete commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Slack uploads without a source filename were sent as upload even when their detected MIME type identified a PDF, PNG, MP3, or another known format. Slack classifies and previews uploaded files from their filename extension, so these otherwise valid documents, images, and audio files could render or unfurl incorrectly.

Why This Change Was Made

The existing Slack upload owner now uses the already-public canonical MIME-to-extension helper when it must synthesize a filename. Operator-provided filenames, loader-provided filenames, explicit titles, unknown MIME types, missing MIME metadata, upload bytes, destinations, and existing network controls retain their current behavior.

User Impact

Unnamed Slack attachments now arrive as recognizable files such as upload.pdf, upload.png, or upload.mp3; existing filenames and titles remain untouched.

Evidence

  • Exact reviewed commit: fd08588246725e59cc6111dc1c92b1ede25b65b4; immutable parent: 73535e4ede7eaa51cd4f97f4087657b05814e3d4; exact two-file full-index binary patch SHA-256: 0dfd3d3d3d919adfab2fe9c075043bae6d8ba6de886d0c904da603b0c7c0310b.
  • Genuine tests-first coverage produced 5 failing upload regressions; the repaired upload and enterprise-delivery sibling suites then passed 58/58 tests, with an independently recorded second 58/58 pass.
  • Tests exercise the real Slack upload owner through its existing files.getUploadURLExternal({ filename, length }) boundary for PDF, PNG, MP3, MIME aliases/parameters, explicit source/operator filenames, explicit titles, and unknown or absent MIME metadata. The Slack API is mocked; this does not claim a live Slack workspace.
  • The installed Slack Web API 8.0.0 contract requires filename: string and explicitly warns that a missing filename extension causes unexpected unfurl behavior. Existing public openclaw/plugin-sdk/media-mime owns normalization and preferred extensions; no dependency, API endpoint, SDK surface, auth, configuration, storage, or protocol changes.
  • Four genuinely distinct final hostile reviews covering upstream dependency contract, delivery lifecycle, tests/types, and plugin ownership were clean. A fresh actual gpt-5.6-sol high-reasoning P3/no-web review found zero issues at 0.97 confidence; authenticated TruffleHog was clean.
  • Production delta: +3 lines at the existing plugin-owned upload boundary; the two reviewed files are unchanged on current main, and required exact-head hosted checks must pass before native maintainer landing.

Real authenticated Gateway behavior proof

Exact-head mock-Gateway run 30970270285 passed: authenticated Gateway + mock OpenAI provider + real Slack WebClient produced upload.pdf (51 bytes) and upload.png (68 bytes), uploaded the original bytes, finalized both files, and returned successful operator-visible results.

The isolated Linux Blacksmith Testbox completed its exact-head runtime proof with process exit 0. The harness starts a real ephemeral authenticated OpenClaw Gateway, executes a genuine mock-model agent request, and submits three actual public message.action upload requests through the real Slack plugin, shared guarded media loader, installed Slack Web API client, authenticated mock Slack HTTP API, original-byte uploads, and real finalization calls.

{
  "verdict": "PASS",
  "head": "fd08588246725e59cc6111dc1c92b1ede25b65b4",
  "patchSha256": "0dfd3d3d3d919adfab2fe9c075043bae6d8ba6de886d0c904da603b0c7c0310b",
  "gateway": { "actualProcess": true, "authenticated": true },
  "provider": { "mode": "mock-openai", "model": "mock-openai/gpt-5.6-luna", "requestCount": 1 },
  "control": { "explicitFilename": "upload", "observedFilename": "upload" },
  "after": {
    "pdf": { "filename": "upload.pdf", "contentType": "application/pdf", "bytes": 51, "completed": true },
    "png": { "filename": "upload.png", "contentType": "image/png", "bytes": 68, "completed": true }
  },
  "parentCommitExecuted": false,
  "liveSlackService": false,
  "liveModelProvider": false,
  "childNonLoopbackTcpDenied": true,
  "childNonLoopbackDnsDenied": true,
  "osLevelEgressIsolation": false,
  "cleanup": { "gatewayExited": true, "providerStopped": true, "slackFixtureClosed": true, "errorCount": 0 }
}

This directly resolves both ClawSweeper before-merge proof items and its requested rank-up move. The extensionless control is an actual Gateway request preserving explicit-filename behavior; the parent commit was authenticated but was not executed. Slack and the model are isolated mocks, not live external services.

@openclaw-barnacle openclaw-barnacle Bot added channel: slack Channel integration: slack size: S maintainer Maintainer-authored PR labels Aug 5, 2026
@steipete
steipete marked this pull request as ready for review August 5, 2026 01:34
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

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

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. 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 Aug 5, 2026
@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 4, 2026, 10:04 PM ET / August 5, 2026, 02:04 UTC.

ClawSweeper review

What this changes

This PR infers a filename extension from MIME metadata for unnamed Slack uploads and adds regression cases for that fallback.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 2 items remain

Keep open: the focused Slack-plugin repair is correct on the reviewed source path, but the supplied evidence is mock-only and does not yet demonstrate an after-fix upload in a real Slack setup or qualifying gateway harness.

Priority: P2
Reviewed head: fd08588246725e59cc6111dc1c92b1ede25b65b4

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is focused and source-aligned, but its real-behavior evidence is limited to mocks.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR documents mocked Slack WebClient tests, not a real Slack upload or mock-gateway harness verdict; add redacted after-fix runtime evidence before merge. 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.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR documents mocked Slack WebClient tests, not a real Slack upload or mock-gateway harness verdict; add redacted after-fix runtime evidence before merge. 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.
Evidence reviewed 6 items Current main still has the fallback: Current main passes the literal fallback upload when both explicit and loader filenames are absent, so it does not implement MIME-derived names.
Correct owner-boundary repair: The branch changes the existing Slack filename decision to preserve explicit and loader-provided names before using the public MIME helper; the caller continues forwarding filename and title unchanged.
Shared helper and sibling precedent: The public plugin SDK re-exports the normalizing helper, which returns preferred extensions or undefined; Discord already uses the same requested-name, loader-name, MIME-extension, fallback precedence.
Findings None None.
Security None None.

How this fits together

The Slack plugin loads outbound media, chooses the filename passed to Slack’s external-upload API, then finalizes the uploaded file in the target channel. This change affects the filename-selection step without changing media loading, upload transport, or finalization.

flowchart LR
A[Outbound media URL] --> B[Shared media loader]
B --> C[Filename selection]
C --> D[Slack upload URL request]
D --> E[Byte upload]
E --> F[Slack file finalization]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR documents mocked Slack WebClient tests, not a real Slack upload or mock-gateway harness verdict; add redacted after-fix runtime evidence before merge. 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.
  • Resolve merge risk (P1) - The PR body documents only mocked Slack API coverage; a real after-fix Slack upload or qualifying mock-gateway harness result is still needed before merge.
Agent review details

Security

None.

PR surface

Source +3, Tests +97. Total +100 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 4 1 +3
Tests 1 103 6 +97
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 107 7 +100

Review metrics

Metric Value Why it matters
Production vs test delta production +3 net; tests +97 net The small production change is justified by the Slack upload-owner contract, while the test expansion covers precedence and MIME normalization cases.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain this plugin-local use of the shared MIME helper and attach redacted after-fix Slack upload proof showing the inferred filename before landing.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain this plugin-local use of the shared MIME helper and attach redacted after-fix Slack upload proof showing the inferred filename before landing.

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

No high-confidence real-world reproduction is attached: current source proves the unnamed fallback is upload, but no Slack workspace or qualifying gateway-harness result demonstrates the resulting preview behavior.

Is this the best way to solve the issue?

Yes: this is the narrowest maintainable repair because it changes the Slack-owned filename fallback and reuses the existing public MIME-normalization helper, matching the Discord precedence pattern.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: This is a bounded Slack outbound-media correctness fix that improves how unnamed attachments render without affecting core availability or data integrity.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR documents mocked Slack WebClient tests, not a real Slack upload or mock-gateway harness verdict; add redacted after-fix runtime evidence before merge. 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.

Label justifications:

  • P2: This is a bounded Slack outbound-media correctness fix that improves how unnamed attachments render without affecting core availability or data integrity.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR documents mocked Slack WebClient tests, not a real Slack upload or mock-gateway harness verdict; add redacted after-fix runtime evidence before merge. 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.

Evidence

What I checked:

  • Current main still has the fallback: Current main passes the literal fallback upload when both explicit and loader filenames are absent, so it does not implement MIME-derived names. (extensions/slack/src/client-delivery.ts:264, 6a8e11e63cee)
  • Correct owner-boundary repair: The branch changes the existing Slack filename decision to preserve explicit and loader-provided names before using the public MIME helper; the caller continues forwarding filename and title unchanged. (extensions/slack/src/client-delivery.ts:265, fd0858824672)
  • Shared helper and sibling precedent: The public plugin SDK re-exports the normalizing helper, which returns preferred extensions or undefined; Discord already uses the same requested-name, loader-name, MIME-extension, fallback precedence. (packages/media-core/src/mime.ts:269, 6a8e11e63cee)
  • Focused regression coverage: The added table covers PDF, PNG, MP3, MIME aliases and parameters, filename/title precedence, and unknown or absent MIME through the Slack WebClient upload-request boundary. (extensions/slack/src/send.upload.test.ts:847, fd0858824672)
  • History and ownership: Blame and symbol history tie the current upload fallback and MIME facade to the commit that created the current Slack delivery module. (extensions/slack/src/client-delivery.ts:264, 34e73d25a6f2)
  • Unreleased branch change: No release tag contains the PR head, so the proposed behavior is neither on current main nor in the latest release. (fd0858824672)

Likely related people:

  • Shakker: Commit 34e73d2 created the current Slack delivery module, MIME helper facade, and helper implementation; current fallback blame points to that commit. (role: introduced current delivery and MIME-helper path; confidence: high; commits: 34e73d25a6f2; files: extensions/slack/src/client-delivery.ts, src/plugin-sdk/media-mime.ts, packages/media-core/src/mime.ts)
  • steipete: Earlier current-history commits include Slack delivery refactors and feature work in the affected files, independent of this proposed branch. (role: recent Slack-area contributor; confidence: high; commits: 90a545b9e660, 934a974c296f; files: extensions/slack/src/client-delivery.ts, extensions/slack/src/send.upload.test.ts)
  • NIO: Recent upload timeout work touched the same Slack delivery surface and is relevant to preserving its upload lifecycle. (role: adjacent upload-lifecycle contributor; confidence: medium; commits: b2f11462c80c; files: extensions/slack/src/client-delivery.ts)

Rank-up moves

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

  • Add a redacted after-fix Slack workspace transcript, terminal output, or qualifying mock-gateway harness verdict that shows an unnamed known-MIME attachment receives the inferred filename.

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.

@clawsweeper

clawsweeper Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(slack): infer file extensions for unnamed media uploads This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@steipete
steipete merged commit 847e6ee into main Aug 5, 2026
168 of 172 checks passed
@steipete
steipete deleted the codex/auto-qa-slack-upload-mime-filename-owner-735 branch August 5, 2026 02:57
@steipete

steipete commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 5, 2026
* origin/main: (22 commits)
  refactor(plugins): consolidate lifecycle hook dispatch (#119429)
  fix(ci): stabilize TUI PTY proof ownership (#119420)
  test(system-agent): reduce suite setup overhead (#119424)
  fix(ui): keep session rail pill status from overlapping the headline (#119397)
  fix(discord): avoid doctor runtime loading (#119391)
  fix(media): decouple playback cache retention (#119417)
  fix(slack): infer upload filename extensions from MIME types (#119399)
  refactor(channels): unify configured binding resolution (#119414)
  refactor(google-meet): unify gateway and tool dispatch (#119413)
  test(state): reuse legacy database fixtures (#119423)
  fix(reset): preserve bootstrap guidance for dynamic models (#119179)
  fix(chutes): honor serving context limits (#119196)
  refactor(status): consolidate scan projections and lazy loaders (#119412)
  fix(status): status --all slows down with missing plugins (#119203)
  refactor(gateway): consolidate usage reporting and caches (#119409)
  perf(gateway): keep reload and recovery machinery off gateway cold start (#119094)
  fix(cli): align TaskFlow controller columns for wide text (#118801)
  fix: make startup migration restart guidance install-neutral (#119406)
  fix(ci): preserve cache warmer shard envelopes (#119403)
  fix(sessions): preserve compatible auth profiles on model changes (#117550)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: slack Channel integration: slack maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant