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: thread worktreeChangesExpected through the CoS quick-template surface (#3651)

[._.]/ Adam Eivy198adfefef69
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.md
index a3c832c40e..7d854da063 100644
--- a/.changelog/NEXT.md
+++ b/.changelog/NEXT.md
@@ -44,3 +44,5 @@
- **Your PII vault stays on one machine — permanently, by decision.** The Privacy Center's vault, organization registry, change-of-address inventory and broker opt-out ledger were always machine-local, but that was recorded as a feature not yet built, which left the door open to syncing them to your other PortOS machines later. It is now a documented guarantee: none of it federates, and none of it ever will without a new decision record superseding this one. The reasoning is written up in full — chiefly that PortOS's peer-sync was built for creative work rather than identity data, that the display masks (`••••1234`, `j•••@example.com`) are readable even when the underlying values are encrypted, and that copying one encryption key to several machines would widen the exposure of every one of them. If you want the vault on a second machine, restore a backup and copy the key by hand — a deliberate act, rather than something that happens quietly in the background. Managing PII for other household members is unaffected and remains planned.
- **Peer-sync pull requests now honor the per-peer sharing settings the push direction already respected.** `GET /api/peer-sync/record` served any subscribable record by id with no notion of who was asking, so a peer configured for "universes only" — or one with sync switched off entirely — could still read every series, media collection, and writers-room record; the record/library/CoS-history/CoS-task manifests and the CoS agent-archive bytes had the same shape. Every outbound hop now identifies this install with an `X-PortOS-Instance-Id` header attached centrally in `peerFetch`, and the receiver resolves that id against its peer registry and runs the *same* `peerAllowsOutbound` + `peerHasCategory` predicates the push path uses, so the two directions can't drift apart again. Because peers upgrade independently this ships warn-first: a pull from an unidentified, unknown, or disallowed caller is still served and logs one `⚠️` per caller per restart. The new **Settings → Sharing → "Enforce per-peer sharing settings on pull requests"** toggle (`federation.strictPullAuthorization`, default off) turns those into a 403 — the default flips in a later release once peers have had time to update. Note that the instance id is *identification*, not authentication; the instance password remains the actual access control.
+
+- A `/do:review` (or `/do:scan`, `/do:plan-task`, `/do:replan`) run queued from the **CoS quick templates** is no longer failed as `idle-no-changes`. The deliverable posture each slashdo workflow declares on its catalog entry reached the Agent Operations buttons but was silently dropped by the quick-template form, which read only the three run-shape toggles off a template's settings block — so the exact clean-tree misfire that posture exists to prevent still happened from the other surface. The flag now rides the template through the form as hidden state and into the create-task payload, and the strict template-settings schema accepts it so a user can save such a template back without a 400.
diff --git a/client/src/components/cos/TaskAddForm.jsx b/client/src/components/cos/TaskAddForm.jsx
index 86e64d70ac..10e64b55d4 100644
--- a/client/src/components/cos/TaskAddForm.jsx
+++ b/client/src/components/cos/TaskAddForm.jsx
@@ -24,6 +24,10 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
const [useWorktree, setUseWorktree] = useState(false);
const [openPR, setOpenPR] = useState(false);
const [simplify, setSimplify] = useState(true);
+ // Hidden run-shape state, never a user-facing toggle: the slashdo catalog's
+ // deliverable posture (#3636/#3651). `undefined` = the form pins no opinion,
+ // so the server keeps its own default. Only a slashdo-backed template sets it.
+ const [worktreeChangesExpected, setWorktreeChangesExpected] = useState(undefined);
const [prCompletion, setPrCompletion] = useState(DEFAULT_PR_COMPLETION);
const [reviewers, setReviewers] = useState(DEFAULT_REVIEWERS);
const [reviewUsernames, setReviewUsernames] = useState([]);
@@ -204,6 +208,7 @@ 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(() => {});
@@ -330,6 +335,9 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
useWorktree,
openPR: useWorktree && openPR,
simplify,
+ // Omitted entirely when no template pinned a posture — sending `undefined`
+ // would be indistinguishable from a deliberate `false` on the wire.
+ ...(worktreeChangesExpected !== undefined ? { worktreeChangesExpected } : {}),
prCompletion: useWorktree && openPR ? prCompletion : undefined,
// One gate for every per-reviewer field: they only apply when this task
// opens a PR that PortOS reviews before merging.
@@ -366,6 +374,9 @@ export default function TaskAddForm({ providers, apps, onTaskAdded, compact = fa
// Only clear form inputs after successful submission
setNewTask(t => ({ ...t, description: '' }));
setSlashdoCommand('');
+ // The posture belongs to the workflow the cleared template pinned, so it
+ // must not survive into the next, template-less task.
+ setWorktreeChangesExpected(undefined);
setScreenshots([]);
setAttachments([]);
diff --git a/client/src/components/cos/TaskAddForm.test.jsx b/client/src/components/cos/TaskAddForm.test.jsx
index dd07020f01..be23fcdf0a 100644
--- a/client/src/components/cos/TaskAddForm.test.jsx
+++ b/client/src/components/cos/TaskAddForm.test.jsx
@@ -9,7 +9,8 @@ const api = vi.hoisted(() => ({
// Back the reviewer table's Model column (useReviewerModelOptions).
getLocalLlmStatus: vi.fn(),
getProviders: vi.fn(),
- applyCosTaskTemplate: vi.fn()
+ applyCosTaskTemplate: vi.fn(),
+ addCosTask: vi.fn()
}));
vi.mock('../../services/api', () => api);
@@ -120,3 +121,56 @@ describe('TaskAddForm quick templates', () => {
expect(screen.getByLabelText(/target application/i)).toHaveValue('example-app');
});
});
+
+// #3651: the slashdo catalog's deliverable posture (`worktreeChangesExpected`,
+// #3636) rides the quick-template `settings` block the same way the run-shape
+// toggles do, so a `/do:review` queued from a template doesn't get scored
+// `idle-no-changes` by the TUI reaper for its (correct) clean tree.
+describe('TaskAddForm quick templates — deliverable posture', () => {
+ // Mirrors WORKFLOW_REPORTS_NO_CODE / WORKFLOW_OWNS_ITS_OWN_GIT in
+ // server/lib/slashdoCatalog.js, which taskTemplates.js copies verbatim.
+ const REPORTS_NO_CODE = { useWorktree: false, openPR: false, simplify: false, worktreeChangesExpected: false };
+ const OWNS_ITS_OWN_GIT = { useWorktree: false, openPR: false, simplify: false, worktreeChangesExpected: true };
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ api.getCodeReviewDefaults.mockResolvedValue(null);
+ api.getLocalLlmStatus.mockResolvedValue({ ollama: { models: [] }, lmstudio: { models: [] } });
+ api.getProviders.mockResolvedValue({ providers: [] });
+ api.applyCosTaskTemplate.mockResolvedValue({ success: true });
+ api.addCosTask.mockResolvedValue({ success: true });
+ api.getCosPopularTemplates.mockResolvedValue({
+ templates: [
+ { id: 'builtin-do-review', name: 'Review Changes', icon: '🔍', slashdoCommand: 'review', description: 'Review the changes', settings: REPORTS_NO_CODE, isBuiltin: true },
+ { id: 'builtin-do-release', name: 'Cut a Release', icon: '🚀', slashdoCommand: 'release', description: 'Cut a release', settings: OWNS_ITS_OWN_GIT, isBuiltin: true },
+ { id: 'user-abc', name: 'My Template', description: 'Do the thing', isBuiltin: false }
+ ]
+ });
+ });
+
+ const queueFromTemplate = async (templateName) => {
+ 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(templateName));
+ await waitFor(() => expect(api.applyCosTaskTemplate).toHaveBeenCalled());
+ await user.click(screen.getByRole('button', { name: /^Add$/ }));
+ await waitFor(() => expect(api.addCosTask).toHaveBeenCalled());
+ return api.addCosTask.mock.calls.at(-1)[0];
+ };
+
+ it.each([
+ ['Review Changes', false],
+ ['Cut a Release', true]
+ ])('carries %s posture into the create-task payload ⇒ worktreeChangesExpected %s', async (templateName, expected) => {
+ const payload = await queueFromTemplate(templateName);
+ expect(payload.worktreeChangesExpected).toBe(expected);
+ expect(payload.slashdoCommand).toBe(templateName === 'Review Changes' ? 'review' : 'release');
+ });
+
+ it('omits the key entirely for a template that pins no posture', async () => {
+ const payload = await queueFromTemplate('My Template');
+ expect('worktreeChangesExpected' in payload).toBe(false);
+ });
+});
diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.js
index ae60cf7064..a2de7daca7 100644
--- a/server/lib/cosValidation.js
+++ b/server/lib/cosValidation.js
@@ -930,6 +930,15 @@ export const createCosTaskSchema = z.object({
v => v === 'true' ? true : v === 'false' ? false : v,
z.boolean().optional()
),
+ // The slashdo catalog's deliverable posture (#3636): whether this run is
+ // EXPECTED to leave commits in its worktree. A report-shaped workflow
+ // (`/do:review`) carries `false` so the TUI idle reaper doesn't score its
+ // correctly-clean tree as `idle-no-changes`. Carried onto the task by
+ // `cosTaskStore.js` only on a strict boolean — absent means "no opinion".
+ worktreeChangesExpected: z.preprocess(
+ v => v === 'true' ? true : v === 'false' ? false : v,
+ z.boolean().optional()
+ ),
reviewLoop: z.preprocess(
v => v === 'true' ? true : v === 'false' ? false : v,
z.boolean().optional()
@@ -1152,10 +1161,14 @@ export const generateWeeklyDigestSchema = z.object({
// a tri-state: ABSENT means "leave the form's current toggle alone", `false`
// means "turn it off". Collapsing absent to false would make every template
// silently clear toggles it never intended to touch.
+// `.strict()`, so every run-shape key a built-in (or user-saved) template may
+// carry must be listed here — including the catalog's deliverable posture
+// `worktreeChangesExpected`, or saving such a template 400s.
export const taskTemplateSettingsSchema = z.object({
useWorktree: z.boolean().optional(),
openPR: z.boolean().optional(),
simplify: z.boolean().optional(),
+ worktreeChangesExpected: z.boolean().optional(),
}).strict();
export const createTaskTemplateSchema = z.object({
diff --git a/server/lib/cosValidation.test.js b/server/lib/cosValidation.test.js
index f98ac75340..b51384d0a7 100644
--- a/server/lib/cosValidation.test.js
+++ b/server/lib/cosValidation.test.js
@@ -22,6 +22,7 @@ import {
buildReviewerEffortNote,
sanitizeTaskMetadata,
codeReviewSettingsSchema,
+ taskTemplateSettingsSchema,
} from './cosValidation.js';
import { LOCAL_AGENT_REVIEWERS } from './slashdoInvocation.js';
import { EFFORT_LEVELS, CLAUDE_EFFORT_LEVELS, CODEX_EFFORT_LEVELS, ANTIGRAVITY_EFFORT_LEVELS } from './providerModels.js';
@@ -87,6 +88,30 @@ describe('cosValidation job taskMetadata.worktreeChangesExpected (#3102)', () =>
});
});
+describe('cosValidation quick-template deliverable posture (#3651)', () => {
+ it('taskTemplateSettingsSchema accepts worktreeChangesExpected (the block is .strict())', () => {
+ // taskTemplates.js copies the slashdo catalog posture onto each built-in
+ // template verbatim; a user saving such a template back would 400 if the
+ // strict settings block didn't declare the key.
+ const parsed = taskTemplateSettingsSchema.parse({ useWorktree: false, openPR: false, simplify: false, worktreeChangesExpected: false });
+ expect(parsed).toEqual({ useWorktree: false, openPR: false, simplify: false, worktreeChangesExpected: false });
+ expect(taskTemplateSettingsSchema.safeParse({ worktreeChangesExpected: true }).success).toBe(true);
+ expect(taskTemplateSettingsSchema.safeParse({ worktreeChangesExpected: 'nope' }).success).toBe(false);
+ expect(taskTemplateSettingsSchema.safeParse({ bogus: true }).success).toBe(false);
+ });
+
+ it('create-task accepts the boolean and the form-encoded string forms', () => {
+ expect(createCosTaskSchema.parse({ description: 'x', worktreeChangesExpected: false }).worktreeChangesExpected).toBe(false);
+ expect(createCosTaskSchema.parse({ description: 'x', worktreeChangesExpected: true }).worktreeChangesExpected).toBe(true);
+ expect(createCosTaskSchema.parse({ description: 'x', worktreeChangesExpected: 'false' }).worktreeChangesExpected).toBe(false);
+ expect(createCosTaskSchema.parse({ description: 'x', worktreeChangesExpected: 'true' }).worktreeChangesExpected).toBe(true);
+ // Absent must stay absent — cosTaskStore only stamps metadata on a strict
+ // boolean, so "no opinion" has to survive as undefined.
+ expect(createCosTaskSchema.parse({ description: 'x' }).worktreeChangesExpected).toBeUndefined();
+ expect(createCosTaskSchema.safeParse({ description: 'x', worktreeChangesExpected: 'nope' }).success).toBe(false);
+ });
+});
+
describe('cosValidation reviewer CLI binaries', () => {
// The bug this exists to prevent: `antigravity` is the stored, federated
// reviewer identity, but the shipped executable is `agy` — no `antigravity`