Craft Anything: understand how any software works, and craft your own.
Rust
Say when a saved program path has no file there, instead of blaming PATH (#739)
FuryNocturnTV (Tare Fernandez)c26e6ba525e7
diff --git a/crates/platform/src/process.rs b/crates/platform/src/process.rsindex 8eb6dd70..a23d5aa9 100644--- a/crates/platform/src/process.rs+++ b/crates/platform/src/process.rs@@ -392,6 +392,16 @@ fn spawn_error_for(name: &str, program: &OsStr, e: std::io::Error, remediation:fn spawn_error_kind(name: &str, program: &OsStr, e: std::io::Error, kind: std::io::ErrorKind, remediation: Option<&str>) -> ToolError {match kind {+ // A program given by its path (a saved setting, say) that isn't there: PATH has nothing to+ // do with it, and an update may have moved it (Codex desktop does on every update, #721).+ std::io::ErrorKind::NotFound if std::path::Path::new(program).parent().is_some_and(|p| !p.as_os_str().is_empty()) => {+ ToolError::new(ErrorCode::EngineMissing, format!("{name} should be at {}, but there's no file there.", program.to_string_lossy()))+ .with_remediation(format!(+ "It may have moved, for example after an update. {}",+ remediation.map(str::to_string).unwrap_or_else(|| format!("Install {name}, or set its full path in Settings."))+ ))+ .with_details(serde_json::json!({"program": program.to_string_lossy(), "reason": "path_missing"}))+ }std::io::ErrorKind::NotFound => ToolError::new(ErrorCode::EngineMissing, format!("{name} isn't installed or isn't on your PATH.")).with_remediation(remediation.map(str::to_string).unwrap_or_else(|| format!("Install {name}, or set its full path in Settings."))).with_details(serde_json::json!({"program": program.to_string_lossy(), "reason": "not_found"})),@@ -1288,6 +1298,26 @@ mod error_tests {};assert_eq!(nonzero_error("OpenCode", &out).message, "OpenCode stopped with exit code 1: error: No provider is set up");}++ /// #721: a saved path to a program that an update moved said "isn't installed or isn't on your+ /// PATH", which pointed away from the setting that was out of date. It names the path; a bare+ /// name still talks about PATH.+ #[test]+ fn a_program_path_with_no_file_says_the_path_is_empty() {+ let dir = tempfile::tempdir().unwrap();+ let gone = dir.path().join("bin").join("0.165.0").join(if cfg!(windows) { "codex.exe" } else { "codex" });+ let err = Process::new(gone.as_os_str()).remediation("Install Codex, or choose its program in Settings → AI.").run().unwrap_err();+ assert_eq!(err.code, ErrorCode::EngineMissing, "still a missing program, so a builder turn isn't retried");+ assert!(err.message.contains(&*gone.to_string_lossy()) && err.message.contains("no file there"), "{}", err.message);+ assert!(!err.message.contains("PATH"), "{}", err.message);+ let remediation = err.remediation.unwrap_or_default();+ assert!(remediation.contains("moved") && remediation.contains("Settings → AI"), "{remediation}");+ assert_eq!(err.details.as_ref().and_then(|d| d["reason"].as_str()), Some("path_missing"));++ let err = Process::new("craft-anything-no-such-program").run().unwrap_err();+ assert!(err.message.contains("isn't on your PATH"), "{}", err.message);+ assert_eq!(err.details.as_ref().and_then(|d| d["reason"].as_str()), Some("not_found"));+ }}#[cfg(all(test, unix))]diff --git a/docs/ROADMAP.md b/docs/ROADMAP.mdindex 804f5ddb..a791db75 100644--- a/docs/ROADMAP.md+++ b/docs/ROADMAP.md@@ -399,6 +399,12 @@ Owner: maintainers · Status: in progress### R2.2 More coding agentsOwner: open · Status: in progress+- [x] A saved agent program path that no longer exists (Codex desktop moves its CLI to a new+ build folder on every update) says so and names the path, instead of "isn't installed or+ isn't on your PATH" (#721); it stays a missing program, so a builder turn isn't retried+- [ ] When a saved Codex desktop path is gone, offer the CLI found in its newest build folder+ (asking first, never replacing a custom program silently), and let Detect/Test check the+ configured program itself (#721)- [x] GitHub Copilot through its own CLI login and ACP, without credential import:discovery, MCP-only tool restrictions, model selection and fresh read-only questions;unit tests and CLI 1.0.105 with an isolated home and loopback model, all five access modesdiff --git a/docs/STATUS.md b/docs/STATUS.mdindex 677aa90a..739728d3 100644--- a/docs/STATUS.md+++ b/docs/STATUS.md@@ -13,6 +13,7 @@ workspace clippy, layers, fmt and the secret scan of all history were clean. Chi| SQLite payload limits | Capped records retain column positions, disclose partial TEXT and BLOB values, omit incomplete BLOB hashes, and report partial coverage with read notes | Hand-built overflow-page regressions for five oversized records (including WITHOUT ROWID in declaration order) and two controls; table and index engine coverage and limitation regressions || SQLite added columns | Short records include missing trailing fields using literal column defaults, or NULL when absent; unsupported default expressions produce NULL with a row note. Stored fields and records longer than the schema retain their values. Defaults are filled before restoring rowid aliases | Nine hand-built parser regressions and an engine tool test cover added-column defaults, rewritten records and short records with a rowid alias, including a missing alias field || OpenCode models and thinking | OpenCode V2 locally and over SSH; Settings → AI lists only that instance's enabled chat models and supported Low/Medium/High/Xhigh/Max variants. Selection is validated and saved through UI, CLI and `ai_models_list` / `ai_model_set`. Explicit-selection execution is refused until native MCP integration exists; local ACP runs require clearing the selection. See [OpenCode](opencode.md). | Stand-in catalogue/process, persistence, remote-command and UI tests; local live catalogue checks (34 models, all five depths represented). Regression checks reject native chat/builds before process I/O with ACP on/off, local/SSH and model-only/depth-only/combined selections. No live SSH host or paid generation used |+| Missing program paths | A program started by its path (a saved agent program, for one) that has no file there is reported with that path, as possibly moved by an update, with reason `path_missing`, instead of "isn't installed or isn't on your PATH"; a bare name still speaks of PATH. It stays a missing program (`EngineMissing`), so builder turns aren't retried (#721) | A regression starts a program at a path with no file on Windows 10 and checks the message, remediation and reason, with a bare-name control. Not checked: a real Codex desktop update, or the app's Settings screen with a stale path || Mach-O Objective-C pointers | Chained offsets mapped only into file-empty `__PAGEZERO` reach the image-base fallback; pointer candidates must be backed by file bytes | Synthetic thin and fat Mach-O regression, plain-pointer and authenticated-rebase controls, null and unmapped-pointer checks. Real binaries were not checked for this correction || Apple app graphs | Selecting a macOS bundle recognises its root-relative `Contents/Info.plist` and retains its service/extension type; nested XPC bundles appear in `services` and as `xpc-service` graph nodes, including their executables when hosted in frameworks | Synthetic inventory tests, including parent-directory and flat bundle layouts, selected services/extensions, framework-hosted service executables, and bare-program controls. Ordinary selected directories with `Contents/Info.plist` need an Apple bundle suffix; archives retain layout-based recognition. Framework libraries and dylibs stay excluded from executables. Real app bundles were not checked for this correction || Chinese UI | Simplified (`zh-hans`) and Traditional (`zh-hant`) Chinese in Settings → General → Language; System chooses a supported OS language, otherwise English. Both catalogs cover UI controls and tool titles; translated titles are searchable. Raw tool data, AI text, logs, CLI/MCP and the separate browser viewer keep their original text. See [localisation](localization.md). | Catalog integrity and locale-resolution tests; `cargo xtask i18n-coverage`; isolated UI language-switch test. Platform visual checks are recorded separately. |