Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

feat: let pr-reviewer stage 3 run on any enabled CLI/TUI provider, with a Claude sandbox recipe

[._.]/ Adam Eivy424920fce3e0
diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
index 073177cce5..1a9fe221aa 100644
--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx
@@ -3,6 +3,7 @@ import { Link } from 'react-router';
import {
effortAwareModelOptions,
effortSurvivingModel,
+ enforcesPublicReviewPosture,
localBackendForProvider,
publicReviewSelectionPolicy,
selectableProviders,
@@ -28,6 +29,20 @@ import {
const eligibleProvidersFor = (providers, policy) =>
selectableProviders(providers, { allowed: policy.provider });
+const providerNames = (providers) => providers.map((p) => p.name || p.id).join(', ');
+
+// Every enabled CLI/TUI provider can run the actions stage; the note says which
+// of them the server additionally wraps in the vendor's own OS sandbox, so a
+// choice that relies on the disposable worktree alone is a visible one.
+const actionsStageNote = (eligibleProviders) => {
+ const sandboxed = eligibleProviders.filter((p) => enforcesPublicReviewPosture(p, PUBLIC_REVIEW_ACTIONS_POSTURE));
+ const worktreeOnly = eligibleProviders.filter((p) => !sandboxed.includes(p));
+ const isolation = worktreeOnly.length === 0
+ ? 'Each runs headless inside its vendor\'s maintained OS sandbox.'
+ : `${sandboxed.length > 0 ? `OS-sandboxed by the vendor's own recipe: ${providerNames(sandboxed)}. ` : ''}Headless with standard permissions, isolated by the disposable worktree only: ${providerNames(worktreeOnly)}.`;
+ return `Sandboxed stage. Eligible on this install: ${providerNames(eligibleProviders)}. ${isolation} PortOS passes the selected provider, model, and thinking effort through, with no forge credential or configuration overlays; the deterministic coordinator owns comments, issue filing, CI triggers, and merges.`;
+};
+
export default function PipelineStageConfig({ taskType, config, providers, onUpdate, updating, setUpdating }) {
const stages = pipelineStages(config);
const needsSecurityModelPolicy = taskType === 'pr-reviewer';
@@ -214,7 +229,7 @@ export default function PipelineStageConfig({ taskType, config, providers, onUpd
)}
{isActionsStage && eligibleProviders?.length > 0 && (
<p className="text-xs text-gray-500 mt-2">
- {`Sandboxed stage. Eligible on this install: ${eligibleProviders.map((p) => p.name || p.id).join(', ')}. PortOS passes the selected provider, model, and thinking effort through that provider's maintained sandbox recipe, with no forge credential or configuration overlays; the deterministic coordinator owns comments, issue filing, CI triggers, and merges.`}
+ {actionsStageNote(eligibleProviders)}
</p>
)}
</div>
diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx
index c95c5e25cf..0b0c8d9dcc 100644
--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx
+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx
@@ -105,7 +105,7 @@ describe('PipelineStageConfig — pr-reviewer', () => {
const modelSelects = screen.getAllByLabelText('Model');
expect([...modelSelects[0].options].map((option) => option.value)).toEqual(['', 'safe-model']);
expect([...modelSelects[1].options].map((option) => option.value)).toEqual(['', 'gpt-5.6']);
- expect(screen.getByText(/maintained sandbox/i)).toBeInTheDocument();
+ expect(screen.getByText(/maintained OS sandbox/i)).toBeInTheDocument();
});
it('removes the optional actions stage without changing the mandatory gate', async () => {
@@ -200,4 +200,21 @@ describe('PipelineStageConfig — posture-driven eligibility', () => {
]);
expect(screen.getByText(/No enabled AI provider on this install can enforce the sandboxed-actions posture/)).toBeInTheDocument();
});
+
+ // Stage 3 offers every enabled binary provider the server publishes as
+ // runnable, and the note separates the vendor-sandboxed ones from those the
+ // disposable worktree alone isolates.
+ it('offers a worktree-only provider for the actions stage and says which providers are OS-sandboxed', () => {
+ renderWith([
+ { id: 'codex-tui', name: 'Codex TUI', type: 'tui', command: 'codex', models: ['gpt-5.6'], publicReviewPostures: ['no-tool', 'sandboxed-actions'], publicReviewEnforcedPostures: ['no-tool', 'sandboxed-actions'] },
+ { id: 'opencode-tui', name: 'OpenCode TUI', type: 'tui', command: 'opencode', models: ['x'], publicReviewPostures: ['sandboxed-actions'], publicReviewEnforcedPostures: [] },
+ ]);
+ const providerSelects = screen.getAllByLabelText('Provider');
+ expect([...providerSelects[0].options].map((o) => o.value)).toEqual(['', 'codex-tui']);
+ expect([...providerSelects[1].options].map((o) => o.value)).toEqual(['', 'codex-tui', 'opencode-tui']);
+ const note = screen.getByText(/Sandboxed stage\. Eligible on this install:/);
+ expect(note.textContent).toContain('Eligible on this install: Codex TUI, OpenCode TUI.');
+ expect(note.textContent).toContain("OS-sandboxed by the vendor's own recipe: Codex TUI.");
+ expect(note.textContent).toContain('isolated by the disposable worktree only: OpenCode TUI.');
+ });
});
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index 97adaec8fb..21a067fe00 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -42,7 +42,7 @@ grep -i "what you want to do" client/src/utils/README.md
| `urlNormalize` | `isUrl` detection, `normalizeUrl` (optional git/`requireDot` modes), `isHttpUrl` / `isHttpsUrl` (safe-href checks), and `tiktokVideoId` / `tiktokEmbedSrc` (host-anchored TikTok video-id extraction + its Embed Player URL, so a reference embeds without loading TikTok's embed.js). |
| `platform` | `isMac` detection and `modKey` (⌘/Ctrl) for keyboard-shortcut display. |
| `navWorkingSet` | Recent/pinned nav persistence (`recordVisit`, `togglePin`, `isPinned`) plus `resolveRecentNavEntries` for mapping stored deep links back to their longest matching nav-manifest entry. Also `migrateLegacyNavPath(path, commands)` — maps a stored path onto the CURRENT path of the page that used to answer to it, driven by each command's own `previousPaths` (declared in `server/lib/navManifest.js` beside the page that moved, shipped whole in the palette manifest). A pin is a stored route path, so without it a moved page's pin stops matching the manifest and the sidebar row silently vanishes on update. |
-| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isCodexSubscriptionProvider` (subscription readiness is keyed on the `codex` command, never an editable id), `isAntigravityProvider`, `isLaunchableTuiProvider` — a TUI provider carrying the server-resolved `tuiCommandLine`, i.e. one a human can start at a shell prompt; shared by the Providers card's "Launch in Shell" button and the Shell page's launch menu so the two can't disagree — `PROVIDER_GATEWAYS` / `gatewayForProvider` / `isGatewayBackedProvider` (an OpenCode wrapper front-ending a hosted OpenAI-compatible gateway — `orcarouter`, `openrouter` — which inherits its API key at spawn time from the sibling API provider whose id equals the gateway id; reads the generic `gatewayBacked` marker and, forever, the legacy per-gateway boolean. MIRROR of `server/lib/providerGateways.js`, which the browser cannot import; keep the three copies in lockstep), `filterSelectableModels`, `resolveCliEffort` (mirror — what a stored effort actually runs as, so the picker can name a clamped level), `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, `resolveEffectiveProvider` — the provider a record actually runs on (its pin, else the active provider) plus whether it fell back, so a "Default" option can name what it resolves to — `resolveSeriesRunLlm` (mirror of server `seriesLlmOverride.js`: which provider/model a Pipeline **series** run resolves to — per-run override → `series.llm` → active provider) and `providerModelLabel` (the one "Provider / model" phrasing), configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). `TOOL_FREE_LOCAL_PROVIDER_IDS`, `TOOL_FREE_LOCAL_TEXT_CAPABILITIES`, `isToolFreeLocalProvider`, `isToolFreeLocalModel`, and `toolFreeLocalSelectionPolicy` share the fail-closed local/text/no-tools filter used by security-sensitive provider/model/effort pickers. `PUBLIC_REVIEW_NO_TOOL_POSTURE` / `PUBLIC_REVIEW_ACTIONS_POSTURE`, `supportsPublicReviewPosture`, and `publicReviewSelectionPolicy` are the pr-reviewer counterpart (mirror of server `agentExecutionProfiles.js`): a pipeline stage names a POSTURE, the server publishes each provider's `publicReviewPostures` on `GET /api/providers`, and the picker offers exactly the providers this install can enforce — no vendor is named on either side. Also `isRunnerAllowedCommand(command, allowedCommands)` — would the CoS Agent Runner (`/spawn`, `/spawn-tui`) accept this command? Mirrors only the *normalization* in `server/cos-runner/allowedCommands.js` (the list itself arrives as `runnerAllowedCommands` on `GET /api/providers`, because the allowlist is an exec boundary and stays hand-curated server-side); returns `null` for "list not fetched / field blank" so a failed fetch never renders a warning. Pinned by `server/cos-runner/allowedCommands.parity.test.js`. `isPrivateNetworkEndpoint(endpoint)` — loopback, RFC1918/tailnet address, or a `.local`/`.ts.net`/single-label host, i.e. somewhere an unauthenticated OpenAI-compatible server is a normal setup rather than a missing API key. `isLocalInstanceProvider(provider)` — the narrower question, mirroring server `localProviderRuntime.js#isLocalInstanceEndpoint`: does this provider talk to a daemon on THIS machine (loopback, or no endpoint at all)? Gate anything that explains a provider by inspecting the host PortOS runs on — install state, "start it from Settings → Local LLM" — since `localBackendForProvider` matches by NAME and would otherwise claim a peer's LM Studio. And `credentialSource(provider)` plus `providerCardState(provider, { runtime, status, keySetFor, envVarSet })` + `PROVIDER_CARD_STATE` — is a provider ready to run, benched, blocked on a missing prerequisite (CLI not installed / API key absent / empty credential environment variable), or simply switched off? Reads the SERVER's `missingPrerequisites` (published per provider on `GET /api/providers` from `server/lib/providerPrerequisites.js`, and the same computation `getFallbackProvider` routes on) and adds the local-app runtime shape plus tri-state checks for stored, inherited, and process environment credentials. Unknown lookup values mean "not probed", never "missing". Drives the AI Providers page card colors and grouping — distinct from `ProviderReadiness`/`GET /api/providers/readiness`, which probes the local daemon behind a provider. `resolvesOutsidePortosPath(provider)` — does this provider resolve its binary somewhere the runtime probe never looked (an explicit path in `command`, or its own `PATH` in `envVars`)? Mirror of the same two guards in the server's `providerRuntimeKey`, and what keeps the card's badge from accusing a working provider the router happily routes. And `providerRuntimeKey(provider)` — the key a provider's runtime is published under by `GET /api/providers/runtimes`, so a card can show its CLI install status (bare binary name for a cli/tui provider, provider id for an API provider fronted by a local app); the runtime table itself stays server-side. |
+| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isCodexSubscriptionProvider` (subscription readiness is keyed on the `codex` command, never an editable id), `isAntigravityProvider`, `isLaunchableTuiProvider` — a TUI provider carrying the server-resolved `tuiCommandLine`, i.e. one a human can start at a shell prompt; shared by the Providers card's "Launch in Shell" button and the Shell page's launch menu so the two can't disagree — `PROVIDER_GATEWAYS` / `gatewayForProvider` / `isGatewayBackedProvider` (an OpenCode wrapper front-ending a hosted OpenAI-compatible gateway — `orcarouter`, `openrouter` — which inherits its API key at spawn time from the sibling API provider whose id equals the gateway id; reads the generic `gatewayBacked` marker and, forever, the legacy per-gateway boolean. MIRROR of `server/lib/providerGateways.js`, which the browser cannot import; keep the three copies in lockstep), `filterSelectableModels`, `resolveCliEffort` (mirror — what a stored effort actually runs as, so the picker can name a clamped level), `configuredDefaultIn` — the sentinel a provider's catalog carries, so a picker can render an option matching a sentinel-valued tier instead of a blank select — `getProviderTimeout`, `resolveEffectiveProvider` — the provider a record actually runs on (its pin, else the active provider) plus whether it fell back, so a "Default" option can name what it resolves to — `resolveSeriesRunLlm` (mirror of server `seriesLlmOverride.js`: which provider/model a Pipeline **series** run resolves to — per-run override → `series.llm` → active provider) and `providerModelLabel` (the one "Provider / model" phrasing), configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). `TOOL_FREE_LOCAL_PROVIDER_IDS`, `TOOL_FREE_LOCAL_TEXT_CAPABILITIES`, `isToolFreeLocalProvider`, `isToolFreeLocalModel`, and `toolFreeLocalSelectionPolicy` share the fail-closed local/text/no-tools filter used by security-sensitive provider/model/effort pickers. `PUBLIC_REVIEW_NO_TOOL_POSTURE` / `PUBLIC_REVIEW_ACTIONS_POSTURE`, `supportsPublicReviewPosture`, `enforcesPublicReviewPosture`, and `publicReviewSelectionPolicy` are the pr-reviewer counterpart (mirror of server `agentExecutionProfiles.js`): a pipeline stage names a POSTURE, the server publishes each provider's `publicReviewPostures` (runnable) and `publicReviewEnforcedPostures` (backed by a vendor sandbox recipe) on `GET /api/providers`, and the picker offers exactly the providers this install can run the stage on — no vendor is named on either side. Also `isRunnerAllowedCommand(command, allowedCommands)` — would the CoS Agent Runner (`/spawn`, `/spawn-tui`) accept this command? Mirrors only the *normalization* in `server/cos-runner/allowedCommands.js` (the list itself arrives as `runnerAllowedCommands` on `GET /api/providers`, because the allowlist is an exec boundary and stays hand-curated server-side); returns `null` for "list not fetched / field blank" so a failed fetch never renders a warning. Pinned by `server/cos-runner/allowedCommands.parity.test.js`. `isPrivateNetworkEndpoint(endpoint)` — loopback, RFC1918/tailnet address, or a `.local`/`.ts.net`/single-label host, i.e. somewhere an unauthenticated OpenAI-compatible server is a normal setup rather than a missing API key. `isLocalInstanceProvider(provider)` — the narrower question, mirroring server `localProviderRuntime.js#isLocalInstanceEndpoint`: does this provider talk to a daemon on THIS machine (loopback, or no endpoint at all)? Gate anything that explains a provider by inspecting the host PortOS runs on — install state, "start it from Settings → Local LLM" — since `localBackendForProvider` matches by NAME and would otherwise claim a peer's LM Studio. And `credentialSource(provider)` plus `providerCardState(provider, { runtime, status, keySetFor, envVarSet })` + `PROVIDER_CARD_STATE` — is a provider ready to run, benched, blocked on a missing prerequisite (CLI not installed / API key absent / empty credential environment variable), or simply switched off? Reads the SERVER's `missingPrerequisites` (published per provider on `GET /api/providers` from `server/lib/providerPrerequisites.js`, and the same computation `getFallbackProvider` routes on) and adds the local-app runtime shape plus tri-state checks for stored, inherited, and process environment credentials. Unknown lookup values mean "not probed", never "missing". Drives the AI Providers page card colors and grouping — distinct from `ProviderReadiness`/`GET /api/providers/readiness`, which probes the local daemon behind a provider. `resolvesOutsidePortosPath(provider)` — does this provider resolve its binary somewhere the runtime probe never looked (an explicit path in `command`, or its own `PATH` in `envVars`)? Mirror of the same two guards in the server's `providerRuntimeKey`, and what keeps the card's badge from accusing a working provider the router happily routes. And `providerRuntimeKey(provider)` — the key a provider's runtime is published under by `GET /api/providers/runtimes`, so a card can show its CLI install status (bare binary name for a cli/tui provider, provider id for an API provider fronted by a local app); the runtime table itself stays server-side. |
| `systemCapabilities` | Server-annotated hardware compatibility helpers: preserve model/provider choices when compatibility is unknown, and hide only entries whose `hardwareCompatibility.state` is definitively `unavailable`. |
| `layeredIntelligenceReasons` | Canonical gloss for the Layered Intelligence loop's run-outcome reason tokens, shared by the on-demand toast and the durable "Last run" line (`formatLiReason`, `liReasonTone`, `LI_NEUTRAL_REASONS`). |
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index 3e3e97e042..ec966195cc 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -289,6 +289,18 @@ export const supportsPublicReviewPosture = (provider, posture) => {
: provider?.publicReviewSupported === true;
};
+/**
+ * Whether the SERVER runs `posture` on this provider through a vendor-enforced
+ * recipe (an OS sandbox for the actions stage), as opposed to merely allowing
+ * it. `publicReviewEnforcedPostures` is the server's subset; an older server
+ * that does not publish it only ever offered enforced providers, so its
+ * eligible set is taken as enforced.
+ */
+export const enforcesPublicReviewPosture = (provider, posture) => {
+ if (Array.isArray(provider?.publicReviewEnforcedPostures)) return provider.publicReviewEnforcedPostures.includes(posture);
+ return supportsPublicReviewPosture(provider, posture);
+};
+
/**
* Selection policy for a pr-reviewer stage.
*
diff --git a/server/lib/providerVendors.js b/server/lib/providerVendors.js
index 02ab4b4a92..14a4530578 100644
--- a/server/lib/providerVendors.js
+++ b/server/lib/providerVendors.js
@@ -471,7 +471,19 @@ function claudeSpawnArgs(provider, { effectiveModel, effort, systemPromptFile, s
return { command, args, stdinMode: 'prompt', streamFormat: 'stream-json' };
}
-const CLAUDE_PUBLIC_REVIEW_ARGS = [
+// Shared by both Claude postures: no MCP servers, no browser bridge, no
+// persisted session, no slash commands. `--bare` is NOT here: it also disables
+// OAuth/keychain auth, so it would break a subscription-authenticated cloud
+// Claude — `applyLeanClaudeArgs` adds it for the local Ollama wrapper only.
+const CLAUDE_PUBLIC_REVIEW_COMMON_ARGS = [
+ '--strict-mcp-config',
+ '--mcp-config', '{"mcpServers":{}}',
+ '--no-chrome',
+ '--no-session-persistence',
+ '--disable-slash-commands',
+];
+
+const CLAUDE_PUBLIC_REVIEW_NO_TOOL_ARGS = [
'--permission-mode', 'plan',
// The code-review model gets the cleared PR material in its prompt. Keep
// both controls: `--restricted` removes the command/network-capable built-in
@@ -479,24 +491,42 @@ const CLAUDE_PUBLIC_REVIEW_ARGS = [
// any tool schema to a local model that does not support tool calls.
'--restricted',
'--tools', '',
- '--strict-mcp-config',
- '--mcp-config', '{"mcpServers":{}}',
- '--no-chrome',
- '--no-session-persistence',
- '--disable-slash-commands',
- '--bare',
+ ...CLAUDE_PUBLIC_REVIEW_COMMON_ARGS,
];
+// Claude Code's OS-level sandbox (seatbelt on macOS, bubblewrap on Linux) is a
+// settings switch rather than a flag; `--settings` accepts inline JSON. Inside
+// it, Bash runs without prompting but filesystem writes stay inside the working
+// tree and the empty domain allowlist denies every network request — in
+// `--print` mode a denied request is simply not executed, there is nobody to
+// approve it. The web tools are denied outright for the same reason.
+const CLAUDE_SANDBOX_SETTINGS = JSON.stringify({
+ sandbox: { enabled: true, autoAllowBashIfSandboxed: true, network: { allowedDomains: [] } },
+});
+const CLAUDE_PUBLIC_REVIEW_ACTIONS_ARGS = [
+ '--permission-mode', 'acceptEdits',
+ '--settings', CLAUDE_SANDBOX_SETTINGS,
+ '--disallowedTools', 'WebFetch,WebSearch',
+ ...CLAUDE_PUBLIC_REVIEW_COMMON_ARGS,
+];
+
+function claudePublicReviewSpawnArgs(provider, ctx) {
+ return claudePublicReviewArgs(provider, ctx, CLAUDE_PUBLIC_REVIEW_NO_TOOL_ARGS);
+}
+
+function claudePublicReviewActionsSpawnArgs(provider, ctx) {
+ return claudePublicReviewArgs(provider, ctx, CLAUDE_PUBLIC_REVIEW_ACTIONS_ARGS);
+}
+
function claudePublicReviewArgs(provider, {
effectiveModel,
effort,
systemPromptFile,
- settingsEnv,
tui = false,
-} = {}) {
+} = {}, postureArgs) {
const providerId = provider?.id || 'claude-code';
const args = [
- ...CLAUDE_PUBLIC_REVIEW_ARGS,
+ ...postureArgs,
...(tui ? [] : ['--print', '--output-format', 'stream-json', '--verbose', '--include-partial-messages']),
];
if (systemPromptFile) args.push('--append-system-prompt-file', systemPromptFile);
@@ -530,11 +560,13 @@ const CLAUDE = {
publicReview: {
// Claude is the historical always-true fallback row, so its posture
// matcher must positively identify the binary — an unknown command must
- // never inherit claude's flag set. There is deliberately no
- // sandboxed-actions recipe: Claude Code has no OS-level sandbox flag, only
- // permission modes, so it fails closed for the actions stage.
+ // never inherit claude's flag set.
[PUBLIC_REVIEW_NO_TOOL_POSTURE]: {
- spawnArgs: claudePublicReviewArgs,
+ spawnArgs: claudePublicReviewSpawnArgs,
+ matchProvider: (provider) => isDirectBinaryProvider(provider) && isClaudeCommand(provider?.command),
+ },
+ [PUBLIC_REVIEW_ACTIONS_POSTURE]: {
+ spawnArgs: claudePublicReviewActionsSpawnArgs,
matchProvider: (provider) => isDirectBinaryProvider(provider) && isClaudeCommand(provider?.command),
},
},
@@ -646,10 +678,16 @@ export function buildVendorSpawnConfig(provider, ctx) {
const posture = publicReviewPostureForProfile(ctx?.safetyProfile);
if (posture) {
const recipe = publicReviewRecipe(provider, posture);
- if (!recipe) {
+ if (recipe) return recipe.spawnArgs(provider, ctx);
+ // The no-tool gate has no fallback: nothing but an enforced argv can hold
+ // a model tool-free. The actions stage is different — its isolation is the
+ // disposable worktree plus the stripped child environment (no forge
+ // credential, no Claude settings overlay), and the deterministic coordinator
+ // owns every GitHub mutation — so any enabled binary provider may run it
+ // headless through its ordinary recipe when the vendor has no sandbox one.
+ if (!supportsPublicReviewPosture(provider, posture)) {
throw new Error(`Provider '${providerLabel(provider)}' has no enforced ${posture} public-review posture`);
}
- return recipe.spawnArgs(provider, ctx);
}
const vendor = PROVIDER_VENDORS.find((v) => v.spawnArgs && matchesProvider(v, provider));
return vendor.spawnArgs(provider, ctx);
@@ -667,6 +705,17 @@ export function buildVendorSpawnConfig(provider, ctx) {
* as an interactive session (see `isDirectBinaryProvider`).
*/
export function publicReviewPosturesForProvider(provider) {
+ return PUBLIC_REVIEW_POSTURES.filter((posture) => supportsPublicReviewPosture(provider, posture));
+}
+
+/**
+ * The postures this provider runs through a maintained, vendor-enforced
+ * recipe. A subset of `publicReviewPosturesForProvider`: the actions posture
+ * is also runnable by a binary provider with no sandbox recipe (see
+ * `supportsPublicReviewPosture`), and the schedule UI uses the difference to
+ * say which choices are OS-sandboxed and which rely on the worktree alone.
+ */
+export function enforcedPublicReviewPosturesForProvider(provider) {
if (!isDirectBinaryProvider(provider)) return [];
return PUBLIC_REVIEW_POSTURES.filter((posture) => Boolean(publicReviewRecipe(provider, posture)));
}
@@ -680,9 +729,20 @@ export function publicReviewCapableVendorIds(posture) {
return PROVIDER_VENDORS.filter((vendor) => vendor.publicReview?.[posture]?.spawnArgs).map((vendor) => vendor.id);
}
-/** Whether `provider` has a maintained, enforced recipe for one posture. */
+/**
+ * Whether `provider` may run a stage with this posture.
+ *
+ * The no-tool gate requires a maintained recipe: only an enforced argv can
+ * hold a model tool-free. The sandboxed-actions stage is open to EVERY enabled
+ * binary (CLI/TUI) provider — a vendor recipe (Codex, Antigravity, Grok,
+ * Claude) adds an OS-level sandbox on top, but the stage's baseline isolation
+ * is the disposable worktree, the stripped child environment, and the
+ * deterministic coordinator owning all forge mutations. API providers have no
+ * binary to spawn and fail closed for both.
+ */
export function supportsPublicReviewPosture(provider, posture) {
if (!isDirectBinaryProvider(provider)) return false;
+ if (posture === PUBLIC_REVIEW_ACTIONS_POSTURE) return true;
return Boolean(publicReviewRecipe(provider, posture));
}
diff --git a/server/lib/providerVendors.publicReview.test.js b/server/lib/providerVendors.publicReview.test.js
index 3aeca9ee92..4caf9bbac2 100644
--- a/server/lib/providerVendors.publicReview.test.js
+++ b/server/lib/providerVendors.publicReview.test.js
@@ -8,6 +8,7 @@ import {
} from './agentExecutionProfiles.js';
import {
buildVendorSpawnConfig,
+ enforcedPublicReviewPosturesForProvider,
publicReviewPosturesForProvider,
publicReviewProviderBlock,
supportsPublicReviewProvider,
@@ -36,9 +37,19 @@ describe('public-review provider postures', () => {
expect(publicReviewPosturesForProvider(codex)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
expect(publicReviewPosturesForProvider(antigravity)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
expect(publicReviewPosturesForProvider(grok)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
- // Claude Code has permission modes but no OS-level sandbox flag, so it is
- // deliberately tool-free-only and fails closed for the actions stage.
- expect(publicReviewPosturesForProvider(localClaude)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE]);
+ expect(publicReviewPosturesForProvider(localClaude)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
+ });
+
+ // The actions stage is open to every enabled binary provider; the ENFORCED
+ // list is the subset with a vendor sandbox recipe, which is what the schedule
+ // UI reports beside the picker.
+ it('distinguishes a vendor-sandboxed actions stage from a worktree-only one', () => {
+ const opencode = { id: 'opencode', type: 'cli', command: 'opencode' };
+ expect(publicReviewPosturesForProvider(opencode)).toEqual([PUBLIC_REVIEW_ACTIONS_POSTURE]);
+ expect(enforcedPublicReviewPosturesForProvider(opencode)).toEqual([]);
+ expect(enforcedPublicReviewPosturesForProvider(codex)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
+ expect(enforcedPublicReviewPosturesForProvider(localClaude)).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
+ expect(enforcedPublicReviewPosturesForProvider({ ...codex, type: 'api' })).toEqual([]);
});
// Regression (#5830): the spawn gate passes the posture a STAGE requires,
@@ -60,7 +71,7 @@ describe('public-review provider postures', () => {
// claude has permission modes but no sandbox flag — tool-free only.
expect(publicReviewProviderBlock(localClaude, PUBLIC_REVIEW_NO_TOOL_POSTURE)).toBeNull();
- expect(publicReviewProviderBlock(localClaude, PUBLIC_REVIEW_ACTIONS_POSTURE)).toEqual({
+ expect(publicReviewProviderBlock({ ...localClaude, type: 'api' }, PUBLIC_REVIEW_ACTIONS_POSTURE)).toEqual({
reason: "Provider 'claude-ollama' has no enforced sandboxed-actions public-content review mode",
category: 'public-review-actions-provider-unsupported',
});
@@ -82,7 +93,7 @@ describe('public-review provider postures', () => {
it('derives the same postures for a TUI record of a recipe-bearing vendor', () => {
expect(publicReviewPosturesForProvider({ ...codex, id: 'codex-tui', type: 'tui' })).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
expect(publicReviewPosturesForProvider({ ...grok, id: 'grok-tui', type: 'tui' })).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
- expect(publicReviewPosturesForProvider({ ...localClaude, id: 'claude-ollama-tui', type: 'tui' })).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE]);
+ expect(publicReviewPosturesForProvider({ ...localClaude, id: 'claude-ollama-tui', type: 'tui' })).toEqual([PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE]);
// The headless recipe, not the TUI argv, is what the stage spawns.
const config = buildVendorSpawnConfig({ ...codex, id: 'codex-tui', type: 'tui', args: ['--full-auto'] }, {
effectiveModel: 'gpt-5.6',
@@ -92,16 +103,17 @@ describe('public-review provider postures', () => {
expect(config.args).not.toContain('--full-auto');
});
- it('fails closed for transports and vendors with no maintained recipe', () => {
+ it('fails closed for the no-tool gate on transports and vendors with no maintained recipe', () => {
// An HTTP api provider has no binary to spawn and no enforced argv.
expect(publicReviewPosturesForProvider({ ...codex, type: 'api' })).toEqual([]);
- expect(publicReviewPosturesForProvider({ id: 'opencode-tui', type: 'tui', command: 'opencode' })).toEqual([]);
- // An unknown command must never inherit claude's always-true fallback row.
- expect(publicReviewPosturesForProvider({ id: 'custom', type: 'cli', command: 'custom-agent' })).toEqual([]);
- // opencode/kimi/cursor have no maintained no-tool or sandbox recipe yet.
- expect(publicReviewPosturesForProvider({ id: 'opencode', type: 'cli', command: 'opencode' })).toEqual([]);
+ // opencode/kimi/cursor have no maintained no-tool recipe, so they can run
+ // only the actions stage. An unknown command must never inherit claude's
+ // always-true fallback row for the gate either.
+ expect(publicReviewPosturesForProvider({ id: 'opencode-tui', type: 'tui', command: 'opencode' })).toEqual([PUBLIC_REVIEW_ACTIONS_POSTURE]);
+ expect(publicReviewPosturesForProvider({ id: 'custom', type: 'cli', command: 'custom-agent' })).toEqual([PUBLIC_REVIEW_ACTIONS_POSTURE]);
expect(supportsPublicReviewProvider({ id: 'kimi', type: 'cli', command: 'kimi' })).toBe(false);
- expect(supportsPublicReviewActionsProvider(localClaude)).toBe(false);
+ expect(supportsPublicReviewActionsProvider(localClaude)).toBe(true);
+ expect(supportsPublicReviewActionsProvider({ ...localClaude, type: 'api' })).toBe(false);
});
it('builds the final reviewer with the bounded Codex sandbox and no provider args', () => {
@@ -182,9 +194,52 @@ describe('public-review provider postures', () => {
expect(actions.args).not.toContain('plan');
});
- it('rejects the action profile for a provider with no maintained sandbox', () => {
- expect(() => buildVendorSpawnConfig(localClaude, {
- effectiveModel: 'safe-model',
+ it('builds the Claude actions stage inside its OS sandbox, not under skip-permissions', () => {
+ const config = buildVendorSpawnConfig({ ...localClaude, args: ['--dangerously-skip-permissions'] }, {
+ effectiveModel: 'qwen3.8:27b',
+ effort: 'high',
+ systemPromptFile: '/tmp/example-system.md',
+ safetyProfile: PUBLIC_REVIEW_ACTIONS_EXECUTION_PROFILE,
+ });
+ expect(config.command).toBe('claude');
+ expect(config.streamFormat).toBe('stream-json');
+ expect(config.args).toEqual(expect.arrayContaining([
+ '--permission-mode', 'acceptEdits', '--settings', '--strict-mcp-config', '--print',
+ '--append-system-prompt-file', '/tmp/example-system.md', '--model', 'qwen3.8:27b', '--effort', 'high',
+ ]));
+ const settings = JSON.parse(config.args[config.args.indexOf('--settings') + 1]);
+ expect(settings.sandbox).toMatchObject({ enabled: true, autoAllowBashIfSandboxed: true, network: { allowedDomains: [] } });
+ expect(config.args[config.args.indexOf('--disallowedTools') + 1]).toBe('WebFetch,WebSearch');
+ expect(config.args).not.toContain('--dangerously-skip-permissions');
+ expect(config.args).not.toContain('--restricted');
+ expect(config.args).not.toContain('plan');
+ // The local wrapper still gets the lean flags; `--bare` is never forced on
+ // a cloud Claude because it disables OAuth/keychain auth.
+ expect(config.args).toContain('--bare');
+ const cloud = buildVendorSpawnConfig({ id: 'claude-code', type: 'cli', command: 'claude' }, {
+ safetyProfile: PUBLIC_REVIEW_ACTIONS_EXECUTION_PROFILE,
+ });
+ expect(cloud.args).not.toContain('--bare');
+ const cloudGate = buildVendorSpawnConfig({ id: 'claude-code', type: 'cli', command: 'claude' }, {
+ safetyProfile: PUBLIC_REVIEW_GATE_EXECUTION_PROFILE,
+ });
+ expect(cloudGate.args).not.toContain('--bare');
+ expect(cloudGate.args).toContain('--restricted');
+ });
+
+ it('runs a vendor with no sandbox recipe through its ordinary headless recipe for the actions stage only', () => {
+ const opencode = { id: 'opencode-tui', type: 'tui', command: 'opencode', args: ['--agent', 'build'] };
+ const config = buildVendorSpawnConfig(opencode, {
+ effectiveModel: 'x',
+ safetyProfile: PUBLIC_REVIEW_ACTIONS_EXECUTION_PROFILE,
+ });
+ expect(config.command).toBe('opencode');
+ expect(config.args[0]).toBe('run');
+ expect(() => buildVendorSpawnConfig(opencode, {
+ effectiveModel: 'x',
+ safetyProfile: PUBLIC_REVIEW_GATE_EXECUTION_PROFILE,
+ })).toThrow(/no enforced no-tool public-review posture/);
+ expect(() => buildVendorSpawnConfig({ ...opencode, type: 'api' }, {
safetyProfile: PUBLIC_REVIEW_ACTIONS_EXECUTION_PROFILE,
})).toThrow(/no enforced sandboxed-actions public-review posture/);
});
diff --git a/server/routes/providers.js b/server/routes/providers.js
index b91b97d01c..3f6b83acdc 100644
--- a/server/routes/providers.js
+++ b/server/routes/providers.js
@@ -37,7 +37,12 @@ import {
} from '../services/codexAppServer.js';
import { runLocalRuntimeSetup, SETUP_ACTIONS } from '../services/localRuntimeSetup.js';
import { localEndpointPort, localRuntimeForProvider } from '../lib/localProviderRuntime.js';
-import { publicReviewPosturesForProvider, PUBLIC_REVIEW_NO_TOOL_POSTURE, PUBLIC_REVIEW_ACTIONS_POSTURE } from '../lib/providerVendors.js';
+import {
+ enforcedPublicReviewPosturesForProvider,
+ publicReviewPosturesForProvider,
+ PUBLIC_REVIEW_NO_TOOL_POSTURE,
+ PUBLIC_REVIEW_ACTIONS_POSTURE,
+} from '../lib/providerVendors.js';
import { buildTuiShellLaunch } from '../lib/tuiShellLaunch.js';
import {
captureSystemCapabilities,
@@ -147,12 +152,14 @@ const presentProvider = (provider, capabilities = captureSystemCapabilities()) =
// the maintained public-review recipe, not a client-side guess based on a
// provider name or a user-writable `args` list.
// `publicReviewPostures` is the value the schedule UI filters on, so a stage
- // offers exactly the providers this install can actually enforce. The two
- // booleans are derived from it and kept for existing consumers.
+ // offers exactly the providers this install can actually run it on;
+ // `publicReviewEnforcedPostures` is the subset backed by a vendor sandbox
+ // recipe. The two booleans are derived from it and kept for existing consumers.
const publicReviewPostures = publicReviewPosturesForProvider(provider);
return sanitizeProvider({
...decorated,
publicReviewPostures,
+ publicReviewEnforcedPostures: enforcedPublicReviewPosturesForProvider(provider),
publicReviewSupported: publicReviewPostures.includes(PUBLIC_REVIEW_NO_TOOL_POSTURE),
publicReviewActionsSupported: publicReviewPostures.includes(PUBLIC_REVIEW_ACTIONS_POSTURE),
});
diff --git a/server/services/agentProviderResolution.test.js b/server/services/agentProviderResolution.test.js
index 93de1f7d29..780b1a1067 100644
--- a/server/services/agentProviderResolution.test.js
+++ b/server/services/agentProviderResolution.test.js
@@ -388,12 +388,17 @@ describe('resolveAgentProviderAndModel — public-review stages', () => {
expect(r.error).toMatch(/no-tool/);
});
- it('requires the sandboxed posture for the actions stage, not merely a CLI', async () => {
- const LOCAL_CLAUDE = { id: 'claude-ollama', type: 'cli', command: 'claude', ollamaBacked: true };
- getAllProviders.mockResolvedValue({ providers: [LOCAL_CLAUDE], activeProvider: { id: 'claude-ollama' } });
- // Claude has a no-tool recipe but no sandbox recipe.
+ it('runs the actions stage on any enabled binary provider but never on an api one', async () => {
+ const OPENCODE = { id: 'opencode', type: 'cli', command: 'opencode' };
+ getAllProviders.mockResolvedValue({ providers: [OPENCODE], activeProvider: { id: 'opencode' } });
+ // opencode has no no-tool recipe, so the gate fails closed; the actions
+ // stage still runs headless in the disposable worktree.
await expect(resolveAgentProviderAndModel({ id: 't', metadata: { executionProfile: 'public-review-gate' } }))
- .resolves.toMatchObject({ ok: true, provider: { id: 'claude-ollama' } });
+ .resolves.toMatchObject({ ok: false, permanent: true });
+ await expect(resolveAgentProviderAndModel({ id: 't', metadata: { executionProfile: 'public-review-actions' } }))
+ .resolves.toMatchObject({ ok: true, provider: { id: 'opencode' } });
+
+ getAllProviders.mockResolvedValue({ providers: [{ id: 'ollama', type: 'api' }], activeProvider: { id: 'ollama' } });
await expect(resolveAgentProviderAndModel({ id: 't', metadata: { executionProfile: 'public-review-actions' } }))
.resolves.toMatchObject({ ok: false, permanent: true });
});
diff --git a/server/services/modelAbuseGuard.test.js b/server/services/modelAbuseGuard.test.js
index c2d9c800da..52db1df1a8 100644
--- a/server/services/modelAbuseGuard.test.js
+++ b/server/services/modelAbuseGuard.test.js
@@ -99,7 +99,7 @@ describe('validatePublicReviewModel', () => {
model: 'safe-model',
})).resolves.toMatchObject({ ok: false, code: 'public-review-provider-unsupported' });
await expect(validatePublicReviewModel({
- provider: LOCAL_CLAUDE,
+ provider: { ...LOCAL_CLAUDE, type: 'api' },
model: 'safe-model',
posture: 'sandboxed-actions',
})).resolves.toMatchObject({ ok: false, code: 'public-review-actions-provider-unsupported' });
diff --git a/server/services/publicReviewProviderSelection.js b/server/services/publicReviewProviderSelection.js
index 446454506c..083400f9e6 100644
--- a/server/services/publicReviewProviderSelection.js
+++ b/server/services/publicReviewProviderSelection.js
@@ -25,6 +25,7 @@ import {
publicReviewCapableVendorIds,
publicReviewPostureForProfile,
supportsPublicReviewPosture,
+ PUBLIC_REVIEW_ACTIONS_POSTURE,
} from '../lib/providerVendors.js';
/** The posture a task's execution profile requires, or null for a normal task. */
@@ -73,7 +74,9 @@ export async function resolvePublicReviewProvider({ posture, pinnedProviderId =
return {
ok: false,
code: 'public-review-no-eligible-provider',
- error: `No enabled AI provider on this install has a maintained '${posture}' public-review posture. Add or enable one of these CLI providers in Settings > Providers: ${publicReviewCapableVendorIds(posture).join(', ')}.`,
+ error: posture === PUBLIC_REVIEW_ACTIONS_POSTURE
+ ? `No enabled CLI or TUI provider on this install can run the '${posture}' public-review stage. Enable one in Settings > Providers.`
+ : `No enabled AI provider on this install has a maintained '${posture}' public-review posture. Add or enable one of these CLI providers in Settings > Providers: ${publicReviewCapableVendorIds(posture).join(', ')}.`,
};
}
const pinned = pinnedProviderId ? eligible.find((provider) => provider.id === pinnedProviderId) : null;
diff --git a/server/services/publicReviewProviderSelection.test.js b/server/services/publicReviewProviderSelection.test.js
index 2dd6deefd8..800ebef1cc 100644
--- a/server/services/publicReviewProviderSelection.test.js
+++ b/server/services/publicReviewProviderSelection.test.js
@@ -39,7 +39,10 @@ describe('eligiblePublicReviewProviders', () => {
it('returns this install’s own eligible providers, not a fixed vendor list', async () => {
seed([GROK, OPENCODE, OLLAMA_API]);
expect((await eligiblePublicReviewProviders('no-tool')).map((p) => p.id)).toEqual(['grok-cli']);
- expect((await eligiblePublicReviewProviders('sandboxed-actions')).map((p) => p.id)).toEqual(['grok-cli']);
+ // The actions stage is open to every binary provider — opencode has no
+ // sandbox recipe but runs headless in the disposable worktree; the api
+ // provider has no binary at all.
+ expect((await eligiblePublicReviewProviders('sandboxed-actions')).map((p) => p.id)).toEqual(['grok-cli', 'opencode']);
});
it('excludes providers the user has switched off', async () => {
@@ -68,10 +71,16 @@ describe('resolvePublicReviewProvider', () => {
it('drops an INELIGIBLE pin instead of running the stage on it', async () => {
seed([OPENCODE, CODEX], { id: 'opencode' });
- const resolved = await resolvePublicReviewProvider({ posture: 'sandboxed-actions', pinnedProviderId: 'opencode' });
+ const resolved = await resolvePublicReviewProvider({ posture: 'no-tool', pinnedProviderId: 'opencode' });
expect(resolved).toMatchObject({ ok: true, pinHonored: false, provider: { id: 'codex-cli' } });
});
+ it('honors any enabled binary provider as an actions-stage pin', async () => {
+ seed([OPENCODE, CODEX], { id: 'codex-cli' });
+ const resolved = await resolvePublicReviewProvider({ posture: 'sandboxed-actions', pinnedProviderId: 'opencode' });
+ expect(resolved).toMatchObject({ ok: true, pinHonored: true, provider: { id: 'opencode' } });
+ });
+
it('prefers an available provider over an unavailable earlier one', async () => {
isProviderAvailable.mockImplementation((id) => id === 'grok-cli');
seed([CODEX, GROK]);
@@ -88,9 +97,15 @@ describe('resolvePublicReviewProvider', () => {
it('fails closed with an actionable reason when nothing on this install qualifies', async () => {
seed([OPENCODE, OLLAMA_API]);
- const resolved = await resolvePublicReviewProvider({ posture: 'sandboxed-actions' });
- expect(resolved.ok).toBe(false);
- expect(resolved.code).toBe('public-review-no-eligible-provider');
- expect(resolved.error).toMatch(/sandboxed-actions/);
+ const gate = await resolvePublicReviewProvider({ posture: 'no-tool' });
+ expect(gate.ok).toBe(false);
+ expect(gate.code).toBe('public-review-no-eligible-provider');
+ expect(gate.error).toMatch(/no-tool/);
+
+ seed([OLLAMA_API, { ...OPENCODE, enabled: false }]);
+ const actions = await resolvePublicReviewProvider({ posture: 'sandboxed-actions' });
+ expect(actions.ok).toBe(false);
+ expect(actions.code).toBe('public-review-no-eligible-provider');
+ expect(actions.error).toMatch(/sandboxed-actions/);
});
});