On FreeBSD process capture was a stub that returned "only available on
Linux and macOS", so a console study kept no runs and a console run check
never ran the build. The nightly FreeBSD job has failed on the two tests
that cover them since they landed (#1679, #1702).
FreeBSD now captures the way Windows does: the program runs through
platform::process (its process group is ended with it) and its output is
read through pipes, which keep what a short program wrote after it exits;
a terminal on FreeBSD loses it. Scripted input, resizes, signals and
watched files still need the terminal capture and are refused there.
The pipe capture now has a Unix test, and capture_and_compare_echo runs on
every Unix rather than only Linux and macOS.
The lock tracker logged a problem while holding its registry lock. The app's logger writes to a file behind one of the tracked locks, which locks the registry again, so the thread waited on itself and every other lock in the app waited behind it: the window froze for good about 30 minutes into a long tool call that other threads were waiting on. Problems are now recorded under the registry lock and logged after it is released. Fixes#1907.
* settings: call the private-folder helper through its module
* journal: format the redaction helper
* Secure the config directory before replacing settings
CI's stable Rust moved to 1.100, whose Cargo runs a test binary from target/<profile>/build/<package>/<hash>/out instead of target/<profile>/deps, so self_cli_path no longer found the CLI built into target/<profile> and two rebuild tests failed on main and every pull request. It now looks in target/<profile> from that folder too; the earlier checks are unchanged.
Play's Stop (and stopping a project's running app) sent the kill and then waited for the program with no limit while holding the launch's lock, which the watcher and every is-it-running check also take. It now sends the kill under the lock and waits outside it for at most five seconds, logging a program that is still there and returning false, as for other runs since #1438.
When a program printed more than its output cap, its error said "what it printed last" from the first bytes kept and never said the rest was dropped. The process runner now also keeps the last 16 KiB of a stream once it passes its cap; failure messages, ssh diagnosis and build checks quote that end and say the output was cut, while tools that parse output still get its start.
The input loaders trust an earlier file-size report before reading to EOF. A regular virtual file can report zero bytes and still return data beyond the configured limit, and files can grow between the size check and read. Some loaders accept devices or pipes, allowing a text or evidence-bundle request to wait indefinitely for a writer. Prefix reads also use metadata size to decide whether to assign a whole-file hash, so a truncated prefix of a zero-size-reporting file is misidentified as the whole input.
The test that a launched program's log is cut while it writes assumed the cut would come within the few seconds its stand-in spent printing, so on a loaded machine the file could end over its bound with nothing wrong. The stand-in now watches its own log and keeps printing until it has seen a cut and filled the file again, and the test checks it saw a cut before checking the size. No change outside the test.
A program started from Play or a pin wrote last-run.log or play.log for as long as it printed, with no limit. The program still writes straight to its file, now opened for appending, and while Craft Anything runs the file is cut back to empty once it passes 1 MiB (looked at every 2 seconds), so the program's writes never fail or block and the log's last lines are still there to read. A program that outlives the app is left as it was.
After stopping a program, the wait for it to be gone stopped silently when checking its exit failed. It now logs a warning with the error; a program that ended, one still running, and one past the 5-second grace behave as before.
When a run's time limit or a cancel fired, the program was stopped through a call that then waited for it with no limit (and on Windows for a job message the system doesn't promise to send), so a program that outlived its stop held the run past every deadline, Pause included. The program and whatever it started are still stopped, but the run now waits at most 5 seconds for them to be gone, then logs a warning and carries on.
Refs #1438
A private browser or driven Electron app was stopped only when its process handle was dropped, which a crash, a kill, a force quit or an MCP server stopped by its client never does, so the browser was left running and its profile stayed in the temp folder. On Unix a small watcher now stops the browser's process group and deletes its `craft-*` profile once the app is gone, and ends by itself as soon as the browser does. Windows children are held by a Job Object; whether one outlives an abrupt exit is left as a roadmap line.
Refs #810
On Windows, a .cmd wrapper whose only command is one quoted, absolute .exe path followed by %* is started as that .exe, so its arguments skip cmd.exe (no % expansion, no 8191-character cap, line breaks allowed). Any other wrapper still runs as it is. The test that starts the .exe is Windows-only and isn't run by the Linux gate.
Fixes#1237
Someone signed in with `grok login` can build with their installed `grok` through ACP, with our approver deciding permission requests. Clean room, deep chat and questions are refused before it starts, because Grok can't keep to them; only Grok's sessions send `"type": "stdio"`.
The test that a stopped launch takes its descendants with it uses a parent and child started without a shell, so it runs the same on Unix and Windows, and a failed start still stops what it launched.
Without Screen Recording the capture is refused before the program starts, with where to allow it. The name fallback matches whole words and never the system's own windows, and a window that's late gets up to 10 more seconds.
Pasted pictures get a counter in their name; atomic-write temp files are created exclusively and private from the start; stand-in replay samples keep differing response details.
Program starts and console opens share one lock, and a timeout ends the whole process tree first.\n\nCo-authored-by: SoldierPePe <ahmed.m.alnajjar1@gmail.com>
On Windows with nvm and no version in use, npm shims such as `claude.cmd` find Node in nvm's version folders; if it's still missing the error names `node` and `nvm use`.
Thanks @Agapenordev! Supervised browser hand-off now waits for process-group/Job Object shutdown, and private-profile removal retries transient locks for up to five seconds. Missing profiles count as already cleaned.
Reviewed source head 6e3398d28b. Hosted Ubuntu CI is green. On AnayPC, the applicable engine/platform tests, clippy, layers, locks, secrets and wasm checks pass. Two Windows UI-automation tests also fail on pristine main because the SSH session cannot create interactive WinForms windows; their baseline and candidate failures are preserved.
Related #810 remains open: this follow-up does not establish that the broader live macOS/Brave issue is fully resolved.
An MCP plugin whose `tools/list` answer is one JSON-RPC line over 1 MiB never loaded: the process reader cut long lines into fragments that never parsed, so the plugin timed out. The partial-line cap is now the 16 MiB the MCP client already allows, with a regression test for a multi-megabyte line.
A program whose file is busy (just written, still open for writing in a child another thread is starting, so Linux says Text file busy) is tried again for about 0.3 s before its start fails. Fixes flaky test failures and a start just after an agent's CLI updates.
The keep-awake helper ends by itself once the app it serves is gone (Windows checks the process every 30 s, macOS uses caffeinate -w), so closing the window during a build no longer keeps the computer awake.
A program started by a relative path in another folder is looked up where it starts before it's reported as a path with no file (on Unix, a script there whose interpreter is missing).
A program started by its path (a saved agent program, say) with no file there says so and names the path, as possibly moved by an update, instead of "isn't installed or isn't on your PATH"; it stays a missing program, so builder turns aren't retried (refs #721).
On Windows, Antigravity's CLI (agy.exe) is also looked for straight in its Antigravity folder, where newer installers put it; the desktop app's own Antigravity.exe is never taken for it (fixes#737).
On Linux a switched-off screen (a closed laptop lid) no longer counts as the one the GPU drives, and PCI ids pick a card only when no other card shares them (follow-up to #659).
On Linux the window is drawn on the GPU that drives the screen (the built-in panel's, or the only one with displays), so laptops with two GPUs open fast and don't lag; WGPU_ADAPTER_NAME and WGPU_POWER_PREF still decide (fixes#571). Replays #578.
Co-authored-by: Thân Minh Nghĩa <thanminhnghia3@gmail.com>
Replays #616, #617, #619, #620 and #621. Aider isn't offered until it has an adapter, Antigravity is found under a redirected LOCALAPPDATA, servers with only specialised models aren't set up for chat, an SSE event's data is capped, and a retry keeps the original request when the agent's session can't be restored. Program lookup adds lower-case extensions on Windows.
Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
A program that is on disk but can't start (an npm script whose node is missing) says where it is and what to check, instead of "isn't installed"; on Windows an .exe is started by the path it was found at (refs #152, #95).
Fixes a flaky platform test: on macOS an accepted socket inherits the listener's non-blocking mode, so the keep-awake stand-in helper dropped a stop that arrived after accept.
Replays #597, #598, #600 and #601. The preview server answers only requests addressed to this computer, streams files, sends no body for HEAD on a missing file, caps open connections and gives a request head one deadline.
Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
The rebuild releases its keep-awake helper before reporting Finished, and dropping the guard waits up to five seconds for the helper to stop (logging if it doesn't), so a CLI that exits right away no longer leaves it running.
The engine had its own `write_atomic` (used for `craft.json`, the inbox, reports and session files). Its temp file was named by process only, so two threads saving the same file at once wrote into one temp file. One rename then found it gone ("craft.json: No such file or directory"), and the file could end up with two versions mixed ("trailing characters").
The engine now uses the platform crate's `write_atomic`, which already gave each write its own temp file and kept the file's permissions. It also gains the engine's short retry when Windows briefly can't replace a file another program holds open. There is one atomic writer now; docs/pitfalls.md says so.
**Verified:**
- A new engine test: four threads each save one file 50 times and read it back. Every save succeeds, every read is one whole version, and no temp files are left. It fails against the old engine writer (checked) and passes now.
- The existing "file held open for a moment" test still passes.
- `cargo test -p craft-anything-engine` (397), the platform fs tests, clippy on both crates and fmt.
**Not covered:** two saves that overlap can still each start from what was on disk, so the later one wins for fields that aren't the person's (the person's fields are kept, as before). That's separate from the write itself.
Fixes#273
On a timeout with a grace period, a capture sent SIGTERM to the group, then waited only for the leader. When the leader exited, it skipped the SIGKILL, so a helper in the group that ignores SIGTERM kept running after the capture returned (reported as `still_running` / `incomplete`).
Now the grace period waits for the whole group to be gone, reaping the leader as it goes so a zombie doesn't count. Whatever is left afterwards gets SIGKILL. `settle` uses the same group check.
**Verified:**
- A new Linux/macOS test with the reporter's helper (ignores TERM and HUP, outlives the leader): the capture must settle, verify cleanup and report SIGKILL.
- `cargo clippy -p craft-anything-platform --all-targets --target x86_64-unknown-linux-gnu -D warnings`, fmt.
**Not verified locally:** this machine is Windows without WSL, so the new test first runs in CI (Ubuntu). macOS isn't run; it uses the same code.
Fixes#230
A runtime capture compared a file's size, type and hash. When the file was over the hashing budget (or couldn't be read), neither snapshot had a hash, so a rewrite at the same size was reported as `unchanged`. Now:
- such a file is `unknown`;
- a file is `modified` only when its size or type changed, or both hashes exist and differ;
- a symlink pointed somewhere else with a target of the same length is `modified` (only the target's length was compared before).
**Verified:** a new unit test of `effects` (unhashed on either side, equal and different hashes, a size change, symlink retargets); `cargo test -p craft-anything-platform` (47 passed), clippy, fmt. The test runs on every OS, unlike the shell-based capture tests.
**Not verified:** a live run of the issue's capture probe on macOS.
Fixes#229
project_play's help says that on Windows a started program inherits the caller's output pipe (#207), and the reproducing test is kept in platform as an ignored test.
npm's global prefix, from NPM_CONFIG_PREFIX or prefix= in ~/.npmrc (its bin folder outside Windows), is searched after PATH with the other usual folders, without running npm. Fixes#132.