Commit Graph
60 Commits
Author SHA1 Message Date
FredApps 815655a482 Capture console programs on FreeBSD through pipes instead of refusing
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.
2026-11-17 05:41:11 +01:00
Scott Converse 573f2c4b93 Stop the lock watchdog freezing the whole app when it logs a problem (#1908)
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.
2026-11-15 22:12:02 +07:00
Dylan M. Taylor 84edfd6010 Fix the private config folder helper path (#1875)
* settings: call the private-folder helper through its module

* journal: format the redaction helper

* Secure the config directory before replacing settings
2026-11-14 15:21:24 -05:00
Dylan M. Taylor 88facbb716 settings: write config.toml owner-only in a private folder (#1873) 2026-11-14 14:33:14 -05:00
BFlat 1c7d619a2d Find the CLI from Cargo's newer test binary folder, so main's CI passes on Rust 1.100 (R5.2) (#1802) (#1802)
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.
2026-11-13 22:28:46 +07:00
Justin John 0a5ab0dba7 Stop a launched program without an unlimited wait under its lock (R5.3) (#1756) (#1756)
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.
2026-11-12 15:57:32 +07:00
Alex Joaquim Pereira 87408500d0 Keep a failed program's last output in its error (R2.9) (#1685)
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.
2026-11-11 20:32:53 +07:00
Afloat 28d1063a52 Bound input reads and refuse non-regular files before reading (R3.11) (#1611)
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.
2026-11-11 13:14:35 +07:00
muraa-p b328b7e96e Wait for the cut the log-cap test is about (#1466)
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.
2026-11-10 13:21:55 +07:00
muraa-p 06566e2909 Cap a run's log while the app is open (R2.10) (#218)
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.
2026-11-10 12:49:03 +07:00
Justin John 8d7df57008 Log it when a stopped program's exit can't be checked (R5.3) (#1455)
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.
2026-11-10 12:00:12 +07:00
Justin John 1ce50d5005 Wait only 5 s for a program that was stopped, so a check's time limit and Pause always take effect (R5.3) (#1454)
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
2026-11-10 11:45:08 +07:00
Justin John c7606c4551 Stop a private browser and delete its profile when the app ends without closing it (R2.9, #810) (#1376)
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
2026-11-09 22:51:21 +07:00
JG Tromp b78586dc75 Start a .cmd that only runs one .exe by its full path as that .exe (#1238)
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
2026-11-09 08:25:45 +08:00
Books 9d25ab431a Register a plain executable path Hermes can start on Windows (#1189)
Setup drops the \\?\ prefix Windows adds to the CLI's path when the plain path names the same file, so Hermes gets a command it can start.

Fixes #1167
2026-11-09 01:52:54 +08:00
Roman Serikoff 26b68359cd Make the preview connection-limit test pass on macOS (R5.2) (#1207)
The test sets its read timeout while the connection is still open, as macOS refuses socket options on one it reset.
2026-11-09 01:39:34 +08:00
NetterSilver 85c3f275c1 Reject non-hex characters in static server percent escapes (#1186)
A percent escape with a sign or another non-hex character (%+4) is refused instead of being decoded.
2026-11-09 01:18:32 +08:00
Harrison Smith 9f4c3c209b Offer Grok Build as a coding agent over ACP (#1029)
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"`.
2026-11-07 08:39:59 +08:00
Tomáš Doubek 74176f2cbe Test watched descendant shutdown on every system (#1030)
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.
2026-11-07 05:37:27 +08:00
Tomáš Doubek 50829156e2 Stop watched launches with their process trees (#1027)
Watched launches use process groups on Unix and Job Objects on Windows, so stopping one also stops what it started.
2026-11-07 04:25:38 +08:00
adamsardo 1a694a9d2d Say when macOS Screen Recording blocks a window picture, and stop picturing the wrong window (#1025)
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.
2026-11-07 04:23:35 +08:00
BFlat e0922f4ff4 Keep pasted picture names unique, create atomic-write temp files exclusively, and keep distinct replay samples (#995)
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.
2026-11-07 00:50:18 +08:00
BFlat 73fe0b661b Stop programs started alongside a console capture from holding it open (#997)
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>
2026-11-07 00:44:00 +08:00
Justin John c858a61c8d Find browsers under their other Linux names, and say why one isn't found (#927)
Finds browsers under more Linux names and says why one is missing: a bad set path, or the Flatpak sandbox.
2026-11-07 00:29:35 +08:00
Joseph e2eff95784 A hand-off that ends just before a kill reports its exit (#910)
A launcher that exits just before a kill reports its exit instead of "cancelled", and its Windows test waits for the launcher's mark.
2026-11-07 00:24:29 +08:00
Cleyson 6ec2888128 Find Node in nvm for Windows' folders and say when it's missing (#985)
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`.
2026-11-07 00:08:09 +08:00
Agapenor fc93bd091e Wait for browser shutdown before cleaning private profiles (#827)
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.
2026-11-05 18:46:31 +01:00
Rares Cristea 1eb4d0afe0 Read a plugin's whole tools/list line, however long (#797)
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.
2026-11-04 19:29:24 +07:00
BFlat 282a4bca5c Start a program that was just written, instead of failing with Text file busy (#787)
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.
2026-11-04 11:32:54 +07:00
Tanish Manku 8cf29dfa08 The keep-awake helper ends by itself once the app it serves is gone (#762)
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.
2026-11-04 10:06:18 +07:00
FuryNocturnTV (Tare Fernandez) 4d6e3b01bf Look up a relative program where it starts before calling its path empty (#772)
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).
2026-11-04 10:06:07 +07:00
FuryNocturnTV (Tare Fernandez) 0fc381c206 Count Antigravity's second folder in the Windows search path test (#770)
The Windows search-path test counts Antigravity's second folder, added by #748.
2026-11-04 10:06:02 +07:00
FuryNocturnTV (Tare Fernandez) c26e6ba525 Say when a saved program path has no file there, instead of blaming PATH (#739)
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).
2026-11-04 08:08:33 +07:00
Fábio Soares eb6babd593 Find Antigravity's CLI next to its own folder on Windows (#748)
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).
2026-11-04 08:08:07 +07:00
Thân Minh Nghĩa 2e0d0813e0 Ignore switched-off screens and shared PCI ids when picking the Linux GPU (#671)
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).
2026-11-03 22:54:25 +07:00
BFlatandThân Minh Nghĩa f05f019691 Draw on the GPU that drives the screen on Linux, so laptops with two GPUs open fast and don't lag (#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>
2026-11-03 21:57:08 +07:00
BFlatandAfloat aeb86a69a3 Agent setup and streaming fixes: Aider, Antigravity on Windows, chat-only models, SSE limits and retries (#653)
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>
2026-11-03 20:41:06 +07:00
Fábio Soares 78e1f7dce0 Say where a program is when it is there but can't start, instead of "isn't installed" (#583)
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).
2026-11-03 20:15:01 +07:00
Fábio Soares b9c4c53099 Find Hermes Agent's native Windows install when the app's PATH is older than it (#585)
Hermes Agent's native Windows install (%LOCALAPPDATA%\hermes\bin) is found even when the app's PATH predates it (refs #116).
2026-11-03 20:14:49 +07:00
NetterSilver 0cff0f4336 Keep-awake helper test accepts a stop that arrives after the connection (#629)
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.
2026-11-03 20:14:14 +07:00
BFlatandAfloat 3ee1642770 Serve previews only to this computer, stream their files and bound their connections (#649)
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>
2026-11-03 20:07:33 +07:00
Afloat 925d4737d1 Wait for keep-awake cleanup before a rebuild reports it finished (#541)
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.
2026-11-03 14:49:55 +07:00
phatloi0010 87b191a6be Capture teardown stops surviving group helpers after a normal leader exit (#387)
Capture teardown stops a helper left in the process group after the leader exits normally. Fixes #361.
2026-11-02 23:10:03 +07:00
BFlat 09fdc72e8d Saves from two threads at once never collide or mix a project file (#311)
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
2026-11-02 14:45:46 +07:00
BFlat 27d93b9ae3 A capture's timeout stops every process in the group, not just the leader (#246)
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
2026-11-02 13:39:04 +07:00
BFlat 07fe869dc4 A same-size rewrite of an unhashed file reads as unknown, not unchanged (#241)
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
2026-11-02 13:24:22 +07:00
GGWA fff225d319 The Windows pipe gap in project_play is noted in its tool help and kept as an ignored test (#212)
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.
2026-11-02 11:28:57 +07:00
BFlat 69c0b8c9be Find coding agents npm installed under a custom prefix (#139)
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.
2026-11-02 02:37:17 +07:00
BFlat 8c3532d94c Test that a stopped stand-in frees its port where the server is, without racing other tests (#136)
The engine test no longer connects to the stopped stand-in's port, which another parallel test could be handed; platform::standin_server tests that dropping a server frees its port, trying it for a moment.
2026-11-02 02:09:00 +07:00
BFlat 01994f0622 A program run in a console on Windows doesn't lose what it wrote on a busy computer (#126)
console_text waits for the program's output to arrive and settle before closing the console, waits up to 15 s for it, and says so instead of returning an empty screen.
2026-11-02 01:11:03 +07:00