Skip to content

fix: preserve percent sequences in media download filenames - #139508

Merged
steipete merged 3 commits into
mainfrom
codex/qa30-15-managed-media-filename-20260905
Sep 6, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/qa30-15-managed-media-filename-20260905

Conversation

@steipete

@steipete steipete commented Sep 5, 2026

Copy link
Copy Markdown
Contributor
Additional instructions

MUST: Keep Allow edits from maintainers enabled for this PR so maintainers
can help update the branch when needed.

What Problem This Solves

Fixes an issue where users downloading managed audio, video, or image attachments received a changed filename when the name contained a literal percent sequence. For example, Chromium saved recording%20take.wav as recording take.wav, even though the attachment retained the correct name in chat. Image thumbnails had the same problem.

Why This Change Was Made

The managed-media route now uses the existing shared download filename encoder for every media kind and variant. Removing its separate ASCII serializer keeps the exact filename in filename* and consolidates the handling already used for Unicode names and documents.

Production LOC: +1/−8 (net −7). Tests: +81/−23. The media playback guide also documents preserved download names.

User Impact

Literal percent sequences remain part of downloaded filenames. Originals and image thumbnails share the same filename handling, while inline media and document download dispositions retain their existing behavior.

Evidence

  • The new HTTP regression table failed before the repair for audio, video, full images, and thumbnails; the Unicode and document controls passed. After the repair, all 119 tests in src/gateway/managed-image-attachments.test.ts passed.
  • A real loopback HTTP server mounted the production managed-media handler with an isolated canonical session and transcript. Chromium downloaded a valid 1,644-byte PCM WAV through the same download attribute used by the UI. Before: recording take.wav. After: recording%20take.wav. Plain ASCII and Unicode controls also passed. Every response returned HTTP 200 and the complete WAV, and each owned browser, server, download, and state directory was cleaned up.
  • The full changed gate passed, including core and test typechecks, lint, export scans, and architecture guards. Managed Codex autoreview returned scoped-clean with no findings through P2.
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/gateway/managed-image-attachments.test.ts --reporter=dot
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/check-changed.mjs -- src/gateway/managed-image-attachments.ts src/gateway/managed-image-attachments.test.ts docs/nodes/media-playback.md

Remaining broad validation runs in hosted CI on the published PR head.

@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: S maintainer Maintainer-authored PR labels Sep 5, 2026
@steipete
steipete marked this pull request as ready for review September 5, 2026 23:28
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 5, 2026
@clawsweeper

clawsweeper Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 9:13 PM ET / September 6, 2026, 01:13 UTC.

ClawSweeper review

What this changes

The PR preserves literal percent sequences in managed media download filenames by reusing the shared filename encoder, with regression coverage and documentation.

Merge readiness

✅ Ready for maintainer review

This remains a useful, focused fix: fetched main and the latest release retain the faulty filename path. No blocking correctness or security finding remains, and the supplied browser evidence supports the repair.

Priority: P2
Reviewed head: 1502247fb176f93e4ff8f1d1efd8559d1700e194

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A narrow owner-level repair with meaningful HTTP regression coverage and directly relevant browser evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied Chromium run exercised the production managed-media handler through real loopback HTTP and observed the corrected saved WAV filename, complete bytes, and passing ASCII/Unicode controls.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The supplied Chromium run exercised the production managed-media handler through real loopback HTTP and observed the corrected saved WAV filename, complete bytes, and passing ASCII/Unicode controls.
Evidence reviewed 7 items Fix remains necessary on fetched main: The managed-media serializer still emits only the quoted filename parameter for ASCII media names, including literal percent sequences.
Latest release retains the affected path: The supplied latest release, v2026.9.2, contains the same ASCII-only serializer.
Shared encoder preserves safe response metadata: The inspected helper sanitizes CR/LF, builds an ASCII fallback, percent-encodes the UTF-8 filename, handles malformed surrogates, and retains inline disposition for images, audio, and video. The existing assistant-media route already uses it. The patch changes header serialization without changing access checks or storage.
Findings None None.
Security None None.

How this fits together

The Gateway serves session-scoped media attachments to OpenClaw clients. Its download headers tell browsers how to name saved originals and image thumbnails.

flowchart LR
  A[Client download request] --> B[Session attachment access checks]
  B --> C[Managed original or thumbnail]
  C --> D[Shared filename encoder]
  D --> E[HTTP media response]
  E --> F[Browser saves named file]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Source -7, Tests +58, Docs +3. Total +54 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 1 8 -7
Tests 1 81 23 +58
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 85 31 +54

Review metrics

None.

Technical review

Best possible solution:

Use the existing shared encoder for all managed-media download headers while preserving media dispositions and session-scoped access.

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

Yes: source identifies the ASCII-header path, and the supplied Chromium before/after observation demonstrates the percent-sequence failure. This review did not execute a reproduction.

Is this the best way to solve the issue?

Yes: removing the divergent serializer repairs the response-header owner and reuses an established encoder already used by the adjacent assistant-media route.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 4d8398494f8e.

Labels

Label justifications:

  • P2: The fix addresses incorrect downloaded filenames with a limited blast radius.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The supplied Chromium run exercised the production managed-media handler through real loopback HTTP and observed the corrected saved WAV filename, complete bytes, and passing ASCII/Unicode controls.
  • proof: sufficient: Contributor real behavior proof is sufficient. The supplied Chromium run exercised the production managed-media handler through real loopback HTTP and observed the corrected saved WAV filename, complete bytes, and passing ASCII/Unicode controls.

Evidence

What I checked:

  • Fix remains necessary on fetched main: The managed-media serializer still emits only the quoted filename parameter for ASCII media names, including literal percent sequences. (src/gateway/managed-image-attachments.ts:1588, 4d8398494f8e)
  • Latest release retains the affected path: The supplied latest release, v2026.9.2, contains the same ASCII-only serializer. (src/gateway/managed-image-attachments.ts:1588, 3928bad9badf)
  • Shared encoder preserves safe response metadata: The inspected helper sanitizes CR/LF, builds an ASCII fallback, percent-encodes the UTF-8 filename, handles malformed surrogates, and retains inline disposition for images, audio, and video. The existing assistant-media route already uses it. The patch changes header serialization without changing access checks or storage. (src/gateway/assistant-media-content-disposition.ts:3, 1502247fb176)
  • Regression coverage exercises the HTTP boundary: The table checks percent-containing audio, video, full-image and thumbnail names, plus Unicode and document controls. Assertions cover encoded filenames, content types, and dispositions. Existing shared-encoder tests cover delimiters, control characters, length bounds, and malformed surrogates. Tests were inspected, not executed during this read-only review. (src/gateway/managed-image-attachments.test.ts:455, 1502247fb176)
  • Supplied real browser evidence: The captured PR body reports Chromium downloading a complete 1,644-byte PCM WAV through a loopback server mounting the production handler and the UI's download-attribute pattern: recording take.wav before, recording%20take.wav after, with ASCII and Unicode controls passing. This directly exercises the changed response metadata. Captured context sourceRevision: 912a962f896e4fe801172104fa830f1cc1f6174ffcfdbf9093b3b97b586fa93f.
  • Re-review continuity: The three reviewed files are unchanged from the previous reviewed head. The supplied completed review projection contains no findings or published rank-up moves. (1502247fb176)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vyctor H. Brzezowski: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-05T23:33:32.925Z sha a5a9b21 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T00:52:59.283Z sha 96caae0 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 72e2d45 into main Sep 6, 2026
175 checks passed
@steipete
steipete deleted the codex/qa30-15-managed-media-filename-20260905 branch September 6, 2026 02:25
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to ylcn91/openclaw that referenced this pull request Sep 6, 2026
* commit '6c55a99226ed0611ca088004c81b00fb296f1f71': (182 commits)
  test(ui): scope dashboard settings setup to the top frame (openclaw#139618)
  refactor(skills): share pending proposal creation (openclaw#139617)
  fix(release): accept frozen targets before worker bundles (openclaw#136699)
  fix(gateway): preserve percent sequences in media filenames (openclaw#139508)
  fix: preserve current update availability alongside update history (openclaw#139501)
  feat(diagnostics): expose garbage collection duration metrics (openclaw#139592)
  fix(ui): keep Logbook timestamps clear of the activity stripe (openclaw#139539)
  fix(ui): keep Swarm outcomes visible after completion (openclaw#139490)
  test: check file accessibility without runtime-specific return values (openclaw#139590)
  refactor(sdk): keep helper types private (openclaw#139601)
  fix(cron): preserve current-session delivery intent (openclaw#139491)
  fix: prevent browser profile permission hangs in Doctor (openclaw#139612)
  fix(agents): repair storage-failure test fixture after failover owner move (openclaw#139531)
  fix(cli): keep note text with Windows and Unicode line endings (openclaw#139512)
  fix(agents): keep isolated completion context on its admitted generation (openclaw#139607)
  fix: avoid declaration builds during source-server updates (openclaw#139392)
  fix(models): keep discovered models after catalog refresh failures (openclaw#139357)
  fix(gateway): record a transcript notice when a run fails before replying (openclaw#139439)
  refactor(ios): reuse shared integer conversion (openclaw#139581)
  fix(sessions): prevent database lock failures during reclamation (openclaw#139469)
  ...
vincentkoc added a commit that referenced this pull request Sep 6, 2026
* commit 'refs/openclaw/tasks/pr-135167-main-latest':
  test(ui): scope dashboard settings setup to the top frame (#139618)
  refactor(skills): share pending proposal creation (#139617)
  fix(release): accept frozen targets before worker bundles (#136699)
  fix(gateway): preserve percent sequences in media filenames (#139508)
  fix: preserve current update availability alongside update history (#139501)
  feat(diagnostics): expose garbage collection duration metrics (#139592)
  fix(ui): keep Logbook timestamps clear of the activity stripe (#139539)
  fix(ui): keep Swarm outcomes visible after completion (#139490)
  test: check file accessibility without runtime-specific return values (#139590)
  refactor(sdk): keep helper types private (#139601)
  fix(cron): preserve current-session delivery intent (#139491)
  fix: prevent browser profile permission hangs in Doctor (#139612)
  fix(agents): repair storage-failure test fixture after failover owner move (#139531)
  fix(cli): keep note text with Windows and Unicode line endings (#139512)
  fix(agents): keep isolated completion context on its admitted generation (#139607)
  fix: avoid declaration builds during source-server updates (#139392)
  fix(models): keep discovered models after catalog refresh failures (#139357)
  fix(gateway): record a transcript notice when a run fails before replying (#139439)
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant