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

simplify: one provider fetch per autopilot panel, one "provider / model" phrasing, whole start frame on status

[._.]/ Adam Eivy30c5122fd71f
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index 9f37c4d298..58712e63cc 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -18,7 +18,7 @@ import {
getSettings,
patchSettingsSlice,
} from '../../services/api';
-import { providerDisplayName, assignmentModelOptions, resolveSeriesRunLlm } from '../../utils/providers';
+import { providerDisplayName, providerModelLabel, assignmentModelOptions, resolveSeriesRunLlm } from '../../utils/providers';
import ProviderModelSelector from '../ProviderModelSelector';
import SeriesAutopilotSchedule from './SeriesAutopilotSchedule';
@@ -312,6 +312,13 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
overrideModel: modelOverride,
activeProviderId,
});
+ // A pin naming a provider that is gone or disabled is a SOFT default server
+ // side — the run quietly falls back to the active provider. Say so rather than
+ // asserting a provider that won't run (only once the list has loaded, or a
+ // slow fetch would flash the warning on a perfectly good pin).
+ const effProvider = providers.find((p) => p.id === effProviderId);
+ const effProviderUnavailable = !!effProviderId && providers.length > 0
+ && (!effProvider || effProvider.enabled === false);
const providerModels = useMemo(
() => assignmentModelOptions(null, providers, effProviderId),
[providers, effProviderId],
@@ -407,6 +414,16 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
// the new run down. Terminal frames whose runId doesn't match are ignored.
const activeRunIdRef = useRef(null);
+ // Read a run's `start` frame — mode (the dry-run badge), the resolved run
+ // provider/model, and a dry-run's plan. Shared by the SSE frame and the
+ // status payload's copy of it (see the re-attach effect below).
+ const applyStartFrame = useCallback((f) => {
+ setMode(f.mode || null);
+ setRunLlm({ provider: f.provider || null, model: f.model || null });
+ if (Array.isArray(f.plan)) setPlan(f.plan);
+ if (f.planTotals) setPlanTotals(f.planTotals);
+ }, []);
+
// Re-attach to an in-flight run on (re)mount.
useEffect(() => {
if (!seriesId) return undefined;
@@ -415,31 +432,26 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
.then((s) => {
if (canceled || !s?.active) return;
activeRunIdRef.current = s.autopilot?.runId || null;
- // The start frame is long gone for an in-flight run, so take the
- // resolved provider/model from the status payload instead.
- if (s.runLlm) setRunLlm(s.runLlm);
+ // SSE replays only the last frame, so the run's `start` frame comes back
+ // on the status payload instead — same shape, same reader.
+ if (s.start) applyStartFrame(s.start);
setActive(true);
})
.catch(() => null);
return () => { canceled = true; };
- }, [seriesId]);
+ }, [seriesId, applyStartFrame]);
// Capture dry-run plan + mode. The plan rides the start frame, but a fast
// dry-run can complete before the client attaches and only the terminal frame
// is replayed — so also read the plan off a dry-run complete frame.
useEffect(() => {
if (latest?.type === 'start') {
- setMode(latest.mode || null);
- // Resolved run provider/model (null when the run falls through to the
- // active provider) — the live line names what this run is spending on.
- setRunLlm({ provider: latest.provider || null, model: latest.model || null });
- if (Array.isArray(latest.plan)) setPlan(latest.plan);
- if (latest.planTotals) setPlanTotals(latest.planTotals);
+ applyStartFrame(latest);
} else if (latest?.type === 'complete' && latest.dryRun && Array.isArray(latest.plan)) {
setPlan(latest.plan);
if (latest.planTotals) setPlanTotals(latest.planTotals);
}
- }, [latest]);
+ }, [latest, applyStartFrame]);
// Run-ended handling: refresh series (for the marker) + issues, toast outcome.
useEffect(() => {
@@ -590,16 +602,19 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
<div className="rounded-lg border border-port-border bg-port-bg/60 p-2.5 flex flex-col gap-2">
<p className="text-[11px] text-gray-400 leading-relaxed">
This run calls{' '}
- <span className="text-gray-200 font-medium">{providerDisplayName(providers, effProviderId, '—')}</span>
- {effModel ? <> / <span className="text-gray-200 font-medium">{effModel}</span></> : <> (provider default model)</>}
- . Stages pinned to their own provider/model in{' '}
+ <span className="text-gray-200 font-medium">{providerModelLabel(providers, effProviderId, effModel)}</span>
+ . Stages pinned in{' '}
<Link to="/prompts" className="text-port-accent hover:underline">Prompts</Link>{' '}
- keep that pin; everything else uses the provider above. Reasoning
- effort isn&apos;t a per-run pipeline control — it comes from the
- provider&apos;s own CLI configuration (or a model id that bakes in a
- tier) on the{' '}
- <Link to="/ai" className="text-port-accent hover:underline">AI Providers</Link> page.
+ keep their own provider/model; reasoning effort isn&apos;t a per-run
+ control here — it comes from the provider&apos;s config on{' '}
+ <Link to="/ai" className="text-port-accent hover:underline">AI Providers</Link>.
</p>
+ {effProviderUnavailable ? (
+ <p className="text-[11px] text-port-warning">
+ That provider is disabled or missing — the run falls back to{' '}
+ {providerDisplayName(providers, activeProviderId, 'the active provider')}.
+ </p>
+ ) : null}
<div className="max-w-md">
<ProviderModelSelector
providers={providers}
@@ -794,8 +809,7 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
{/* Name the provider/model this run resolved to, so an in-flight run
(including one the scheduler started) says what it is spending on. */}
<div className="mt-1 text-[11px] text-gray-500">
- on {providerDisplayName(providers, runLlm?.provider || activeProviderId, '—')}
- {runLlm?.model ? ` / ${runLlm.model}` : ' (provider default model)'}
+ on {providerModelLabel(providers, runLlm?.provider || activeProviderId, runLlm?.model)}
</div>
{frames?.length ? (
<div className="mt-2 max-h-28 overflow-y-auto text-[11px] text-gray-500 space-y-0.5">
@@ -882,7 +896,9 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
})() : null}
{/* Scheduled unattended runs (#2174) — hidden while a run is active. */}
- {!active ? <SeriesAutopilotSchedule series={series} /> : null}
+ {!active ? (
+ <SeriesAutopilotSchedule series={series} providers={providers} activeProviderId={activeProviderId} />
+ ) : null}
{/* Production readiness (canon descriptive integrity) */}
<div className="px-3 pb-3 border-t border-port-border pt-2">
diff --git a/client/src/components/pipeline/AutopilotPanel.test.jsx b/client/src/components/pipeline/AutopilotPanel.test.jsx
index bc6e7952ae..1c9e02e099 100644
--- a/client/src/components/pipeline/AutopilotPanel.test.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.test.jsx
@@ -193,14 +193,16 @@ describe('AutopilotPanel', () => {
));
});
- it('names the in-flight run provider when re-attaching mid-run', async () => {
+ it('describes an in-flight run from the status payload start frame when re-attaching', async () => {
getPipelineAutopilotStatus.mockResolvedValue({
autopilot: { status: 'running', runId: 'r1' },
active: true,
- runLlm: { provider: 'codex', model: 'gpt-5-codex' },
+ start: { type: 'start', runId: 'r1', mode: 'dry-run', provider: 'codex', model: 'gpt-5-codex' },
});
renderPanel({ id: 's1', targetFormat: 'comic' });
expect(await screen.findByText(/on Codex \/ gpt-5-codex/)).toBeInTheDocument();
+ // mode rides the same frame, so the dry-run badge survives a mid-run attach.
+ expect(screen.getByText('dry-run')).toBeInTheDocument();
});
it('clears to the default (not 0) when a round input is emptied', async () => {
diff --git a/client/src/components/pipeline/SeriesAutopilotSchedule.jsx b/client/src/components/pipeline/SeriesAutopilotSchedule.jsx
index 4bc3899305..3e7f8fde50 100644
--- a/client/src/components/pipeline/SeriesAutopilotSchedule.jsx
+++ b/client/src/components/pipeline/SeriesAutopilotSchedule.jsx
@@ -1,10 +1,9 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { CalendarClock, Loader2, AlertTriangle, Trash2 } from 'lucide-react';
import { getSettings, patchSettingsSlice } from '../../services/apiSystem';
-import { getProviders } from '../../services/apiProviders';
import { getCosConfig } from '../../services/apiAgents';
import { describeCron } from '../../utils/cronHelpers';
-import { providerDisplayName, assignmentModelOptions, resolveSeriesRunLlm } from '../../utils/providers';
+import { providerDisplayName, providerModelLabel, assignmentModelOptions, resolveSeriesRunLlm } from '../../utils/providers';
import BrailleSpinner from '../BrailleSpinner';
import CronInput from '../CronInput';
import ProviderModelSelector from '../ProviderModelSelector';
@@ -26,7 +25,7 @@ import toast from '../ui/Toast';
* (settings.json doesn't federate) — a schedule on the federated series record
* would double-run the same series across sync peers.
*/
-export default function SeriesAutopilotSchedule({ series }) {
+export default function SeriesAutopilotSchedule({ series, providers = [], activeProviderId = null }) {
const seriesId = series?.id;
const [loaded, setLoaded] = useState(false);
const [saving, setSaving] = useState(false);
@@ -34,23 +33,18 @@ export default function SeriesAutopilotSchedule({ series }) {
// The persisted schedule entry for THIS series (null when none configured).
const [entry, setEntry] = useState(null);
- // Context for the consent copy.
- const [providers, setProviders] = useState([]);
- const [activeProviderId, setActiveProviderId] = useState(null);
+ // Context for the consent copy. The provider list comes from AutopilotPanel
+ // (which needs it for its own run-provider picker) rather than being fetched
+ // again here — one `/providers` round trip per panel, and the two blocks of
+ // consent copy can't name different providers.
const [cosMode, setCosMode] = useState(null);
const [cosBudget, setCosBudget] = useState(null); // maxActionsPerDay or null (unlimited)
- // Global, series-independent context (providers + CoS autonomy/budget) — fetch
- // once, not on every series switch.
+ // CoS autonomy/budget — series-independent, so fetch once, not per series switch.
useEffect(() => {
let canceled = false;
- Promise.all([
- getProviders({ silent: true }).catch(() => null),
- getCosConfig({ silent: true }).catch(() => null),
- ]).then(([provData, cos]) => {
+ getCosConfig({ silent: true }).catch(() => null).then((cos) => {
if (canceled) return;
- setProviders(provData?.providers || []);
- setActiveProviderId(provData?.activeProvider || null);
setCosMode(cos?.domainAutonomy?.cos ?? 'execute');
const cap = cos?.domainBudgets?.cos?.maxActionsPerDay;
setCosBudget(Number.isFinite(cap) && cap > 0 ? cap : null);
@@ -188,8 +182,7 @@ export default function SeriesAutopilotSchedule({ series }) {
<div className="rounded-lg border border-port-border bg-port-bg/60 p-2.5 flex flex-col gap-2">
<p className="text-[11px] text-gray-400 leading-relaxed">
Each scheduled run calls your AI provider automatically. It runs as{' '}
- <span className="text-gray-200 font-medium">{providerLabel(effProviderId)}</span>
- {effModel ? <> / <span className="text-gray-200 font-medium">{effModel}</span></> : <> (provider default model)</>}
+ <span className="text-gray-200 font-medium">{providerModelLabel(providers, effProviderId, effModel)}</span>
, and is gated by the CoS autonomy mode{' '}
<span className={`font-medium ${cosMode === 'off' ? 'text-port-error' : 'text-gray-200'}`}>{cosMode || 'execute'}</span>
{' '}and the CoS daily action budget{' '}
diff --git a/client/src/components/pipeline/SeriesAutopilotSchedule.test.jsx b/client/src/components/pipeline/SeriesAutopilotSchedule.test.jsx
index 016805b680..d96f64530f 100644
--- a/client/src/components/pipeline/SeriesAutopilotSchedule.test.jsx
+++ b/client/src/components/pipeline/SeriesAutopilotSchedule.test.jsx
@@ -5,12 +5,10 @@ vi.mock('../../services/apiSystem', () => ({
getSettings: vi.fn(),
patchSettingsSlice: vi.fn(),
}));
-vi.mock('../../services/apiProviders', () => ({ getProviders: vi.fn() }));
vi.mock('../../services/apiAgents', () => ({ getCosConfig: vi.fn() }));
vi.mock('../ui/Toast', () => ({ default: { success: vi.fn(), error: vi.fn(), warning: vi.fn() } }));
import { getSettings, patchSettingsSlice } from '../../services/apiSystem';
-import { getProviders } from '../../services/apiProviders';
import { getCosConfig } from '../../services/apiAgents';
import SeriesAutopilotSchedule from './SeriesAutopilotSchedule';
@@ -18,12 +16,19 @@ const SERIES = { id: 's1', name: 'Test', llm: { provider: 'anthropic', model: 'c
const settingsWith = (schedules = []) => ({ seriesAutopilot: { schedules } });
+// The provider list is owned by AutopilotPanel and passed down (one fetch per
+// panel); tests supply it the same way the parent does.
+let providerProps = () => ({
+ providers: [{ id: 'anthropic', name: 'Anthropic', models: ['claude-opus-4-8'] }],
+ activeProviderId: 'anthropic',
+});
+
beforeEach(() => {
vi.clearAllMocks();
getSettings.mockResolvedValue(settingsWith([]));
- getProviders.mockResolvedValue({
+ providerProps = () => ({
providers: [{ id: 'anthropic', name: 'Anthropic', models: ['claude-opus-4-8'] }],
- activeProvider: 'anthropic',
+ activeProviderId: 'anthropic',
});
getCosConfig.mockResolvedValue({
domainAutonomy: { cos: 'execute' },
@@ -33,7 +38,7 @@ beforeEach(() => {
});
it('shows "Set schedule" and no consent card when nothing is configured', async () => {
- render(<SeriesAutopilotSchedule series={SERIES} />);
+ render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
expect(await screen.findByText('Set schedule')).toBeInTheDocument();
// No cron → no consent/enable UI yet.
expect(screen.queryByText(/Enable scheduled autopilot/)).not.toBeInTheDocument();
@@ -41,7 +46,7 @@ it('shows "Set schedule" and no consent card when nothing is configured', async
it('names the effective provider/model and the cos budget cap in the consent copy', async () => {
getSettings.mockResolvedValue(settingsWith([{ seriesId: 's1', enabled: false, cron: '0 3 * * *' }]));
- render(<SeriesAutopilotSchedule series={SERIES} />);
+ render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
// The daily budget cap is unique to the consent copy; provider/model also
// appear in the override <select> options, so allow multiple matches there.
expect(await screen.findByText(/40 actions\/day/)).toBeInTheDocument();
@@ -51,7 +56,7 @@ it('names the effective provider/model and the cos budget cap in the consent cop
it('enable toggle is OFF by default and enabling persists enabled:true', async () => {
getSettings.mockResolvedValue(settingsWith([{ seriesId: 's1', enabled: false, cron: '0 3 * * *' }]));
- render(<SeriesAutopilotSchedule series={SERIES} />);
+ render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
const toggle = await screen.findByRole('checkbox');
expect(toggle).not.toBeChecked();
fireEvent.click(toggle);
@@ -68,7 +73,7 @@ it('preserves OTHER series schedules when saving this one', async () => {
{ seriesId: 'other', enabled: true, cron: '0 5 * * *' },
{ seriesId: 's1', enabled: false, cron: '0 3 * * *' },
]));
- render(<SeriesAutopilotSchedule series={SERIES} />);
+ render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
const toggle = await screen.findByRole('checkbox');
fireEvent.click(toggle);
await waitFor(() => expect(patchSettingsSlice).toHaveBeenCalled());
@@ -80,15 +85,15 @@ it('preserves OTHER series schedules when saving this one', async () => {
it('does not name the series model when the override provider differs from the series provider', async () => {
// Override to openai; the series is on anthropic. The run will use openai's
// DEFAULT model, so the consent copy must not show the series' anthropic model.
- getProviders.mockResolvedValue({
+ providerProps = () => ({
providers: [
{ id: 'anthropic', name: 'Anthropic', models: ['claude-opus-4-8'] },
{ id: 'openai', name: 'OpenAI', models: ['gpt-5.6'] },
],
- activeProvider: 'anthropic',
+ activeProviderId: 'anthropic',
});
getSettings.mockResolvedValue(settingsWith([{ seriesId: 's1', enabled: false, cron: '0 3 * * *', provider: 'openai' }]));
- render(<SeriesAutopilotSchedule series={SERIES} />);
+ render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
expect(await screen.findByText(/provider default model/)).toBeInTheDocument();
expect(screen.queryByText('claude-opus-4-8')).not.toBeInTheDocument();
});
@@ -96,10 +101,10 @@ it('does not name the series model when the override provider differs from the s
it('clears the prior series schedule when switching series so it is not shown/saved under the new id', async () => {
// settings only holds s1's schedule; s2 has none.
getSettings.mockResolvedValue(settingsWith([{ seriesId: 's1', enabled: true, cron: '0 3 * * *' }]));
- const { rerender } = render(<SeriesAutopilotSchedule series={SERIES} />);
+ const { rerender } = render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
await screen.findByText('Change'); // s1's configured schedule renders
// Switch to s2 (different id, no schedule) — must not keep showing s1's cron/consent.
- rerender(<SeriesAutopilotSchedule series={{ id: 's2', name: 'Other', llm: {} }} />);
+ rerender(<SeriesAutopilotSchedule series={{ id: 's2', name: 'Other', llm: {} }} {...providerProps()} />);
expect(await screen.findByText('Set schedule')).toBeInTheDocument();
expect(screen.queryByText(/Enable scheduled autopilot/)).not.toBeInTheDocument();
});
@@ -107,6 +112,6 @@ it('clears the prior series schedule when switching series so it is not shown/sa
it('warns when CoS autonomy is off', async () => {
getSettings.mockResolvedValue(settingsWith([{ seriesId: 's1', enabled: false, cron: '0 3 * * *' }]));
getCosConfig.mockResolvedValue({ domainAutonomy: { cos: 'off' }, domainBudgets: {} });
- render(<SeriesAutopilotSchedule series={SERIES} />);
+ render(<SeriesAutopilotSchedule series={SERIES} {...providerProps()} />);
expect(await screen.findByText(/CoS autonomy is off/)).toBeInTheDocument();
});
diff --git a/client/src/utils/README.md b/client/src/utils/README.md
index 3f10c1f130..08d342d98d 100644
--- a/client/src/utils/README.md
+++ b/client/src/utils/README.md
@@ -40,7 +40,7 @@ grep -i "what you want to do" client/src/utils/README.md
| `urlNormalize` | `isUrl` detection, `normalizeUrl` (optional git/`requireDot` modes), `isHttpUrl` (explicit http(s) only — safe-href check), 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. |
-| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `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 — configured-default sentinels, and the claude/codex/agy thinking-effort levels — `effortLevelsForProvider`, mirror of server `providerModels.js`). |
+| `providers` | AI-provider type predicates and helpers (`isCliProvider`, `isApiProvider`, `isCodexProvider`, `isAntigravityProvider`, `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`). |
| `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`). |
## Module loading / resilience
diff --git a/client/src/utils/providers.js b/client/src/utils/providers.js
index 7f3130a4ec..9185ba08ad 100644
--- a/client/src/utils/providers.js
+++ b/client/src/utils/providers.js
@@ -762,6 +762,37 @@ export const resolveEffectiveProvider = (providers, pinnedId, activeProviderId)
return { provider, usingActive: !pinnedId && !!provider };
};
+/**
+ * Effective provider/model for a run against a Pipeline series — CLIENT MIRROR
+ * of `resolveSeriesLlmOverride` (server/lib/seriesLlmOverride.js; the precedence
+ * rationale lives there), extended with the install's active provider as the
+ * final fallback so the UI can NAME what a run will call instead of a blank.
+ *
+ * Used by the Autopilot Options picker and the scheduled-run consent card so
+ * both name the same thing the server's `resolveAutopilotLlm` will resolve.
+ *
+ * @returns {{provider: string, model: string}}
+ */
+export const resolveSeriesRunLlm = (series, { overrideProvider, overrideModel, activeProviderId } = {}) => {
+ const seriesProvider = series?.llm?.provider || '';
+ // The series model belongs to the series provider — an override naming a
+ // different provider must resolve THAT provider's default instead.
+ const inheritsSeriesModel = !overrideProvider || overrideProvider === seriesProvider;
+ return {
+ provider: overrideProvider || seriesProvider || activeProviderId || '',
+ model: overrideModel || (inheritsSeriesModel ? series?.llm?.model || '' : ''),
+ };
+};
+
+/**
+ * "Claude Code / claude-opus-5" — or "Claude Code (provider default model)"
+ * when no model is pinned. The one phrasing for "which AI will this run call",
+ * so the Autopilot Options copy, its live-progress line and the scheduled-run
+ * consent card can't word the same fact three different ways.
+ */
+export const providerModelLabel = (providers, id, model) =>
+ `${providerDisplayName(providers, id, '—')}${model ? ` / ${model}` : ' (provider default model)'}`;
+
/**
* Tailwind chip classes for the provider type badge ('cli' / 'tui' / 'api').
* Lifted out of AIProviders.jsx so other components can render the same
@@ -782,30 +813,6 @@ export const providerTypeClass = (type) => {
// pre-baked `providerOptions` / `modelOptions` overrides for runtime call sites.
// ---------------------------------------------------------------------------
-/**
- * Effective provider/model for a run against a Pipeline series — CLIENT MIRROR
- * of `resolveSeriesLlmOverride` in server/lib/seriesLlmOverride.js, extended
- * with the install's active provider as the final fallback so the UI can NAME
- * what a run will call rather than showing a blank.
- *
- * Precedence: an explicit per-run/schedule override → the series' own
- * `series.llm` → the active provider. A model id is provider-specific, so the
- * series model is inherited ONLY while the effective provider is still the
- * series provider — an override naming a different provider resolves that
- * provider's own default model instead of forwarding a foreign id.
- *
- * @returns {{provider: string, model: string, inheritsSeriesModel: boolean}}
- */
-export const resolveSeriesRunLlm = (series, { overrideProvider, overrideModel, activeProviderId } = {}) => {
- const seriesProvider = series?.llm?.provider || '';
- const inheritsSeriesModel = !overrideProvider || overrideProvider === seriesProvider;
- return {
- provider: overrideProvider || seriesProvider || activeProviderId || '',
- model: overrideModel || (inheritsSeriesModel ? series?.llm?.model || '' : ''),
- inheritsSeriesModel,
- };
-};
-
/** Display name for a provider id, falling back to the id then `fallback`. */
export const providerDisplayName = (providers, id, fallback = '') =>
providers.find((p) => p.id === id)?.name || id || fallback;
diff --git a/server/routes/pipeline/autopilot.js b/server/routes/pipeline/autopilot.js
index eb777ca16d..10799dd2fb 100644
--- a/server/routes/pipeline/autopilot.js
+++ b/server/routes/pipeline/autopilot.js
@@ -12,9 +12,10 @@
* immediately; the active step/LLM call
* finishes before the terminal `canceled`
* frame (cooperative, between-step cancel).
- * GET /series/:id/autopilot/status → { autopilot, active, runLlm }
- * (resume / paused UI; runLlm names the
- * in-flight run's provider/model)
+ * GET /series/:id/autopilot/status → { autopilot, active, start }
+ * (resume / paused UI; `start` is the
+ * in-flight run's start frame, which
+ * names its provider/model)
*/
import { Router } from 'express';
@@ -142,10 +143,10 @@ router.get('/series/:id/autopilot/status', asyncHandler(async (req, res) => {
res.json({
autopilot: series.autopilot || null,
active: autopilot.isAutopilotActive(req.params.id),
- // Provider/model an in-flight run resolved to, so a client re-attaching
- // mid-run can name what the run is spending on (the `start` frame carrying
- // them is long gone by then). null when no run is active.
- runLlm: autopilot.activeRunLlm(req.params.id),
+ // The in-flight run's `start` frame (mode, target, resolved provider/model),
+ // so a client attaching mid-run can describe a run it never saw begin — SSE
+ // replays only the last frame. null when no run is active.
+ start: autopilot.activeRunStart(req.params.id),
});
}));
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index 51ab91bfb2..b3b29abf9a 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -275,35 +275,25 @@ describe('provider/model threading helpers (#1514 provider + #1558 model — bot
});
});
+// The precedence itself is covered by server/lib/seriesLlmOverride.test.js —
+// what's specific here is that the autopilot delegates to it and renames the
+// keys to the run-option ones.
describe('resolveAutopilotLlm — run provider/model resolution', () => {
const series = { llm: { provider: 'codex', model: 'gpt-x' } };
- it('inherits the series llm when the run pins nothing', () => {
+ it('inherits the series llm under the run-option key names', () => {
expect(autopilot.resolveAutopilotLlm({}, series))
.toEqual({ providerOverride: 'codex', modelOverride: 'gpt-x' });
});
- it('lets a per-run override win over the series llm', () => {
- expect(autopilot.resolveAutopilotLlm({ providerOverride: 'claude', modelOverride: 'opus' }, series))
- .toEqual({ providerOverride: 'claude', modelOverride: 'opus' });
- });
-
- it('drops the series model when the override names a DIFFERENT provider', () => {
- // A model id is provider-specific — forwarding codex's model to claude would fail.
+ it('lets a per-run override win, dropping the series model when the provider differs', () => {
expect(autopilot.resolveAutopilotLlm({ providerOverride: 'claude' }, series))
- .toEqual({ providerOverride: 'claude', modelOverride: null });
- });
-
- it('keeps the series model when the override names the SAME provider', () => {
- expect(autopilot.resolveAutopilotLlm({ providerOverride: 'codex' }, series))
- .toEqual({ providerOverride: 'codex', modelOverride: 'gpt-x' });
+ .toEqual({ providerOverride: 'claude', modelOverride: undefined });
});
- it('resolves to null/null with no series llm and no override (active provider downstream)', () => {
- expect(autopilot.resolveAutopilotLlm({}, { llm: null }))
- .toEqual({ providerOverride: null, modelOverride: null });
+ it('resolves to nothing with no series llm and no override (active provider downstream)', () => {
expect(autopilot.resolveAutopilotLlm({}, null))
- .toEqual({ providerOverride: null, modelOverride: null });
+ .toEqual({ providerOverride: undefined, modelOverride: undefined });
});
});
@@ -1284,6 +1274,9 @@ describe('autopilot conductor', () => {
seriesId,
expect.objectContaining({ providerDefault: 'codex', modelDefault: 'gpt-x' }),
);
+ // The same values ride the retained start frame, so a client attaching
+ // mid-run can name what the run is spending on.
+ expect(run.startPayload).toMatchObject({ type: 'start', provider: 'codex', model: 'gpt-x' });
});
it('lets a per-run provider override beat the series-configured provider', async () => {
@@ -1294,7 +1287,7 @@ describe('autopilot conductor', () => {
const run = autopilot.__testing.runs.get(seriesId);
expect(run.options.providerOverride).toBe('claude');
// codex's model must NOT ride along to claude.
- expect(run.options.modelOverride).toBeNull();
+ expect(run.options.modelOverride).toBeUndefined();
});
it('pauses for review when arc verify never converges', async () => {
diff --git a/server/services/pipeline/seriesAutopilot/config.js b/server/services/pipeline/seriesAutopilot/config.js
index f05687c2f3..f5cd291de4 100644
--- a/server/services/pipeline/seriesAutopilot/config.js
+++ b/server/services/pipeline/seriesAutopilot/config.js
@@ -189,25 +189,20 @@ export function resolveAutopilotRevision(options = {}, settings = null) {
// `providerOverride`/`modelOverride` wins (the Options picker, or the scheduler
// mapping a schedule's provider/model); otherwise the run inherits the series'
// own configured `series.llm` — the provider named in the series header, which
-// every other Pipeline LLM action already honors via resolveSeriesLlmOverride.
-// Both absent leaves them undefined, so stageRunner resolves stage pin → active
-// provider as before.
+// every other Pipeline LLM action already honors. Both absent stays undefined,
+// so stageRunner resolves stage pin → active provider as before. The precedence
+// (including why a foreign model id is dropped) lives in the shared
+// `resolveSeriesLlmOverride`; this only renames its keys to the run-option ones.
//
// Threaded as SOFT defaults (`providerDefault`/`modelDefault`, see
// session.js#providerOverrideOpts), so a deliberate per-stage pin on the Prompts
// page still wins and an unavailable provider falls through instead of throwing.
-//
-// A model id is provider-specific, so the series model is only inherited when
-// the effective provider is still the series provider — an override that names a
-// different provider without a model resolves that provider's own default.
-// Returns `null` (not `undefined`) for an unresolved value so the stamped run
-// options can be read back for display without re-deriving the fallback chain.
export function resolveAutopilotLlm(options = {}, series = null) {
const { provider, model } = resolveSeriesLlmOverride(series, {
overrideProvider: options?.providerOverride,
overrideModel: options?.modelOverride,
});
- return { providerOverride: provider || null, modelOverride: model || null };
+ return { providerOverride: provider, modelOverride: model };
}
// Effective "produce draft visuals?" decision. The `target` option overrides
diff --git a/server/services/pipeline/seriesAutopilot/orchestrator.js b/server/services/pipeline/seriesAutopilot/orchestrator.js
index 722479111e..0aabd96643 100644
--- a/server/services/pipeline/seriesAutopilot/orchestrator.js
+++ b/server/services/pipeline/seriesAutopilot/orchestrator.js
@@ -20,7 +20,7 @@ import {
resolveAutopilotProduceTeaser, resolveAutopilotRevision, resolveAutopilotLlm,
} from './config.js';
import { VISUAL_DRAFT_ENABLED, summarizePlanCost } from './convergence.js';
-import { broadcast, persistMarker, clearPauseNotice, notifyPause, fileGap, scheduleCleanup } from './session.js';
+import { broadcast, broadcastStart, persistMarker, clearPauseNotice, notifyPause, fileGap, scheduleCleanup } from './session.js';
import { resolveNextStep } from './stepResolver.js';
import { editorialSubsetIds } from './editorialSteps.js';
import { dispatchStep } from './dispatch.js';
@@ -145,6 +145,16 @@ export async function startSeriesAutopilot(sId, options = {}) {
};
runs.set(sId, record);
+ // Shared `start` frame for both modes. `provider`/`model` are the run's
+ // resolved soft defaults — what the panel shows as "this run calls X / Y"; a
+ // stage pinned on the Prompts page still overrides them for that stage.
+ const startFrame = (target, extra = {}) => ({
+ type: 'start', runId, mode, target,
+ provider: runOptions.providerOverride ?? null,
+ model: runOptions.modelOverride ?? null,
+ ...extra,
+ });
+
// Fire-and-forget coordinator. The try/catch is the permitted boundary use —
// an unhandled LLM rejection here would crash the process on Node ≥15.
(async () => {
@@ -161,10 +171,7 @@ export async function startSeriesAutopilot(sId, options = {}) {
const editorialLlmCheckCount = checkPlan ? checkPlan.checks.filter((c) => c.kind === 'llm').length : undefined;
const plan = buildDryRunPlan(series, issues, runOptions, { editorialLlmCheckCount });
const planTotals = summarizePlanCost(plan);
- broadcast(sId, {
- type: 'start', runId, mode, target: series.targetFormat, plan, planTotals,
- provider: runOptions.providerOverride, model: runOptions.modelOverride,
- });
+ broadcastStart(sId, startFrame(series.targetFormat, { plan, planTotals }));
// Carry the plan on the terminal frame too: a dry-run emits start +
// complete synchronously, often before the client attaches, and
// attachSseClient replays only the LAST frame — so the plan would be
@@ -176,13 +183,7 @@ export async function startSeriesAutopilot(sId, options = {}) {
// EXECUTE.
const series0 = await getSeries(sId);
- // The `provider`/`model` on the start frame are the run's resolved soft
- // defaults — what the panel shows as "this run calls X / Y". A stage
- // pinned on the Prompts page still overrides them for that stage.
- broadcast(sId, {
- type: 'start', runId, mode, target: series0.targetFormat,
- provider: runOptions.providerOverride, model: runOptions.modelOverride,
- });
+ broadcastStart(sId, startFrame(series0.targetFormat));
await persistMarker(sId, { status: 'running', runId, currentStep: null, residualFindings: [], lastError: null });
// A resume is a fresh start: drop any stale pause banner up front so a run
// that completes/errors without re-pausing doesn't leave a dead resume link.
diff --git a/server/services/pipeline/seriesAutopilot/session.js b/server/services/pipeline/seriesAutopilot/session.js
index df1a3e771d..4e0580f482 100644
--- a/server/services/pipeline/seriesAutopilot/session.js
+++ b/server/services/pipeline/seriesAutopilot/session.js
@@ -22,15 +22,16 @@ export function isAutopilotActive(seriesId) {
return !!run && !run.finished;
}
-// Provider/model an IN-FLIGHT run resolved to (null when no run is active, or
-// when the run fell through to the install's active provider). The values ride
-// the `start` SSE frame too, but attachSseClient replays only the LAST frame —
-// so a client re-attaching mid-run would otherwise never learn which provider
-// the run is spending on. Read through the status route.
-export function activeRunLlm(seriesId) {
+// The `start` frame of an IN-FLIGHT run (null when none is active). Everything
+// a client needs to describe a run it didn't watch begin — mode (the dry-run
+// badge), target, the resolved run provider/model — lives on that frame, but
+// attachSseClient replays only the LAST payload, so a client attaching mid-run
+// never sees it. Kept whole (rather than rescuing one field at a time through
+// bespoke status keys) so a new start-frame field needs no new plumbing.
+export function activeRunStart(seriesId) {
const run = runs.get(seriesId);
if (!run || run.finished) return null;
- return { provider: run.options?.providerOverride || null, model: run.options?.modelOverride || null };
+ return run.startPayload || null;
}
export function attachClient(seriesId, res) {
@@ -70,6 +71,14 @@ export function broadcast(seriesId, payload) {
}
}
+// Broadcast the run's `start` frame AND retain it on the run record, so a
+// client attaching mid-run can still read it back via `activeRunStart`.
+export function broadcastStart(seriesId, payload) {
+ const run = runs.get(seriesId);
+ if (run) run.startPayload = payload;
+ broadcast(seriesId, payload);
+}
+
export function scheduleCleanup(seriesId, record) {
record.cleanupTimer = setTimeout(() => {
if (runs.get(seriesId) !== record) return;
diff --git a/server/services/pipeline/seriesAutopilot/state.js b/server/services/pipeline/seriesAutopilot/state.js
index 0c57b53037..909a8e35ec 100644
--- a/server/services/pipeline/seriesAutopilot/state.js
+++ b/server/services/pipeline/seriesAutopilot/state.js
@@ -6,8 +6,10 @@
import { EventEmitter } from 'events';
-// runs: Map<seriesId, { runId, clients[], lastPayload, cancelRequested, finished,
-// cleanupTimer, startedAt, mode, options, runState, activeChild }>
+// runs: Map<seriesId, { runId, clients[], lastPayload, startPayload, cancelRequested,
+// finished, cleanupTimer, startedAt, mode, options, runState, activeChild }>
+// `startPayload` is the run's `start` frame, retained so a client attaching
+// mid-run can still read it (SSE replay only carries `lastPayload`).
export const runs = new Map();
// In-process progress bus (CDO Phase 3, #2185). Every SSE frame the run