Commit Graph

21 Commits

Author SHA1 Message Date
oldschoola ae927b6f81 fix(pi-shell): unblock bash heredocs >4 KiB on Windows and >64 KiB on macOS
brush_core::interp::setup_open_file_with_contents wrote the entire heredoc/here-string body into an anonymous pipe synchronously before handing the reader to the downstream command. Bodies that exceed the OS pipe buffer (~4 KiB on Windows, 16-64 KiB on macOS) deadlocked the writer forever, and the bash tool tripped its 305 s hard timeout without ever launching the consumer. The Linux fast path still uses F_SETPIPE_SZ to grow the pipe inline; every other platform (and Linux bodies that overflow pipe-max-size) now decouples the write onto a fire-and-forget thread that terminates on drain or BrokenPipe.

Adds a 256 KiB regression test that exercises the worst-case shape (: builtin, which never drains stdin), guarded by tokio::time::timeout(10s) so a regression fails CI fast instead of hanging.
2026-05-26 20:12:39 +02:00
can1357 4a44bd1e52 fix(pi-shell): added Sync bound to descendant termination helper
- Updated `terminate_new_descendants` to require the `Sync` marker on its hash-set hasher.
- This tightened async helper bounds without changing its termination-wave logic.
2026-05-25 21:20:23 +02:00
roboomp 8e5c7c9bf1 fix(bash): kept persistent shells after cancel
Stopped marking persistent bash sessions as permanently broken when the JavaScript abort or timeout race wins.

Stopped the Rust descendant kill-wave helper once no cancellation targets remain so later commands are not swept into old cancels.

Fixes #1347
2026-05-25 18:40:22 +00:00
roboomp de5b0a51e2 fix(bash): forcefully terminated canceled shells
Added Rust-side descendant termination on shell cancellation paths so aborts and timeouts escalate to SIGKILL even if brush cleanup stalls.

Covered SIGTERM-ignoring shell workloads in native tests.

Fixes #1347
2026-05-25 18:13:49 +00:00
can1357 c7b2fec204 fix(run-rs-task): always ran fmt:rs regardless of Rust-affecting changes
- Exempted the `fmt:rs` task from the early-exit skip logic so formatting always runs.
- Reformatted `apply_command_env` signature in shell.rs to satisfy the formatter.
2026-05-15 07:10:41 +02:00
can1357 d4f9b5d497 Merge remote-tracking branch 'origin/farm/d3b4991c/fix-windows-env-colon-vars' 2026-05-15 07:05:42 +02:00
roboomp 737288676c fix(pi-shell): preserved $env:VAR refs through brush expansion
Brush-core applied POSIX parameter expansion to $env before dispatching a command, mangling PowerShell references like Write-Host $env:SystemRoot to :SystemRoot. Move the fix down to env-var application: every brush session now defines env=$env as an internal (non-exported) shell variable, so the bash expansion of $env yields the literal $env and PowerShell tokens reach the child intact. User assignments (env=prod; echo "$env:8080") still shadow the fallback in their command scope, so the POSIX bash contract is preserved.

Fixes #1079
2026-05-15 03:50:51 +00:00
can1357 db19fb565e style(pi-shell): formatted fixup shell cleanup code and tests for readability
- Converted several single-line guard-style `if let`/`let Some` exits in `fixup.rs` into multiline blocks for consistent style.
- Reformatted the safe-argument regex definition and normalized test case formatting in `fixup.rs` without altering assertions.
- Reordered `lib.rs` module exports by moving `fixup` ahead of `minimizer`.
2026-05-15 03:46:31 +02:00
can1357 92c42f44f7 fix(coding-agent/tools): resolved bash fixup parsing for head/tail chunks
- Added top-level parsing and segment splitting to apply bash fixups only on safe command chunks.
- Replaced `stripTrailingHeadTail` usage with `applyBashFixups` and array-based notice formatting.
- Fixed terminal `| head`/`| tail` and redundant `2>&1` stripping while preserving command semantics.
- Updated fixup tests for cross-command cases and removed superseded head-tail-only test coverage.
2026-05-15 02:12:28 +02:00
can1357 f24afe13f4 fix(read): added truncation tally markers and elision recovery footers
- Updated shell minimizer line truncation to append `...[+N]` with the count of dropped Unicode scalars when truncation occurs.
- Updated read summary rendering to track `elidedLines`, include them in tool details, and append a recovery footer for `:raw` or line-range access whenever elided spans are present.
- Updated read-tool prompts/docs/tests to cover the new elision-footers and recovery guidance.

Fixes #1046
2026-05-14 23:22:27 +02:00
can1357 ab4416f5bb fix(crates): address clippy lints surfaced on linux baseline 2026-05-12 14:55:39 +02:00
can1357 1cffb3473a fix: corrected worktree baseline capture with synthetic tree diff
- Added untracked worktree baseline capture via `untrackedPatch` and synthetic tree diffing.
- Added fallback-aware backend ordering by collecting host candidates and retrying alternates on unavailable PAL.
- Hardened overlay mount lifecycle by removing stale overlays and deleting upper/work dirs after unmount.
- Refined ZFS clone deletion to validate ownership and remove dataset+origin only when checks pass.
- Updated ProjFS integration to use extended-info callbacks and symlink metadata reads.
- Updated rcopy path handling to absolutize paths, and added `writeTree` plus combined shell timeout checks.
2026-05-12 14:36:31 +02:00
can1357 f81af06a2b feat(pi-shell): add execute_shell_streams with per-stream raw byte sinks 2026-05-12 14:11:55 +02:00
can1357 900a42e8d9 deps(deps): added workspace dependency catalog and updated crate manifests
- Added a workspace dependency catalog in `Cargo.toml` for internal and external crates.
- Replaced explicit dependency specs and pinned versions with workspace references in crate manifests.
- Removed inline dependency overrides such as feature flags, renames, and package metadata.
- Consolidated platform-specific target deps (`libc`, `winreg`, `windows-sys`, `parking_lot`) to workspace entries.
2026-05-12 13:43:04 +02:00
can1357 34aed93f8e fix: win deps 2026-05-12 06:35:41 +02:00
can1357 a4d86a075a feat(coding-agent): added verbatim unicode rule to hashline prompt 2026-05-12 05:25:55 +02:00
can1357 338ec7284f fix(pi-shell): fixed macOS descendant traversal on broken proc_listchildpids
- Replaced macOS `Process::children` and `descendants` traversal with a one-shot `proc_listallpids` scan grouped by `pbi_ppid`, avoiding the broken self-query path in `proc_listchildpids`.
- Built `snapshot_all_pids` and `build_process_tree` helpers and updated descendant collection to walk that tree once, de-duplicating by PID in post-order.
- Added a Unix regression test that verified a freshly spawned child appears in `live_descendants`, preventing silent no-op cleanup on affected darwin kernels.
2026-05-12 05:07:19 +02:00
can1357 40753e9c7c fix(pi-shell): prevented shell cancellation from killing the harness process
- Restricted pgid adoption in `select_termination_targets` to only descendants that are their own group leader, preventing inherited harness pgids from entering the kill set.
- Added `kill_process_group` guard to refuse signaling the harness's own process group as a last-line defense.
- Awaited the `bridge_chunks` drain handle after shell/execute completes to ensure all output chunks are flushed before the future resolves.
2026-05-12 04:44:31 +02:00
can1357 9b536bd6e9 refactor(ps): moved process management logic to pi-shell crate
- Removed ~1,500 lines of platform-specific process code from pi-natives/ps.rs, delegating to pi_shell::process.
- Removed PTY execution support from pi-shell and pi-natives, including portable-pty dependency.
- Exposed terminate_tree and wait_for_exit as public methods on pi_shell::process::Process.
2026-05-12 03:43:32 +02:00
can1357 530942c0b2 feat(pi-shell): enabled PTY shell runs in pi-shell via PTY runner
- Added PTY flags to ShellRunOptions and ShellExecuteOptions and defaulted pty to false when unset.
- Routed PTY-enabled shell runs to a dedicated PTY runner and executed commands via `sh -lc` in a PTY.
- Handled PTY output with a dedicated thread, Chunk/Done events, child PGID cancellation, and drain-timeout cleanup.
- Added Unix-only PTY assertions and non-Windows native coverage for `executeShell` with `pty: true` and `/dev/` output checks.
- Added `portable-pty = "0.9"` (and lockfile update) to enable PTY execution in pi-shell.
2026-05-12 01:00:31 +02:00
can1357 41710a0a5f feat(cross-cutting): added pi-ast/pi-shell crates and rewired pi-natives
- Added `pi-ast` as a new crate with public `language`, `ops`, and `summary` modules and exported `SupportLang`.
- Added AST summary and rewrite APIs in `pi-ast`, including language inference, overlap-safe edits, and span normalization.
- Added `pi-shell` crate with new `Shell` and cross-platform `Process` APIs, session execution, and cancellation-aware runs.
- Updated `pi-natives` to use shared `pi_ast`/`pi_shell` APIs, switched to local path deps, and moved minimizer assets to `pi-shell`.
2026-05-11 03:43:58 +02:00