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: don't lift a stale stage result onto another record, and gate Generate on an in-flight save
[._.]/ Adam Eivy22d070bb4fd3
diff --git a/client/src/components/pipeline/stages/TextStagePanel.jsx b/client/src/components/pipeline/stages/TextStagePanel.jsxindex 208ea7ad3a..2e9ced24e2 100644--- a/client/src/components/pipeline/stages/TextStagePanel.jsx+++ b/client/src/components/pipeline/stages/TextStagePanel.jsx@@ -179,7 +179,13 @@ export default function TextStagePanel({// started from, or when the result already matches what's in the editor.// A result that lands after the panel moved to another issue/stage is never// reviewed against the record now on screen.- if (activeKeyRef.current === requestKey && latestDraft !== baseline && latestDraft !== incoming) {+ if (activeKeyRef.current !== requestKey) {+ // The panel moved on while this ran. The run is persisted server-side, so+ // say so — but lifting it would patch whichever record is on screen NOW.+ toast.success(`${PIPELINE_STAGE_LABELS[stageId]} generated`);+ return;+ }+ if (latestDraft !== baseline && latestDraft !== incoming) {setPending({ key: requestKey, incoming });}onStageUpdate?.(stageId, result.stage);@@ -287,7 +293,9 @@ export default function TextStagePanel({<buttontype="button"onClick={outputDirty ? () => setConfirmRegenerate(true) : handleGenerate}- disabled={generating || actionsGated || !!activeDiff}+ // `saving` too: an in-flight save PATCH writes the same stage record+ // this run will overwrite when it lands.+ disabled={generating || actionsGated || saving || !!activeDiff}title={actionsGated? 'Saving settings…': (outputDirty ? 'You have unsaved edits — you’ll compare them against the new version first' : undefined)}diff --git a/client/src/components/pipeline/stages/TextStagePanel.test.jsx b/client/src/components/pipeline/stages/TextStagePanel.test.jsxindex c347446356..7d4f1e9cd2 100644--- a/client/src/components/pipeline/stages/TextStagePanel.test.jsx+++ b/client/src/components/pipeline/stages/TextStagePanel.test.jsx@@ -274,7 +274,8 @@ describe('TextStagePanel', () => {it('drops a result that lands after the panel moved to another record', async () => {let resolveGenerate;generatePipelineStage.mockReturnValue(new Promise((r) => { resolveGenerate = r; }));- const { rerender } = renderPanel(makeIssue({ status: 'ready', output: 'Saved idea text.' }));+ const onStageUpdate = vi.fn();+ const { rerender } = renderPanel(makeIssue({ status: 'ready', output: 'Saved idea text.' }), { onStageUpdate });await userEvent.click(screen.getByRole('button', { name: 'Generate' }));@@ -289,7 +290,7 @@ describe('TextStagePanel', () => {stageId="idea"seedPlaceholder="seed…"outputPlaceholder="output…"- onStageUpdate={() => {}}+ onStageUpdate={onStageUpdate}/>,);@@ -299,6 +300,20 @@ describe('TextStagePanel', () => {expect(screen.queryByRole('button', { name: /Use new version/i })).not.toBeInTheDocument();expect(screen.getByPlaceholderText('output…')).toHaveValue('Another idea entirely.');+ // Lifting it would patch whichever record is on screen now.+ expect(onStageUpdate).not.toHaveBeenCalled();+ });++ it('gates Generate on an in-flight save of the same stage record', async () => {+ updatePipelineIssue.mockReturnValue(new Promise(() => {}));+ renderPanel(makeIssue({ status: 'ready', output: 'Saved idea text.' }));++ // Seed-only edit: the output stays clean, so Generate is otherwise live.+ await userEvent.type(screen.getByPlaceholderText('seed…'), 'A seed.');+ await userEvent.click(screen.getByRole('button', { name: /Save edits/i }));++ await waitFor(() => expect(screen.getByRole('button', { name: 'Generate' })).toBeDisabled());+ expect(generatePipelineStage).not.toHaveBeenCalled();});it('lifts the generated stage to the parent even while the review is open', async () => {