Skip to content

Craft Anything: understand how any software works, and craft your own.

Rust

Keep the model discovery test from depending on OpenCode being installed (#980)

Justin Johna0cd99325d2d
diff --git a/crates/ai/src/cli_agents/models.rs b/crates/ai/src/cli_agents/models.rs
index 5706cd9d..68243bee 100644
--- a/crates/ai/src/cli_agents/models.rs
+++ b/crates/ai/src/cli_agents/models.rs
@@ -277,9 +277,16 @@ mod tests {
args.last().unwrap(),
"'/opt/agent'\\''s tools/opencode' api model.list --server http://localhost:4096 --param \"location[directory]=$PWD\""
);
+ // Locally a chosen path must exist: a missing one falls back to an installed `opencode`.
cfg.ssh_host = None;
+ let folder = tempfile::tempdir().unwrap();
+ let chosen = folder.path().join("agent's tools").join("opencode");
+ std::fs::create_dir_all(chosen.parent().unwrap()).unwrap();
+ std::fs::write(&chosen, b"").unwrap();
+ let chosen = chosen.display().to_string();
+ let options = BackendOptions { command: Some(chosen.clone()), ..options };
let (program, args) = query_command(&cfg, &options, Some(Path::new("/work/test"))).unwrap();
- assert_eq!(program, "/opt/agent's tools/opencode");
+ assert_eq!(program, chosen);
assert_eq!(args, ["api", "model.list", "--server", "http://localhost:4096", "--param", "location[directory]=/work/test"]);
}
diff --git a/docs/ROADMAP.md b/docs/ROADMAP.md
index 2b9048cc..56d93973 100644
--- a/docs/ROADMAP.md
+++ b/docs/ROADMAP.md
@@ -190,6 +190,9 @@ only when it's green and a maintainer has fully reviewed it, code as well as wor
- [ ] Measure #579 on Windows 11 (0.3.0 portable): the app's CPU while idle, while a build runs and
during a website capture, before and after; and why a website capture is slow and sits for a
long time (no details were given, so nothing was changed for it)
+- [x] `remote_discovery_uses_the_remote_program_and_connection_context` fails on a computer with
+ OpenCode installed: its made-up path is missing, so `program_of` falls back to `opencode`
+ — claimed: justinjohn0306, branch test/remote-discovery-without-opencode
### R5.3 A builder that can't make progress stops
Owner: open · Status: todo