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

fix: clear the hidden template posture when the next quick template pins none (#3651)

[._.]/ Adam Eivy00ddfb4a8ca5
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index 10e64b55d4..7000bb9197 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -200,6 +200,11 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
: {})
}));
setSlashdoCommand(template.slashdoCommand || '');
+ // Hidden posture, so it follows `slashdoCommand` (set unconditionally above)
+ // rather than the tri-state rule the three visible toggles use: with no UI
+ // control to reveal or correct it, a posture left over from a previous
+ // template would silently ride along on the next one the user picks.
+ setWorktreeChangesExpected(template.settings?.worktreeChangesExpected);
const settings = template.settings;
if (settings && typeof settings === 'object') {
// Only when the template also moves the app — otherwise the effect never
@@ -208,7 +213,6 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
if (settings.useWorktree !== undefined) setUseWorktree(settings.useWorktree);
if (settings.openPR !== undefined) setOpenPR(settings.openPR);
if (settings.simplify !== undefined) setSimplify(settings.simplify);
- if (settings.worktreeChangesExpected !== undefined) setWorktreeChangesExpected(settings.worktreeChangesExpected);
}
descriptionRef.current?.focus();
await api.applyCosTaskTemplate(template.id).catch(() => {});
diff --git a/client/src/components/cos/TaskAddForm.test.jsx b/client/src/components/cos/TaskAddForm.test.jsx
index be23fcdf0a..e9b5575a4d 100644
--- a/client/src/components/cos/TaskAddForm.test.jsx
+++ b/client/src/components/cos/TaskAddForm.test.jsx
@@ -173,4 +173,21 @@ describe('TaskAddForm quick templates — deliverable posture', () => {
const payload = await queueFromTemplate('My Template');
expect('worktreeChangesExpected' in payload).toBe(false);
});
+
+ // Unlike the three visible toggles, the posture is hidden state — so picking a
+ // posture-pinning template and then a plain one must CLEAR it, not leave the
+ // first template's deliverable riding along invisibly on the second.
+ it('clears a previously applied posture when the next template pins none', async () => {
+ const user = userEvent.setup();
+ render(<TaskAddForm providers={[]} apps={[]} onTaskAdded={vi.fn()} />);
+ await waitFor(() => expect(screen.getByText('Quick Templates')).toBeInTheDocument());
+ await user.click(screen.getByText('Quick Templates'));
+ await user.click(screen.getByText('Cut a Release'));
+ await waitFor(() => expect(api.applyCosTaskTemplate).toHaveBeenCalled());
+ await user.click(screen.getByText('My Template'));
+ await waitFor(() => expect(api.applyCosTaskTemplate).toHaveBeenCalledTimes(2));
+ await user.click(screen.getByRole('button', { name: /^Add$/ }));
+ await waitFor(() => expect(api.addCosTask).toHaveBeenCalled());
+ expect('worktreeChangesExpected' in api.addCosTask.mock.calls.at(-1)[0]).toBe(false);
+ });
});