Warn in the provider editor when a custom command isn't runner-allowlisted - #4245
Merged
Conversation
…sted (#4143) GET /api/providers now publishes the CoS Agent Runner's exec allowlist as read-only `runnerAllowedCommands`, so the AI Providers editor can tell the user a custom CLI/TUI command will never spawn via /spawn or /spawn-tui. It stays informational, never a save-time rejection: direct (non-runner) spawn does not consult the allowlist at all, so an off-list command is a legitimate config and blocking the save would break it. The allowlist itself is NOT mirrored client-side — it is the runner's exec boundary and must stay hand-curated in cos-runner/allowedCommands.js rather than derived from the user-writable data/providers.json. The client mirrors only the basename/.exe normalization, pinned by a new parity test. An allowlist the client couldn't fetch reads as "can't tell" (null), never as "nothing is allowed", so an older server renders no warning at all.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A custom provider whose
commandisn't on the CoS Agent Runner's allowlist saves fine today and only fails later, at spawn time. This surfaces that up front, in the AI Providers editor, without rejecting the save.GET /api/providersnow also returnsrunnerAllowedCommands— the runner's exec allowlist, read-only.NO AGENT RUNNERbadge (with a tooltip) for a CLI/TUI provider whose command is off the list.Informational, never a rejection. Direct (non-runner) spawn doesn't consult this allowlist at all, so an off-list command is a legitimate config — blocking the save would break it. Save stays enabled and the copy says so.
The allowlist is not mirrored client-side. It's the runner's exec boundary and stays hand-curated in
server/cos-runner/allowedCommands.js, never derived from the user-writabledata/providers.json— so the client receives it from the server instead of carrying a second hand-maintained copy that could drift. What the client does mirror is the normalizationisAllowedCommandapplies before its membership test (strip directory prefix, strip trailing.exe), and a new parity test pins that against the server implementation over a table of path shapes.Sentinel, not falsy.
isRunnerAllowedCommandreturnsnullfor "list not fetched / field blank" and onlyfalsefor "fetched, and definitely off the list" — so an older server that omits the field, or a failed fetch, renders no warning rather than accusing every command.Published as a list rather than a per-provider
runnerAllowedflag because the editor has to warn about the command being typed, which has no persisted provider to decorate.Files
server/routes/providers.js— publishRUNNER_ALLOWED_COMMANDSonGET /client/src/utils/providers.js—isRunnerAllowedCommand(command, allowedCommands)+ the normalization mirrorclient/src/pages/AIProviders.jsx— badge on the card,Bannerin the editorserver/cos-runner/allowedCommands.parity.test.js— new parity pindocs/API.md,client/src/utils/README.md— catalog rowsTest plan
cd server && NODE_ENV=test npx vitest run cos-runner routes/providers— 9 files / 138 tests pass (includes the new parity suite: shared normalization table, every shipped allowlist entry, thenullsentinel cases, and the documented POSIX-backslash divergence).cd client && npx vitest run src/utils src/pages/AIProviders.test.jsx— 51 files / 994 tests pass, including 4 new cases: badge appears for an off-list command, stays absent for an on-list one (/usr/local/bin/claude), stays absent when the server omitsrunnerAllowedCommands, and the editor banner appears on typing without disabling Save.cd client && npx biome lint --error-on-warningson the changed files — clean.Closes #4143