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
feat: add non-worktree task completion choice
[._.]/ Adam Eivy205391c0681c
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsxindex 87f2ad17f4..338501f512 100644--- a/client/src/components/cos/TaskAddForm.jsx+++ b/client/src/components/cos/TaskAddForm.jsx@@ -53,6 +53,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa// An app that explicitly pins either flag false still wins — see the// app-defaults effect below, which distinguishes absent from `false`.const [useWorktree, setUseWorktree] = useState(true);+ const [whenDone, setWhenDone] = useState('leave-uncommitted');const [openPR, setOpenPR] = useState(true);const [simplify, setSimplify] = useState(true);const [planOnly, setPlanOnly] = useState(false);@@ -508,6 +509,7 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faslashdoArgs: planOnly ? '--yes' : undefined,createJiraTicket: planOnly ? false : createJiraTicket,useWorktree: planOnly ? false : useWorktree,+ whenDone: planOnly || useWorktree ? undefined : whenDone,openPR: planOnly ? false : useWorktree && openPR,simplify: planOnly ? false : simplify,// Omitted entirely when no template pinned a posture — sending `undefined`@@ -785,6 +787,15 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = faWorktree</span></label>+ {!useWorktree && (+ <label htmlFor="task-when-done" className="flex items-center gap-2 py-1 basis-full sm:basis-auto">+ <span className="text-sm text-gray-400">When done</span>+ <select id="task-when-done" value={whenDone} onChange={(e) => setWhenDone(e.target.value)} className="min-w-52 rounded border border-port-border bg-port-bg px-2 py-1 text-sm text-white focus:border-port-accent focus:outline-hidden">+ <option value="leave-uncommitted">Leave code uncommitted</option>+ <option value="commit-push">Commit and push to default branch</option>+ </select>+ </label>+ )}<label className="flex items-center gap-2 cursor-pointer select-none whitespace-nowrap py-1"><inputtype="checkbox"diff --git a/client/src/components/cos/TaskAddForm.test.jsx b/client/src/components/cos/TaskAddForm.test.jsxindex f272228b6c..7138167b9b 100644--- a/client/src/components/cos/TaskAddForm.test.jsx+++ b/client/src/components/cos/TaskAddForm.test.jsx@@ -195,6 +195,21 @@ describe('TaskAddForm responsive layout', () => {});});+ it('offers and submits the non-worktree completion choice', async () => {+ const user = userEvent.setup();+ api.addCosTask.mockResolvedValue({ success: true });+ render(<TaskAddForm providers={[]} apps={[]} onTaskAdded={vi.fn()} />);++ await user.click(worktreeToggle());+ expect(screen.getByLabelText('When done')).toHaveValue('leave-uncommitted');+ await user.selectOptions(screen.getByLabelText('When done'), 'commit-push');+ await user.type(screen.getByPlaceholderText('Task description *'), 'Update default branch');+ await user.click(screen.getByRole('button', { name: /^Add$/ }));++ await waitFor(() => expect(api.addCosTask).toHaveBeenCalled());+ expect(api.addCosTask.mock.calls.at(-1)[0]).toMatchObject({ useWorktree: false, whenDone: 'commit-push' });+ });+it.each([['PLAN.md', 'plan', 'plan'],['JIRA', 'jira', 'jira'],diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.jsindex 61566b3e13..560303876c 100644--- a/server/services/agentPromptBuilder.js+++ b/server/services/agentPromptBuilder.js@@ -320,6 +320,7 @@ export async function buildAgentPrompt(task, config, workspaceDir, worktreeInfo// Build worktree context section if applicableconst willOpenPR = isTruthyMetaFn(task.metadata?.openPR);+ const whenDone = task.metadata?.whenDone === 'commit-push' ? 'commit-push' : 'leave-uncommitted';const claimFlow = isClaimFlowTask(task, isTruthyMetaFn);const prCompletion = resolvePrCompletion(task.metadata);// A discard (reasoning-only) worktree: the agent reasons in it but it's thrown@@ -659,7 +660,7 @@ ${skillSection ? `## Task-Type Skill Guidelines\n\n${skillSection}\n` : ''}${too- Never update the PortOS changelog (\`.changelog/\`) for work on managed apps — the PortOS changelog tracks PortOS core changes only${(() => {const bullet = buildCompletionGuidelineBullet({- isReadOnly: isTruthyMetaFn(task.metadata?.readOnly),+ isReadOnly: isTruthyMetaFn(task.metadata?.readOnly), whenDone,isTui, tuiCompletionCommand, slashdoFree: isTui && !canRunSlashCommands,worktreeInfo, willOpenPR, prCompletion, discardWorktree, noCodeOutput, noChangeSuccess,leavePrOpen: leavesPrForHuman(task),diff --git a/server/services/cosTaskStore.js b/server/services/cosTaskStore.jsindex 288d469b31..6ce9cab889 100644--- a/server/services/cosTaskStore.js+++ b/server/services/cosTaskStore.js@@ -379,6 +379,7 @@ export async function addTask(taskData, taskType = 'user', { raw = false, ignoreelse if (taskData.useWorktree === false) metadata.useWorktree = false;if (taskData.openPR === true) metadata.openPR = true;else if (taskData.openPR === false) metadata.openPR = false;+ if (taskData.whenDone === 'commit-push' || taskData.whenDone === 'leave-uncommitted') metadata.whenDone = taskData.whenDone;// Default a worktree-isolated USER task to opening a PR rather than// auto-merging straight to the default branch — an unreviewed agent commit// landing on main is the more dangerous default (see the local-model evaldiff --git a/server/services/promptSections/completion.js b/server/services/promptSections/completion.jsindex 12772499c3..fce7df9ce3 100644--- a/server/services/promptSections/completion.js+++ b/server/services/promptSections/completion.js@@ -44,7 +44,7 @@ function withNoChangeAuditGuidance(guidance, noChangeSuccess) {export function buildCompletionGuidelineBullet({isReadOnly, isTui, tuiCompletionCommand, slashdoFree = false,worktreeInfo, willOpenPR, prCompletion = PR_COMPLETIONS.MERGE_ON_GREEN, discardWorktree = false, noCodeOutput = false,- leavePrOpen = false, isPrFollowUp = false, claimFlow = false, noChangeSuccess = false,+ leavePrOpen = false, isPrFollowUp = false, claimFlow = false, noChangeSuccess = false, whenDone = 'leave-uncommitted',}) {// A PR follow-up (review-loop or merge-only) already carries its own PRIMARY// OBJECTIVE section with the full procedure, and its cleanup runs with@@ -100,7 +100,9 @@ export function buildCompletionGuidelineBullet({if (worktreeInfo) {return withNoChangeAuditGuidance('Your worktree branch will be automatically merged back to the source branch when your task completes — do NOT open a PR.', noChangeSuccess);}- return null;+ return whenDone === 'commit-push'+ ? 'Commit and push your changes to the default branch (see Git Hygiene below).'+ : 'Leave your code changes uncommitted in the default branch; do not commit or push.';}// One-line worktree note for a discard (reasoning-only) task, replacing the