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

address review (codex): deliver dry-run plan to late SSE subscribers

[._.]/ Adam Eivy16b7999e73ae
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index 01e274b589..5c02ff4e19 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -120,11 +120,15 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
return () => { canceled = true; };
}, [seriesId]);
- // Capture dry-run plan + mode off the start frame.
+ // 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);
if (Array.isArray(latest.plan)) setPlan(latest.plan);
+ } else if (latest?.type === 'complete' && latest.dryRun && Array.isArray(latest.plan)) {
+ setPlan(latest.plan);
}
}, [latest]);
diff --git a/client/src/components/pipeline/AutopilotPanel.test.jsx b/client/src/components/pipeline/AutopilotPanel.test.jsx
index a9bb3588d4..20cf72fb0e 100644
--- a/client/src/components/pipeline/AutopilotPanel.test.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.test.jsx
@@ -95,6 +95,14 @@ describe('AutopilotPanel', () => {
expect(screen.getByRole('button', { name: /stop/i })).toBeInTheDocument();
});
+ it('renders a dry-run plan delivered only on the terminal frame', async () => {
+ sseLatest = { type: 'complete', dryRun: true, runId: 'r1', plan: [{ kind: 'verifyArc', count: 1 }, { kind: 'visualDraft', count: 2, note: 'draft' }] };
+ renderPanel({ id: 's1', targetFormat: 'comic' });
+ await waitFor(() => expect(getPipelineAutopilotStatus).toHaveBeenCalled());
+ expect(await screen.findByText(/Dry-run plan/i)).toBeInTheDocument();
+ expect(screen.getByText(/Verifying arc/i)).toBeInTheDocument();
+ });
+
it('renders canon readiness gaps with a link to the issue Nouns page', async () => {
getPipelineSeriesCanonReadiness.mockResolvedValue({
ready: false,
diff --git a/server/services/pipeline/seriesAutopilot.js b/server/services/pipeline/seriesAutopilot.js
index c510f3b779..f9ffb4dde2 100644
--- a/server/services/pipeline/seriesAutopilot.js
+++ b/server/services/pipeline/seriesAutopilot.js
@@ -838,7 +838,11 @@ export async function startSeriesAutopilot(sId, options = {}) {
const issues = await listIssues({ seriesId: sId });
const plan = buildDryRunPlan(series, issues, options);
broadcast(sId, { type: 'start', runId, mode, target: series.targetFormat, plan });
- broadcast(sId, { type: 'complete', runId, dryRun: true, steps: plan.length, completedAt: new Date().toISOString() });
+ // 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
+ // lost if it lived solely on the start frame.
+ broadcast(sId, { type: 'complete', runId, dryRun: true, steps: plan.length, plan, completedAt: new Date().toISOString() });
console.log(`🧭 autopilot dry-run — series=${sId.slice(0, 12)} steps=${plan.length}`);
return;
}
diff --git a/server/services/pipeline/seriesAutopilot.test.js b/server/services/pipeline/seriesAutopilot.test.js
index b45303bb93..64423a66e1 100644
--- a/server/services/pipeline/seriesAutopilot.test.js
+++ b/server/services/pipeline/seriesAutopilot.test.js
@@ -335,6 +335,10 @@ describe('autopilot conductor', () => {
const last = autopilot.__testing.runs.get(seriesId)?.lastPayload;
expect(last?.type).toBe('complete');
expect(last?.dryRun).toBe(true);
+ // plan rides the terminal frame too, so a late SSE subscriber (the common
+ // case for a fast dry-run) still gets it via lastPayload replay.
+ expect(Array.isArray(last?.plan)).toBe(true);
+ expect(last.plan.length).toBeGreaterThan(0);
expect(arcSpies.generateArcOverview).not.toHaveBeenCalled();
expect(arcSpies.verifyArc).not.toHaveBeenCalled();
});