Skip to content

Windows: build fails without crossterm, and every Edit/Write prompts even in bypassPermissions #1

Description

@scp3500

Environment

Windows 11 (10.0.26200.7171), rustc 1.93.1 / x86_64-pc-windows-msvc, baseline 747c21c.

Two Windows-only defects. The first blocks the build, the second makes bypassPermissions useless
for every edit once it does build.


1. cargo build --release fails: crossterm is used but never declared

error[E0433]: failed to resolve: use of unresolved module or unlinked crate `crossterm`
   --> src\utils\asciicast.rs:157:31
157 |     if let Ok((cols, rows)) = crossterm::terminal::size() {

That call is in the #[cfg(not(unix))] arm of get_terminal_size(), so Unix never compiles it and
nothing points at a missing dependency.

Fix: crossterm = "0.29" in Cargo.toml (iocraft already uses 0.29.0, so no new crates).


2. Every Edit/Write prompts, even in bypassPermissions

std::fs::canonicalize() returns verbatim paths on Windows (\\?\E:\dir\file).
resolve_deepest_existing_ancestor (src/utils/fs_operations.rs:156) puts that form into the
permission-check candidate list, and the path safety check then reads it as a suspicious
user-supplied
path — has_suspicious_windows_path_pattern (filesystem.rs:463) matches the leading
\\?\ and the drive colon now sitting past index 2, and is_dangerous_file_path_to_auto_edit
(filesystem.rs:513) matches the leading \\.

That produces a SafetyCheck ask, which is bypass-immune on purpose
(tool_permission_ask_is_bypass_immune, permissions.rs:2411), so it survives every mode.

Repro:

mkdir cc-repro && cd cc-repro && echo foo > hello.txt
cometix -p "Replace foo with bar in hello.txt using the Edit tool."
[DEBUG] Reading through symlink: E:\cc-repro\hello.txt -> \\?\E:\cc-repro\hello.txt
[DEBUG] Aborting: tool=Edit
Error: Request aborted

Interactively it is the normal edit-permission dialog, on every single edit, with
⏵⏵ bypass permissions shown.

Fix: strip the verbatim prefix where canonicalization introduces it — a small
strip_verbatim_prefix helper in fs_operations.rs applied to the canonicalize() results in
resolve_deepest_existing_ancestor, plus the same normalization in
check_path_safety_for_auto_edit (also covers the safe_resolve_path entry point,
path_validation.rs:419).

Local patch verified: same command now exits 0 and rewrites the file, no Aborting line. I can send
it as a PR if you prefer.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions