Skip to content

acpmux: refuse Windows device names (CON, NUL, COM1) for dropped files - #23562

Merged
teamleaderleo merged 2 commits into
feat-cmux-nextfrom
acpmux-file-put-device-names
Oct 21, 2026
Merged

teamleaderleo merged 2 commits into
feat-cmux-nextfrom
acpmux-file-put-device-names

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A file the person drops into a chat is saved by name under acpmux's uploads folder (_acpmux/file_put, #23324). On Windows, a name such as CON, nul.txt, COM1.log, CONIN$, or one ending in a dot or a space, does not name a file in that folder: it opens a device, or the name is silently changed. is_file_name now refuses these names on Windows, the same way it already refused \ and : there.

  • The stem is the part before the first dot, with trailing spaces trimmed and compared case-insensitively. A stem of CON, PRN, AUX, NUL, CONIN$ or CONOUT$ is refused.
  • COM or LPT followed by exactly one of 1-9, ¹, ² or ³ is refused.
  • A name ending in . or is refused.
  • Names that only look similar are kept: CONSOLE.txt, COM10, COM0, nullable.rs, aux_data.csv, LPT.

Other platforms are unchanged. The check sits behind is_file_name_for(name, windows), so the Windows rules can be tested on Linux.

Testing

Focused command: cmux-tui.yml dispatch, mode=focused. The new test is hub::file_uploads::tests::a_windows_device_name_is_no_file_name_on_windows.

  • Red at c13a48c, the test commit (run 39633604233, filter windows_device_name): it fails to compile because is_file_name_for doesn't exist yet. The test calls the Windows rules directly, so before this change there was nothing to call.
  • Green at 59b868b (run 39633616267, filter file): all four file_uploads tests pass, the new one included.
  • cargo check --target x86_64-pc-windows-gnu passes (run 39633630080).

Observed / Not run

  • Observed: the red and green runs above. In the green run, the only other reds are already red on base and unrelated to this change:
    • clippy redundant clone in cmux-tui-core;
    • MSRV could not fetch the cmux-codex-acp git dependency;
    • cli::tests::action_surface_parity::pane_open_files_and_find_as_run_their_actions_with_a_path, which the file filter picked up.
  • Not run: a real Windows file save. Only the name check is tested.

Changelog

Fixed: a file dropped into a chat on Windows can no longer be saved under a device name such as CON or NUL.

No capture: daemon-only change with no UI.

Agent session: cosmic-gray

🤖 Generated with Claude Code


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes acpmux file saving on Windows so names like CON, NUL, COM1, or names ending in a dot or space are rejected, instead of opening a device or getting silently renamed.

  • Adds a Windows-only device-name check covering CON, PRN, AUX, NUL, COM1-9, LPT1-9, CONIN$, and CONOUT$ with any extension, plus trailing-dot and trailing-space names.
  • Refactors the name check into is_file_name_for(name, windows) so the Windows rules can be tested on any platform. Other platforms are unchanged.

Written for commit 59b868b. Summary will update on new commits.

View guided diff Turn on auto-fix

teamleaderleo and others added 2 commits October 21, 2026 09:17
On a Windows peer `uploads\<session>\<uuid>\CON` opens the console and
`nul.txt` the null device, and a trailing dot or space is dropped, yet
is_file_name accepts all of them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d3d-4bad-7860-b096-c54282b4bec4&host=cosmic-gray
A name whose stem is CON, PRN, AUX, NUL, COM1-9, LPT1-9 (or their
superscript forms), CONIN$ or CONOUT$, with any extension and in any
case, or one that ends in a dot or a space, is no file name on Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?harness=claude&session=01a15d3d-4bad-7860-b096-c54282b4bec4&host=cosmic-gray
@teamleaderleo teamleaderleo added the risk:normal Risk tier (docs/ci/risk-tiers.md) label Oct 21, 2026
@teamleaderleo
teamleaderleo temporarily deployed to cmux-tui-merge-tree October 21, 2026 16:41 — with GitHub Actions Inactive
@github-actions

Copy link
Copy Markdown
Contributor

cmux status (one comment, edited in place; each line is updated by the job that owns it)

Review 59b868b: HQ feed card · gallery before/after runs · checks

App of this head (app.zip, kept 1 day)

gh workflow run reload-build.yml -R manaflow-ai/cmux --ref feat-cmux-next -f tag=pr23562 -f ref=acpmux-file-put-device-names -f platform=macos -f backend_mode=local

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by attachments-matrix on cosmic-gray · session

1 similar comment
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by attachments-matrix on cosmic-gray · session

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Bead cx-cl4pq created for this PR by the cmux coordinator.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (independent subagent, correctness first): SHIP at 59b868b

  • The Win32 rules match Windows' behavior, the same rules as Python 3.13's os.path.isreserved. Other platforms are unchanged, and the Swift pre-check needs no change.
  • Nits not taken: refusing COM0/LPT0 as well (Windows opens them as ordinary files), and to_ascii_uppercase.
  • Checks at this head: no failures. The cancelled runs are superseded attempts. Release compile is still queued on the Mac runners; this PR touches no Swift.

@teamleaderleo
teamleaderleo merged commit 059c509 into feat-cmux-next Oct 21, 2026
@teamleaderleo
teamleaderleo deleted the acpmux-file-put-device-names branch October 21, 2026 16:52
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

This branch had an error being deployed

1 failed and 2 inactive deployments
artifacts — 59b868bd Deployed Oct 21, 2026 by teamleaderleo
sentry-dsyms — 59b868bd Deployed Oct 21, 2026 by teamleaderleo
cmux-tui-merge-tree — 59b868bd Deployed Oct 21, 2026 by teamleaderleo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant