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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: align PR review stage controls with tool-free policy
Adam Eivyde8947657762
diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsxindex 260659c0ac..a7a954e060 100644--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.jsx@@ -32,7 +32,7 @@ const eligibleProvidersFor = (providers, policy) =>const providerNames = (providers) => providers.map((p) => p.name || p.id).join(', ');// Constant now that the eligible set is left to the dropdown.-const NO_TOOL_STAGE_NOTE = "Tool-free stage. A local model must additionally report no tool-calling capability; a cloud model is held tool-free by the provider's own enforced flags. Leave the provider unset to use the first eligible one. It returns only a binary allowlist; the final stage never receives rejected content.";+const NO_TOOL_STAGE_NOTE = "A local model must additionally report no tool-calling capability; a cloud model is held tool-free by the provider's own enforced flags. Leave the provider unset to use the first eligible one.";// 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@@ -129,7 +129,7 @@ export default function PipelineStageConfig({ taskType, config, providers, provi<div><p className="text-sm font-medium text-white">Run final code review and actions</p><p className="text-xs text-gray-400 mt-1">- When enabled, a sandbox-capable reviewer applies only the screened patch, runs local tests, and returns a structured review for the deterministic GitHub coordinator. It is nested here, not a separate scheduled task.+ When enabled, a tool-free reviewer analyzes screened PR content and returns a structured static review. The deterministic GitHub coordinator validates any resulting actions. Contributor code is never executed. This stage is nested here, not a separate scheduled task.</p></div><ToggleSwitch@@ -154,32 +154,17 @@ export default function PipelineStageConfig({ taskType, config, providers, provi? (prReviewerStageRole(stage) || (i === 0 ? 'security' : i === 1 ? 'eligibility' : 'actions')): null;const isSecurityStage = role === 'security';- // The posture is read off the stage's own execution profile, so a- // custom pipeline that reuses one of these profiles gets the same- // gating without being a pr-reviewer stage.- const posture = isSecurityStage ? null : stagePublicReviewPosture(stage);+ // PR roles reassert the server's no-tool contract even for legacy+ // profiles or position-only stages. Other pipelines keep their profile.+ const posture = isSecurityStage ? null : stagePublicReviewPosture(role ? { ...stage, role } : stage);const isNoToolStage = posture === PUBLIC_REVIEW_NO_TOOL_POSTURE;const isActionsStage = Boolean(posture) && !isNoToolStage;const eligibleProviders = posture ? eligibleProvidersFor(providers, selectionPolicies[posture]) : null;const localBackend = localBackendForProvider(stageProvider);const localModelIds = localBackend === 'ollama' ? ollama : localBackend === 'lmstudio' ? lmstudio : [];- // A LOCAL provider's installed-model list is the source of truth (its- // stored catalog is a cached snapshot, and only an installed model has- // a probeable capability report). That holds for the sandboxed actions- // stage as much as the tool-free gate — offering the stale catalog- // there let a stage be pinned to a model the daemon no longer serves,- // and hid one that had just been pulled. Every other provider uses its- // own catalog, so a cloud CLI stage can pick any model it offers.- //- // `useLocalModels` reports BOTH "not fetched yet" and "daemon said- // nothing" as `[]`, so an empty list is not evidence the daemon serves- // no models. The two stages part ways on what to do about that. The- // tool-free gate must stay strict: its policy needs a probeable- // capability report, and a model with none is not selectable at all,- // so an empty list correctly offers nothing. The actions stage has no- // such gate, so it falls back to the record's catalog — otherwise a- // stopped daemon (or the in-flight window) renders an empty picker and- // drops the stage's own saved pin out of the dropdown.+ // Both PR analysis stages require the local daemon's capability report.+ // Cached models cannot establish no-tool eligibility when it is offline.+ // Generic sandboxed-action stages retain their catalog fallback.const localStageModels = localModelIds.map(id => ({id,name: id,@@ -202,7 +187,7 @@ export default function PipelineStageConfig({ taskType, config, providers, provi<span className="text-[10px] px-1 py-0.5 bg-gray-600/30 text-gray-400 rounded">read-only</span>)}{isNoToolStage && (- <span className="text-[10px] px-1 py-0.5 bg-port-accent/15 text-port-accent rounded">tool-free gate</span>+ <span className="text-[10px] px-1 py-0.5 bg-port-accent/15 text-port-accent rounded">{role === 'actions' ? 'tool-free review' : 'tool-free gate'}</span>)}{isActionsStage && (<span className="text-[10px] px-1 py-0.5 bg-port-accent-2/15 text-port-accent-2 rounded">sandboxed actions</span>@@ -217,7 +202,7 @@ export default function PipelineStageConfig({ taskType, config, providers, provi<p className="font-medium text-port-accent">Deterministic hidden-content screen</p><p className="mt-1">Server-side checks on each external PR's complete title, description, and diff for content a human reviewer would miss — invisible or direction-control Unicode, comments GitHub never renders that address a model — and for obvious model-directed harm: instruction overrides, decode-and-follow or download-and-run instructions, credential exfiltration, and attempts to steer the review verdict. No model, tools, repository checkout, or GitHub credentials are involved.</p><p className="mt-1 text-gray-500">- The pinned Llama Prompt Guard 2 classifier runs as an optional second layer only when it is installed on{' '}+ The pinned Llama Prompt Guard 2 classifier is required by default. Install and configure it on{' '}<Link to="/models/llms/abuse" className="underline hover:text-port-accent">Models → LLMs → Abuse Guard</Link>.</p></div>@@ -254,7 +239,7 @@ export default function PipelineStageConfig({ taskType, config, providers, provi<p className="text-xs text-gray-500 mt-2">{localModelsLoading? 'Loading installed local model capability reports…'- : NO_TOOL_STAGE_NOTE}+ : `${role === 'actions' ? 'Tool-free review. Returns a structured static review for server-validated actions; it cannot run contributor code or tests.' : role === 'eligibility' ? 'Tool-free stage. Returns only a binary allowlist; rejected content never reaches the final review.' : 'Tool-free stage.'} ${NO_TOOL_STAGE_NOTE}`}</p>)}{isActionsStage && eligibleProviders?.length > 0 && (@@ -273,7 +258,7 @@ export default function PipelineStageConfig({ taskType, config, providers, provi</div><p className="text-xs text-gray-500 mt-2">{needsSecurityModelPolicy- ? 'Stage 1 screens complete public content with a managed classifier; only cleared content reaches the tool-free Eligibility Gate, and only eligible PRs reach the optional sandboxed final review. Stages are nested, not independently scheduled.'+ ? 'Stage 1 screens complete public content with a managed classifier; only cleared content reaches the tool-free Eligibility Gate, and only eligible PRs reach the optional tool-free final review. The server validates resulting GitHub actions. Stages are nested, not independently scheduled.': 'Each stage runs as a separate agent inside this pipeline; stages are not scheduled independently.'}{' Configure a different provider, model, and thinking effort per stage.'}</p>diff --git a/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx b/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsxindex fbadc00fe2..27bb8913d1 100644--- a/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx+++ b/client/src/components/cos/tabs/schedule/PipelineStageConfig.test.jsx@@ -104,17 +104,19 @@ function renderStages(stages = STAGES, onUpdate = vi.fn().mockResolvedValue(unde}describe('PipelineStageConfig — pr-reviewer', () => {- it('uses shared capability policies for the gate and sandbox-capable action providers', () => {+ it('requires tool-free providers for both PR stages and marks an unsafe saved pin unavailable', () => {renderStages();const providerSelects = screen.getAllByLabelText('Provider');expect([...providerSelects[0].options].map((option) => option.value)).toEqual(['', 'claude-ollama']);- expect([...providerSelects[1].options].map((option) => option.value)).toEqual(['', 'codex-cli', 'antigravity-cli']);+ expect([...providerSelects[1].options].map((option) => option.value)).toEqual(['', 'claude-ollama', 'codex-cli']);+ expect(providerSelects[1].querySelector('option[value="codex-cli"]')).toBeDisabled();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 OS sandbox/i)).toBeInTheDocument();+ expect(screen.getByText(/^Tool-free review\./)).toBeInTheDocument();+ expect(screen.queryByText(/applies only the screened patch/)).not.toBeInTheDocument();});it('removes the optional actions stage without changing the mandatory gate', async () => {@@ -139,7 +141,7 @@ describe('PipelineStageConfig — pr-reviewer', () => {expect.objectContaining({role: 'actions',promptKey: 'pr-reviewer-review',- executionProfile: 'public-review-actions',+ executionProfile: 'public-review-gate',discardWorktree: true,noCodeOutput: true,}),@@ -184,7 +186,7 @@ describe('PipelineStageConfig — posture-driven eligibility', () => {// A non-local provider's own catalog is selectable — the installed-local// model list only applies where PortOS can probe capabilities.expect(screen.getByText(/^Tool-free stage\./)).toBeInTheDocument();- expect(screen.getByText(/^Sandboxed stage\./)).toBeInTheDocument();+ expect(screen.getByText(/^Tool-free review\./)).toBeInTheDocument();});// The bug behind #5906's blocked run: the CLI records were disabled and the@@ -202,43 +204,32 @@ describe('PipelineStageConfig — posture-driven eligibility', () => {expect([...providerSelects[1].options].map((o) => o.value)).toEqual(['', 'codex-tui']);// The dropdown IS the eligible list; the note must not re-name providers,// least of all the disabled ones.- const note = screen.getByText(/^Sandboxed stage\./);+ const note = screen.getByText(/^Tool-free review\./);expect(note.textContent).not.toContain('Grok Build CLI');expect(note.textContent).not.toContain('Codex CLI');});it('warns instead of silently offering nothing when a stage has no eligible provider', () => {renderWith([- { id: 'claude-ollama', name: 'Local Claude', type: 'cli', command: 'claude', endpoint: 'http://127.0.0.1:11434', models: ['safe-model'], publicReviewPostures: ['no-tool'] },+ { id: 'actions-only', name: 'Actions Only', type: 'cli', command: 'example', models: ['example-model'], publicReviewPostures: ['sandboxed-actions'] },]);- expect(screen.getByText(/No enabled AI provider on this install can enforce the sandboxed-actions posture/)).toBeInTheDocument();+ expect(screen.getAllByText(/No enabled AI provider on this install can enforce the tool-free posture/)).toHaveLength(2);});- // 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', () => {+ it('excludes worktree-only providers from both PR stages despite a legacy action profile', () => {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\./);- // The eligible set is the dropdown's job; the note only separates the- // vendor-sandboxed providers from the worktree-only ones.- expect(note.textContent).not.toContain('Eligible on this install');- 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.');+ expect([...providerSelects[1].options].map((o) => o.value)).toEqual(['', 'codex-tui']);+ expect(screen.queryByText(/^Sandboxed stage\./)).not.toBeInTheDocument();});- // A local runtime's daemon is the authority on what it serves; the provider- // record's `models` array is a cached snapshot. The tool-free gate already- // read the daemon, but the sandboxed actions stage read the snapshot — so a- // stage on a local provider could only be pinned to models that had since- // been removed, and never to one just pulled.- it('offers the installed local models for a local-backed ACTIONS stage', () => {+ // A saved model that now advertises tools must remain visible as unavailable,+ // while newly installed models without tools are offered immediately.+ it('requires installed no-tool local models for the final PR review', () => {const localProvider = {id: 'opencode-ollama-tui',name: 'OpenCode Ollama TUI',@@ -267,16 +258,15 @@ describe('PipelineStageConfig — posture-driven eligibility', () => {const modelSelects = screen.getAllByLabelText('Model');// The daemon's installed models, NOT the record's `stale-cached-model`.- expect([...modelSelects[1].options].map((o) => o.value)).toEqual(['', 'safe-model', 'tool-model']);+ expect([...modelSelects[1].options].map((o) => o.value)).toEqual(['', 'tool-model', 'safe-model']);+ expect(modelSelects[1].querySelector('option[value="tool-model"]')).toBeDisabled();+ expect(modelSelects[1].querySelector('option[value="safe-model"]')).not.toBeDisabled();});});// `useLocalModels` reports "not fetched yet" and "the daemon listed nothing"// identically, as `[]` — so an empty list is not evidence the daemon serves no-// models. The actions stage has no capability gate, so it must fall back to the-// record's catalog rather than render an empty picker that also drops the-// stage's own saved pin. The tool-free gate deliberately does NOT: a model with-// no probeable capability report is not selectable there at all.+// models. Neither PR stage may offer cached models without capability reports.describe('PipelineStageConfig — local daemon unreachable', () => {const LOCAL = {id: 'opencode-ollama-tui',@@ -288,7 +278,7 @@ describe('PipelineStageConfig — local daemon unreachable', () => {publicReviewEnforcedPostures: ['no-tool'],};- it('falls back to the record catalog for the actions stage, but not for the gate', () => {+ it('rejects unverified cached models in both PR stages while keeping saved pins visibly unavailable', () => {localModels = { ollama: [], lmstudio: [], capabilitiesByBackend: {}, loading: false };render(<MemoryRouter>@@ -312,9 +302,8 @@ describe('PipelineStageConfig — local daemon unreachable', () => {// rather than blanking the control, and `cached-b` proves the list itself// was not consulted.expect([...modelSelects[0].options].map((o) => o.value)).toEqual(['', 'cached-a']);- // The actions stage gets the whole record catalog instead of an empty- // picker that would also drop its own saved pin (nothing re-adds it there:- // its policy allows every model, so the disallowed affordance never fires).- expect([...modelSelects[1].options].map((o) => o.value)).toEqual(['', 'cached-a', 'cached-b']);+ expect([...modelSelects[1].options].map((o) => o.value)).toEqual(['', 'cached-a']);+ expect(modelSelects[0].querySelector('option[value="cached-a"]')).toBeDisabled();+ expect(modelSelects[1].querySelector('option[value="cached-a"]')).toBeDisabled();});});diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.js b/client/src/components/cos/tabs/schedule/scheduleConstants.jsindex ec09e069b9..7feef45f79 100644--- a/client/src/components/cos/tabs/schedule/scheduleConstants.js+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.js@@ -74,17 +74,16 @@ export const STAGE_EXECUTION_PROFILE_POSTURES = Object.freeze({'public-review-actions': PUBLIC_REVIEW_ACTIONS_POSTURE,});-// Role fallback for a stage persisted before profiles were stored: the server-// reasserts the profile on the next dispatch, but the picker has to gate-// correctly on what is on disk right now.+// PR roles override stored profiles, including legacy action stages. The server+// reasserts a tool-free profile on dispatch; the picker must match before saving.const PR_REVIEWER_ROLE_POSTURES = Object.freeze({eligibility: PUBLIC_REVIEW_NO_TOOL_POSTURE,- actions: PUBLIC_REVIEW_ACTIONS_POSTURE,+ actions: PUBLIC_REVIEW_NO_TOOL_POSTURE,});export function stagePublicReviewPosture(stage) {- return STAGE_EXECUTION_PROFILE_POSTURES[stage?.executionProfile]- || PR_REVIEWER_ROLE_POSTURES[prReviewerStageRole(stage)]+ return PR_REVIEWER_ROLE_POSTURES[prReviewerStageRole(stage)]+ || STAGE_EXECUTION_PROFILE_POSTURES[stage?.executionProfile]|| null;}@@ -92,7 +91,7 @@ export function stagePublicReviewPosture(stage) {// just a display label. The server sanitizes and reasserts the same contract;// this copy lets the schedule UI add it without manufacturing a weaker stage.export const PR_REVIEWER_ACTIONS_STAGE_DEFAULTS = Object.freeze({- name: 'Code Review & Actions',+ name: 'Code Review & Validated Actions',role: 'actions',promptKey: 'pr-reviewer-review',readOnly: true,@@ -103,7 +102,7 @@ export const PR_REVIEWER_ACTIONS_STAGE_DEFAULTS = Object.freeze({discardWorktree: true,noCodeOutput: true,managed: true,- executionProfile: 'public-review-actions',+ executionProfile: 'public-review-gate',});export function togglePrReviewerActions(stages, enabled) {diff --git a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js b/client/src/components/cos/tabs/schedule/scheduleConstants.test.jsindex 1a8f801559..9bf8999546 100644--- a/client/src/components/cos/tabs/schedule/scheduleConstants.test.js+++ b/client/src/components/cos/tabs/schedule/scheduleConstants.test.js@@ -1,5 +1,5 @@import { describe, it, expect } from 'vitest';-import { getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone, setMetadataOverride, toggleMetadataField, fileIssuesEffective, managedAgentOptionsFor, toggleFileIssuesMetadata, prReviewerStageRole, togglePrReviewerActions } from './scheduleConstants';+import { getTaskStatusGroup, taskSortKey, TASK_FILTERS, STATUS_GROUPS, describeNextRun, coverageTone, setMetadataOverride, toggleMetadataField, fileIssuesEffective, managedAgentOptionsFor, toggleFileIssuesMetadata, prReviewerStageRole, stagePublicReviewPosture, togglePrReviewerActions } from './scheduleConstants';describe('pr-reviewer pipeline helpers', () => {it('recognizes semantic roles and legacy prompt-key stages', () => {@@ -8,6 +8,13 @@ describe('pr-reviewer pipeline helpers', () => {expect(prReviewerStageRole({ promptKey: 'other' })).toBeNull();});+ it('enforces tool-free PR roles over legacy profiles while preserving generic profiles', () => {+ expect(stagePublicReviewPosture({ role: 'actions', executionProfile: 'public-review-actions' })).toBe('no-tool');+ expect(stagePublicReviewPosture({ promptKey: 'pr-reviewer-review', executionProfile: 'public-review-actions' })).toBe('no-tool');+ expect(stagePublicReviewPosture({ role: 'eligibility', executionProfile: 'public-review-actions' })).toBe('no-tool');+ expect(stagePublicReviewPosture({ promptKey: 'custom-review', executionProfile: 'public-review-actions' })).toBe('sandboxed-actions');+ });+it('removes only the optional actions stage and restores its full safe posture', () => {const stages = [{ name: 'Security Scan', role: 'security' },@@ -20,7 +27,7 @@ describe('pr-reviewer pipeline helpers', () => {expect.objectContaining({role: 'actions',promptKey: 'pr-reviewer-review',- executionProfile: 'public-review-actions',+ executionProfile: 'public-review-gate',discardWorktree: true,noCodeOutput: true,}),