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): send edited rounds as per-run overrides so a failed save can't drop them

[._.]/ Adam Eivya034a1194237
diff --git a/client/src/components/pipeline/AutopilotPanel.jsx b/client/src/components/pipeline/AutopilotPanel.jsx
index c3ae994fc5..8bb87edf0e 100644
--- a/client/src/components/pipeline/AutopilotPanel.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.jsx
@@ -245,16 +245,18 @@ export default function AutopilotPanel({ series, onSeriesUpdate, onIssuesUpdate
const start = useCallback(async () => {
setStarting(true);
setPlan(null);
- // Persist ONLY the gates the user edited (clamped), then start with no per-run
- // round overrides — the server resolves the run from the saved setting.
- // Persisting an untouched field would clobber its on-disk value with a display
- // default; omitting it lets patchSettingsSlice's merge preserve it. Awaiting
- // the persist closes the persist→read race.
- const roundPatch = {};
- if (arcEditedRef.current) roundPatch.maxArcVerifyRounds = clampRound(arcRounds, DEFAULT_ARC_ROUNDS);
- if (editorialEditedRef.current) roundPatch.maxEditorialRounds = clampRound(editorialRounds, DEFAULT_EDITORIAL_ROUNDS);
- if (Object.keys(roundPatch).length) await persistRounds(roundPatch);
- const res = await startPipelineAutopilot(seriesId, { includeVisual, fileGaps }, { silent: true })
+ // Collect ONLY the gates the user edited (clamped, real values — never the
+ // display defaults of untouched gates, which would mask a saved setting). Send
+ // them as per-run overrides AND persist them: the override makes the edit
+ // effective for THIS run even if the save fails (persist is best-effort,
+ // server precedence is per-run → setting → default), and the persist makes it
+ // the saved default for next time. Untouched gates send nothing, so the server
+ // resolves them from the persisted setting.
+ const roundOverrides = {};
+ if (arcEditedRef.current) roundOverrides.maxArcVerifyRounds = clampRound(arcRounds, DEFAULT_ARC_ROUNDS);
+ if (editorialEditedRef.current) roundOverrides.maxEditorialRounds = clampRound(editorialRounds, DEFAULT_EDITORIAL_ROUNDS);
+ if (Object.keys(roundOverrides).length) await persistRounds(roundOverrides);
+ const res = await startPipelineAutopilot(seriesId, { includeVisual, fileGaps, ...roundOverrides }, { silent: true })
.catch((err) => { toast.error(err.message || 'Could not start autopilot'); return null; });
setStarting(false);
if (!res) return;
diff --git a/client/src/components/pipeline/AutopilotPanel.test.jsx b/client/src/components/pipeline/AutopilotPanel.test.jsx
index 440e1e904b..0ef3e7cce0 100644
--- a/client/src/components/pipeline/AutopilotPanel.test.jsx
+++ b/client/src/components/pipeline/AutopilotPanel.test.jsx
@@ -75,32 +75,32 @@ describe('AutopilotPanel', () => {
));
});
- it('persists edited rounds before starting and never sends them as overrides', async () => {
+ it('sends only edited rounds as overrides AND persists them; untouched gates omitted', async () => {
getSettings.mockResolvedValue({ pipelineEditorialChecks: { maxArcVerifyRounds: 6, maxEditorialRounds: 4 } });
renderPanel({ id: 's1', targetFormat: 'comic' });
await waitFor(() => expect(getPipelineAutopilotStatus).toHaveBeenCalled());
fireEvent.click(screen.getByRole('button', { name: /options/i }));
- // Wait for the persisted setting to populate the input, then edit it.
+ // Wait for the persisted setting to populate the input, then edit only arc.
await waitFor(() => expect(screen.getByLabelText('Arc verify rounds')).toHaveValue(6));
fireEvent.change(screen.getByLabelText('Arc verify rounds'), { target: { value: '9' } });
fireEvent.blur(screen.getByLabelText('Arc verify rounds'));
fireEvent.click(screen.getByRole('button', { name: /run autopilot/i }));
- // The edited value is persisted (clamped) and the start payload omits rounds.
- await waitFor(() => expect(patchSettingsSlice).toHaveBeenCalledWith(
+ // The edited value is BOTH persisted and sent as a per-run override (so it's
+ // effective even if the save fails), while the untouched editorial gate is
+ // sent in neither (server resolves it from the persisted setting).
+ await waitFor(() => expect(startPipelineAutopilot).toHaveBeenCalledWith(
+ 's1', { includeVisual: true, fileGaps: false, maxArcVerifyRounds: 9 }, { silent: true },
+ ));
+ expect(patchSettingsSlice).toHaveBeenCalledWith(
'pipelineEditorialChecks',
expect.objectContaining({ maxArcVerifyRounds: 9 }),
{ silent: true },
- ));
- // Only the edited gate is persisted — the untouched editorial value must NOT
- // be written (its on-disk value is preserved by the merge).
+ );
expect(patchSettingsSlice).not.toHaveBeenCalledWith(
'pipelineEditorialChecks',
expect.objectContaining({ maxEditorialRounds: expect.anything() }),
expect.anything(),
);
- expect(startPipelineAutopilot).toHaveBeenCalledWith(
- 's1', { includeVisual: true, fileGaps: false }, { silent: true },
- );
});
it('clears to the default (not 0) when a round input is emptied', async () => {