Repository navigation
Run any agent CLI in Solenta as a best-effort custom provider - #1676
Conversation
Solenta-Message-Id: fe87c414-4351-4340-ad10-06f44860abcf
Settings > Agents > Add instance gains a "Custom CLI (best effort)" base: name, argv, env, optional full-access flags, working folder, and plain pipes or a PTY for output. Each row is a providerInstances entry under the "generic" base (ref generic:<id>), so it reuses instance refs, env sealing and the picker; runs go through the raw-stdout generic runner with the prompt appended last and the transcript tail replayed on each follow-up turn. Built-in provider names stay reserved, a bare "generic" ref is never runnable, and an unmapped permission mode snaps down to default so --yolo-style flags only apply after an explicit Full access pick. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…vider-drop-in-any-agent-b-0a863f
…vider-drop-in-any-agent-b-0a863f # Conflicts: # src/components/settings/AgentsPane.tsx # test/settingsModal.test.tsx
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cacdc3d848
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!fs.existsSync(cwd)) { | ||
| throw new Error(`Custom CLI working folder not found: ${cwd}`); |
There was a problem hiding this comment.
Validate the custom working folder before accepting the turn
When the configured working folder is missing, this check runs only inside startGenericRun, after startRun has already appended the user message, changed the thread to working, and cleared replayContext. The catch then marks the thread failed, so fixing the folder and retrying leaves a duplicate failed prompt in the transcript and, on follow-up turns, starts the stateless CLI without the prior transcript. Move this validation into the pre-mutation custom-CLI gate or restore the consumed replay state on this failure.
Useful? React with 👍 / 👎.
| const bin = (inst.command || [])[0]; | ||
| if (!isBinAvailable(bin)) { | ||
| throw new Error(`Custom CLI binary not found: ${bin}. Fix the command in Settings › Agents.`); |
There was a problem hiding this comment.
Resolve the binary using its actual spawn environment
For a command supplied as ./agent in the configured working folder, or a bare command found through a PATH supplied in the instance/project Environment, this preflight reports “binary not found” even though the later spawn would resolve it: isBinAvailable uses the Electron process's cwd and process.env, while the child uses the custom cwd and merged environment. Check availability against the resolved working directory and the same merged environment used by runAgent.
Useful? React with 👍 / 👎.
| }); | ||
| } | ||
| } | ||
| list.push(...generic); |
There was a problem hiding this comment.
Teach worker-pool availability checks about custom refs
Appending generic:<id> rows makes custom CLIs selectable in the existing worker-pool editor, but the local pool checks pass that full ref to getProvider, which only recognizes the bare generic id. Consequently subagentPoolNoteFor omits the configured alias from the pool menu and nextPoolEntry skips it during failover, even when its binary exists. Parse the ref and resolve the instance command in the pool availability callbacks, as routing now does.
Useful? React with 👍 / 👎.
Users can now point Solenta at any agent CLI (Goose, Hermes, Qwen Code, Amp, …) without waiting for a first-class adapter. Settings › Agents › Add instance has a Custom CLI (best effort) option, and the CLI shows up in the model picker, labelled "Best effort: plain text output, no work log, usage or resume". Closes #458.
Changes
generic:<id>: name, command, environment, optional full-access flags, working folder, and output mode. It reuses the instance ref plumbing, so defaults, profiles, routing and quota failover accept it, and its env values are sealed at rest like other provider keys.acceptEdits,autoorplandrops to default instead of picking up--yolo-style flags.genericref is never runnable.Verification
electron/test/custom-cli-provider.test.js(8 tests) spawns a real fake binary. It checks argument order, that env doesn't leak into the app's own process, flags only after Full access, transcript replay on turn two, working folder (relative, missing), a real PTY run with escape codes stripped, the failure messages, and no snap-up to full access. I mutation-checked it: removing the flag append, the replay flag or the PTY branch each fails a test.modelPicker.test.ts), plus the Settings form round-trip including a path with a space (settingsModal.test.tsx).npm run typecheckandnpx vite buildare clean. Composer, modelPicker and settingsModal renderer tests pass.npm run test:electronon the branch merged with currentmain, CI-like env (no inheritedCODER_*, node-only PATH): 4907 pass, 0 fail, 3 skipped.Notes for reviewers
getProvider("generic")used to return null and now returns a registry entry. I audited every call site: print-mode helpers (ask, commit message) have no args for it, an empty binary reads as not installed, steering is refused, and workflow template phases reject it explicitly.claude:worktoday..exe, not a.cmdshim.🤖 Generated with Claude Code