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: run dependency-updates in an isolated worktree and ship bumps through a PR
[._.]/ Adam Eivy8fb59b7e0644
diff --git a/server/lib/README.md b/server/lib/README.mdindex 062a0c1f2a..0fcf368324 100644--- a/server/lib/README.md+++ b/server/lib/README.md@@ -640,7 +640,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub| `goalFidelityCalibration.js` | Goal-fidelity CALIBRATION contract — what happens when the follow-up investigation overturns a finding, i.e. the objective WAS delivered and the reviewer misjudged it. `GOAL_FIDELITY_CONTEXT_GAPS` is the closed vocabulary of what the reviewer could not see (`truncated-diff`, `truncated-objective`, `objective-omits-context`, `work-outside-diff`, `execution-step-misread`, `rubric-gap`, `other`), enforced ONLY by `normalizeGoalFidelityContextGap` (the report route takes a bounded string, so a near-miss gap name folds to `other` with its diagnosis intact instead of 400ing the report away). `GOAL_FIDELITY_REVIEW_SURFACES` addresses the reviewer's three context surfaces once — objective / diff / rubric — and `GOAL_FIDELITY_CONTEXT_GAP_FIXES` maps each gap onto one of them, so a rename cannot leave seven prose copies lying (`goalFidelityCalibration.pointers.test.js` walks the table against the real files). `goalFidelityCalibrationFingerprint(gap)` keys the dedup on the GAP alone, so many false positives from one blind spot fold into one fix instead of minting an agent each. `buildGoalFidelityCalibrationTask` composes the PortOS-side task body (including the do-not-disarm-the-detector contract) and `buildGoalFidelityFalsePositiveReportBlock` the `curl` instructions appended to a follow-up task, taking `apiBase` as an argument and the call shape from `agentApiToken.js`. I/O lives in `services/goalFidelityCalibration.js`. || `goalFidelityFollowUp.js` | Goal-fidelity FOLLOW-UP contract — what happens once the review HAS a finding, as opposed to what the finding is. `resolveGoalFidelityFollowUp(codeReview)` (`null` when neither action is configured; reads the RAW block, since a verdict already exists by the time this is asked), `normalizeGoalFidelityFollowUpTrigger` (shared with the settings projection so the form and the runtime cannot disagree), and `goalFidelityFollowUpApplies(review, trigger)` over `GOAL_FIDELITY_FOLLOW_UP_TRIGGERS` (`rethink` = only the verdict that holds a run, the default; `any-finding` also fires on the advisory `fix-first`). `goalFidelityFingerprint(task)` is the one dedup identity three parties share — the issue body marker (`goalFidelityIssueMarker` / `issueMatchesGoalFidelityMarker`), the tracker listing that reads it back, and the queued task fingerprint — keyed on taskType + app + objective slug so a perpetual task regenerating with a fresh id cannot re-file forever. Public issue markers hash that identity while matching legacy markers. `buildGoalFidelityIssue` requires a complete objective with verified tracker provenance and immutable diff references before publication; `buildGoalFidelityFollowUpTask` carries the finding issue snapshot and its resolution lifecycle. I/O and public-text scrubbing live in `services/goalFidelityFollowUp.js`. || `navManifest.js` | Single source of truth for nav (`⌘K` palette + voice). Add an entry when you add a page. Also `getNavPageForPath(pathname)` → `{ label, section, breadcrumb }` for the most specific command that owns a route (`null` for one nothing declares) — how user-facing copy NAMES a page it links to, instead of typing "Models → LLMs" beside the link and stranding it on the next move (#7414). `expandPageToken(text, runtime)` expands a `{page}` token in `text` using `getNavPageForPath(runtime?.manageUrl)`, falling back to generic prose rather than shipping a literal `{page}` (#7419). |-| `noChangeCompletion.js` | `permitsNoChangeCompletion(task)` — the single predicate for "this run may finish successfully with an empty branch": the persisted `noChangeSuccess` marker AND (`autonomousJob` OR `isInvestigation` OR built-in quality audit). Read by both the prompt builder and finalization so the agent is never told a contract finalize will not honour; whether the branch was really empty is the post-run `branchProvenEmpty` verdict. |+| `noChangeCompletion.js` | `permitsNoChangeCompletion(task)` — the single predicate for "this run may finish successfully with an empty branch": the persisted `noChangeSuccess` marker AND (`autonomousJob` OR `isInvestigation` OR built-in quality audit OR a type in the exported `NO_CHANGE_SCHEDULED_TYPES` allowlist — `dependency-updates`, whose ordinary outcome is "already current"; `taskSchedule.test.js` keeps the list and the schedule defaults' `noChangeSuccess` markers in parity). Read by both the prompt builder and finalization so the agent is never told a contract finalize will not honour; whether the branch was really empty is the post-run `branchProvenEmpty` verdict. || `noReplaceMove.js` | `moveWithoutReplace(from, to)` — publish a staged file into its final name WITHOUT ever clobbering an existing one. `fs.rename` silently replaces its destination, which is the wrong default for a derived artifact; this uses `link(2)` + `unlink(2)`, so an existing destination fails atomically with `MOVE_DEST_EXISTS` and both files survive. Refuses rather than degrading when the filesystem cannot express it (`MOVE_CROSS_DEVICE`, `MOVE_NO_REPLACE_UNSUPPORTED`) — a `stat`-then-`rename` fallback would be a race. Used by the rigging publication contract (`services/rigging/autoSkin.js`). || `personaTraitBlend.js` | Digital-twin persona trait-blending (M34 P7). Blends a persona's `traitAdjustments` against the base twin's communication profile + Big-Five into a "Communication Calibration" directive. A pure leaf — `client/src/lib/personaTraitBlend.js` re-exports it for the Personas UI preview. || `textUtils.js` | Pure dependency-free prose helpers. `isStr(v)` and `isNonBlankStr(v)` are the ONLY string predicates under `server/` (#6837) — the bare type check, and type check plus a non-empty `trim()` for ids, keys, hosts, model names and prose fields where whitespace-only is already invalid; the "no private string predicate or bounder" guard in `textUtils.test.js` fails the suite when a copy of either, or a `trimTo`-shaped bounder, is re-declared in any non-test source under `server/` or any source under `client/src/` (`client/src/lib/textUtils.js` re-exports both for the browser bundle). `countWords(text)` is the canonical whitespace-token count (`\S+`) and the only one — every server word count (Writers Room, lettering density, rapid reader, autobiography, script-video beats) and the client's (`client/src/lib/textUtils.js` re-exports it) resolve here, and the "no private countWords" guard in `textUtils.test.js` fails the suite when a re-spelled count (the whitespace-token match, a split-and-filter, or a helper under either conventional name) reappears in any non-test source under `server/` or any source under `client/src/`; the editorial prose-analysis checks deliberately count LETTER words instead, through `editorial/proseTics.js#tokenizeWords`, which owns that tokenizer the same way; `trimTo(value, max)` trims and bounds strings without coercing non-strings, and is safe for shared modules consumed by the browser; `escapeRegExp(value)` is the one to import instead of re-inlining the escape (the sibling guard in `textUtils.test.js` fails the suite when a copy reappears in any non-test source under `server/`, or in ANY source under `client/src/`, tests and `.jsx` included — `client/src/lib/textUtils.js` re-exports this module for the browser bundle); `trimToClause(v, max)` is its boundary-aware twin for PROSE fields — it backs off to the last sentence terminator, then the last clause boundary, then the last whole word, so a capped field never ends mid-thought (it lives here rather than in `storyBible.js`, which re-exports it, so the pure story-model leaves the browser bundle shares can cap prose without pulling `crypto` / `fileUtils`); `kebabCase(text)` is the canonical ASCII slug transform (PLAN.md `[slug]` ids and `planner:<model>` labels), and `truncateOnBoundary(slug, max)` is its bounder — back off to the last `-` at or before `max` so a slug a human reads (a PLAN.md id, the app segment of a CoS worktree directory) is never cut mid-word, which `trimTo` would reintroduce; `clampToCharLimit(text, max)` is `trimTo`'s reader-facing twin — it cuts on a sentence end (when one sits 60%+ into the allowance) or a word boundary rather than mid-word and returns `{ text, truncated }` so the caller can say the text was cut, which is what bounds an AI-enhanced render prompt to a backend's hard cap (reactor.inc fast-h3 rejects an over-length prompt outright). `firstLine(text)` is the first non-blank line, trimmed — the CoS task headline `addTask` dedupes on, declared here rather than in the task store so a closure-sensitive caller can reach it (`cosTaskStore.js` re-exports it). |diff --git a/server/lib/cosValidation.js b/server/lib/cosValidation.jsindex 82567028e5..8de7141c26 100644--- a/server/lib/cosValidation.js+++ b/server/lib/cosValidation.js@@ -978,9 +978,10 @@ const ALLOWED_TASK_METADATA_KEYS = [// against a GitHub/GitLab/JIRA work tracker files its proposals as issues and,// per the prompt, edits no application code, so a clean worktree is expected.'worktreeChangesExpected',- // Allows a PortOS-owned audit's verified-empty-branch contract to survive- // app task-type override sanitization. The finalizer also requires the- // autonomous-job marker and a live forge proof before honoring it.+ // Allows a verified-empty-branch contract to survive app task-type override+ // sanitization. The finalizer honors it only for the producers+ // lib/noChangeCompletion.js admits (autonomous job, investigation, catalog+ // audit, allow-listed scheduled type) and only with a live forge proof.'noChangeSuccess',// Audit-type toggle: file tracker issues (no code) vs implement the fix.// Dispatch stamps `noCodeOutput` when this is true. See server/lib/auditCatalog.js.diff --git a/server/lib/noChangeCompletion.js b/server/lib/noChangeCompletion.jsindex c8fa27ccec..535e9f90ca 100644--- a/server/lib/noChangeCompletion.js+++ b/server/lib/noChangeCompletion.js@@ -3,8 +3,9 @@** A task may complete successfully with an empty branch only when it opted in* (the persisted `noChangeSuccess` metadata marker) and is an autonomous job,- * investigation or built-in quality audit; whether the branch really was empty is `branchProvenEmpty`,- * decided after the run by the forge/branch check in agentFinalization.+ * investigation, built-in quality audit, or an allow-listed scheduled type;+ * whether the branch really was empty is `branchProvenEmpty`, decided after the+ * run by the forge/branch check in agentFinalization.** The prompt builder and finalization both read this one predicate, so the agent* is only told a clean no-op exit is allowed where finalize will honour it.@@ -12,9 +13,19 @@import { isAuditTaskType } from './auditCatalog.js';import { isTruthyMeta } from './metadataFlags.js';+// Scheduled types outside the audit catalog whose ordinary successful outcome is+// "nothing to change". Admission is by name, not by the marker alone, because+// `noChangeSuccess` survives schedule and per-app metadata edits+// (cosValidation.js allowlist): without the list, flipping it on any+// code-shipping type would let an agent that did nothing report success.+// `taskSchedule.test.js` holds the two in parity: a shipped default that carries+// the marker must be listed here, and every entry must ship the marker.+export const NO_CHANGE_SCHEDULED_TYPES = Object.freeze(new Set(['dependency-updates']));+export function permitsNoChangeCompletion(task) {const meta = task?.metadata;+ const scheduledType = meta?.analysisType || meta?.taskAnalysisType;return isTruthyMeta(meta?.noChangeSuccess)&& (isTruthyMeta(meta?.autonomousJob) || isTruthyMeta(meta?.isInvestigation)- || isAuditTaskType(meta?.analysisType || meta?.taskAnalysisType));+ || isAuditTaskType(scheduledType) || NO_CHANGE_SCHEDULED_TYPES.has(scheduledType));}diff --git a/server/services/agentFinalization.successCriteria.test.js b/server/services/agentFinalization.successCriteria.test.jsindex f0ba8726e7..590a5c0133 100644--- a/server/services/agentFinalization.successCriteria.test.js+++ b/server/services/agentFinalization.successCriteria.test.js@@ -390,6 +390,30 @@ describe('evaluateSuccessCriteria — commit criterion (#2344, #3637)', () => {expect(committedDuringRun).toHaveBeenCalledWith('/w', STARTED_AT);});+ // dependency-updates is not a catalog audit, but "every dependency is already+ // current" is its ordinary outcome, so its schedule default ships+ // `noChangeSuccess: true` and lib/noChangeCompletion.js admits the type by name.+ it('accepts a verified no-change result for a marked dependency-updates run', async () => {+ const task = {+ id: 'deps-1',+ taskType: 'internal',+ metadata: { analysisType: 'dependency-updates', useWorktree: true, openPR: true, noChangeSuccess: true }+ };+ expect(await evaluateSuccessCriteria({+ task, workspacePath: '/w', success: true, branchProvenEmpty: true, startedAt: STARTED_AT+ })).toBe(true);+ expect(committedDuringRun).not.toHaveBeenCalled();+ });++ it('does not extend the no-change exemption to other marked non-audit scheduled types', async () => {+ committedDuringRun.mockResolvedValueOnce(false);+ expect(await evaluateSuccessCriteria({+ task: { id: 'ideas-1', taskType: 'internal', metadata: { analysisType: 'feature-ideas', noChangeSuccess: true } },+ workspacePath: '/w', success: true, branchProvenEmpty: true, startedAt: STARTED_AT+ })).toBe(false);+ expect(committedDuringRun).toHaveBeenCalledWith('/w', STARTED_AT);+ });+it('does not let an unmarked task claim the no-change exemption', async () => {committedDuringRun.mockResolvedValueOnce(false);expect(await evaluateSuccessCriteria({diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex 2fd193b216..4b5e9bcea8 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -440,17 +440,26 @@ describe('taskPromptDefaults integrity snapshot', () => {// back into the default origin it was rendered with, so an uncustomized stored// copy must still read as shipped (and so upgrade). Hashing folds every origin// into one placeholder (see the custom-origin case above).- it.each(['claim-issue-jira', 'do-release', 'issue-reconcile', 'jira-status-report', 'user-action-review'])(+ // Each row may carry a [from, to] edit that undoes a post-token body change, so+ // the ACTUALLY shipped pre-token body is reconstructed rather than a synthetic+ // old-origin rendering of today's intentionally changed text.+ it.each([+ // claim-issue-jira: the handoff contract changed after the token swap.+ ['claim-issue-jira', ["After the reviewers finish, preserve the exact worktree, local `claim/<KEY>` branch and open MR/PR for the intentional human handoff. Do not invoke merged retirement while it remains unmerged.", "After the reviewers finish, run the worktree-only cleanup so the source checkout is left clean:\n ```bash\n cd {repoPath}\n git worktree remove \"${WORKTREE}\"\n ```\n Leave the local `claim/<KEY>` branch and the open MR/PR in place."]],+ // do-release v20 split Step 2's "Red CI" bullet to recognize a maintainer-admission hold.+ ['do-release', [/- A failing step that only says the run is[^\n]*\n- Red CI from the bump itself: check out the branch/, '- Red CI: check out the branch']],+ ['issue-reconcile'],+ ['jira-status-report'],+ ['user-action-review'],+ ])('%s: the pre-token body rendered with the default origin still reads as a shipped default',- (key) => {+ (key, edit) => {const current = DEFAULT_TASK_PROMPTS[key];expect(current).toContain('{portosApiUrl}');expect(current).not.toContain('localhost:5555');- // Reconstruct the actually shipped pre-cleanup Jira body, not a synthetic- // old-origin rendering of today's intentionally changed handoff contract.- const historical = key === 'claim-issue-jira'- ? current.replace("After the reviewers finish, preserve the exact worktree, local `claim/<KEY>` branch and open MR/PR for the intentional human handoff. Do not invoke merged retirement while it remains unmerged.", "After the reviewers finish, run the worktree-only cleanup so the source checkout is left clean:\n ```bash\n cd {repoPath}\n git worktree remove \"${WORKTREE}\"\n ```\n Leave the local `claim/<KEY>` branch and the open MR/PR in place.")- : current;+ const historical = edit ? current.replace(...edit) : current;+ // A row's edit must actually hit, or the case silently tests today's body.+ if (edit) expect(historical).not.toBe(current);const retired = historical.replaceAll('{portosApiUrl}', 'http://localhost:5555');expect(promptMatchesShippedDefault(retired, key)).toBe(true);},@@ -535,9 +544,9 @@ describe('taskPromptDefaults integrity snapshot', () => {// per package rather than trusting Phase 1's listing to have been complete.expect(current).toContain('owns the bump');expect(current).toContain('confirm per package');- // The task runs in the app's LIVE checkout (no useWorktree default), so repairing a- // bot branch has to happen in a throwaway worktree — a bare `gh pr checkout` there- // hijacks whatever branch the user is on.+ // Repairing a bot branch happens in a throwaway worktree, never in {repoPath} (the+ // app's live checkout, where a bare `gh pr checkout` hijacks whatever branch the+ // user is on) and never in this task's own worktree (reserved for Phase 2's bumps).// …namespaced per app, since {worktreesRoot} is shared across every managed app.// {appSlug} (not {appName}) is the segment that isolates them: it carries the// app id, so two managed apps sharing a name still get distinct directories.@@ -578,6 +587,26 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(PROMPT_VERSIONS['dependency-updates']).toBeGreaterThanOrEqual(7);});+ // v9: the schedule default pins `useWorktree: true` (locked), so the body must+ // describe the isolated worktree as the cwd — a prompt that still called the live+ // checkout "usual" would send a package-manager install into the source tree.+ it('dependency-updates v9 runs isolated, exits clean when current, and re-runs held bot CI', () => {+ const current = DEFAULT_TASK_PROMPTS['dependency-updates'];+ expect(current).toContain('You are working in an isolated CoS worktree');+ // Dependencies already current → empty branch is a success (noChangeSuccess).+ expect(current).toContain('an empty branch is a successful run');+ // A Dependabot CI admission hold (scripts/ci-dependabot-admission.js) is a re-run+ // after diff inspection, never a FIX-THEN-MERGE push that would re-arm the hold.+ expect(current).toContain('gh run rerun <run-id>');+ expect(PROMPT_VERSIONS['dependency-updates']).toBeGreaterThanOrEqual(9);+ });++ // The hold bullet itself is pinned by the pre-token reconstruction case above.+ it('do-release v20 separates a held bot-PR CI run from a bump that broke CI', () => {+ expect(DEFAULT_TASK_PROMPTS['do-release']).toContain('Red CI from the bump itself');+ expect(PROMPT_VERSIONS['do-release']).toBeGreaterThanOrEqual(20);+ });+// NOTE: PROMPT_VERSIONS keys are SCHEDULE keys, not always prompt keys —// code-reviewer-a/b version a pipeline whose stages use the// code-reviewer-review / code-reviewer-implement prompt bodies — so there isdiff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex b99a37864f..65909d45f4 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -23,8 +23,8 @@"cost-efficiency": "239bad18c51b50c80599d30b2fb0ad15","data-integrity": "5fcc4f5044101e89da5bbf4890c11a1c","data-safety": "25e79bc34cfadeab3cc3969a6c3421c2",- "dependency-updates": "651c238ec23db94926ef277fe1fc0092",- "do-release": "97ce61508d7dd6616a8c02e2c365b872",+ "dependency-updates": "8ce4e7e33c5c7554b89af7d35a471c31",+ "do-release": "3061f2041d25fd80d60189f68ac5c3e0","do-replan": "35660eb7b43e4259a6a9253ed288a1db","documentation": "c94797b4bd3a0d554e225888ed48b76b","error-handling": "416b4e9aa2c1fcc3bfea7a2d38814ae5",@@ -88,8 +88,8 @@"cost-efficiency": 1,"data-integrity": 1,"data-safety": 3,- "dependency-updates": 8,- "do-release": 19,+ "dependency-updates": 9,+ "do-release": 20,"do-replan": 2,"documentation": 9,"error-handling": 4,@@ -318,7 +318,8 @@"1d59f04bea630a85a3085829db8599e7","f34cfa7e495d2bd6d3ac3c80b44447e8","44de787b45e037fbce281efc87706873",- "2d94021c979a86a349e125f5c15665d8"+ "2d94021c979a86a349e125f5c15665d8",+ "651c238ec23db94926ef277fe1fc0092"],"do-release": ["655180dfbab22e11fab79072ac49c9d6",@@ -338,7 +339,8 @@"b185da91e17d796514d841378fc7be6b","e2fb83ae74cc759d1fface857169badc","0ee9c504bad68f4a73be15f0b955a796",- "dcb1b0c84712f7824afd9c44cb4208da"+ "dcb1b0c84712f7824afd9c44cb4208da",+ "97ce61508d7dd6616a8c02e2c365b872"],"do-replan": ["59a57f1bb445138c30ab4fa23630c6f8"diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex 14b11a1d1d..21475d8754 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -102,6 +102,12 @@ if [ "$GH_HOST" = "ssh.github.com" ]; then GH_HOST="github.com"; fi`;// All prompts use {appName} and {repoPath} template variables// ============================================================+// Mirrors scripts/ci-dependabot-admission.js: CI on a dependency-bot PR is held+// until a repository writer re-runs it, so the held step's message must stay+// recognizable to every prompt that triages bot PRs (dependency-updates Phase 1,+// do-release Step 2).+const DEPENDABOT_ADMISSION_HOLD_GUIDANCE = 'A failing step that only says the run is `held for maintainer review` is a maintainer-admission hold, not a broken bump: the repository withholds CI from bot commits until a writer inspects them. Confirm the diff is manifest + lockfile only, then release the held run with `gh run rerun <run-id>` (a writer-only re-run keeps the original SHA) and wait for the real result before deciding. Never push a commit onto the bot branch to "fix" a hold — a new commit only re-arms it.';+export const DEFAULT_TASK_PROMPTS = {'app-launch-video': APP_LAUNCH_VIDEO_PROMPT,'model-comparison-refresh': `[Research] Fill PortOS model comparison evidence and estimates@@ -525,10 +531,14 @@ Check {appName} dependencies for updates and security vulnerabilities:Repository: {repoPath}-When this task runs in a CoS-managed worktree, its \`node_modules\` directories are-intentionally private to that worktree. If validation needs installed packages,-use the repository's documented package manager from the worktree so installs-and lockfile regeneration stay isolated from the source checkout.+You are working in an isolated CoS worktree cut from {repoPath}'s default branch,+and its \`node_modules\` directories are intentionally private to that worktree+(no links to the source checkout). If validation needs installed packages, use+the repository's documented package manager inside this worktree so installs and+lockfile regeneration stay isolated from the source checkout. Never run an+install in {repoPath} itself: that is the app's live checkout. If every+dependency is already current and no alert needs action, leave the worktree+clean and exit — an empty branch is a successful run, not a missed one.Freshly bumped packages run lifecycle scripts and test code nobody has reviewed,so run installs and validation CONTAINED when this machine can. From the@@ -603,6 +613,9 @@ repo (a globally-configured \`gh\` will silently target an unrelated GitHub repo\`glab ci trace <job-id>\`) and identify the root cause — a real incompatibility, aflaky test, or an unrelated pre-existing failure on the default branch (check thatbefore blaming the bump).+ - ${DEPENDABOT_ADMISSION_HOLD_GUIDANCE} Release a hold only for a patch or minor+ jump and only after the diff-sanity check below; if the re-run is refused (no+ write access), the verdict is LEAVE.- Mergeability: \`CONFLICTING\` (GitLab: \`cannot_be_merged\`) almost always meanslockfile/manifest drift from another dependency PR that already merged.- Diff sanity: the diff should be manifest + lockfile only. Source-file edits, a new@@ -623,9 +636,10 @@ repo (a globally-configured \`gh\` will silently target an unrelated GitHub repobranch. Keep it scoped to the breakage — never bundle unrelated work onto abot branch.* Either way, work on the bot branch in a THROWAWAY WORKTREE, never by checking- it out in {repoPath} — this task usually runs in the app's live checkout, so a- \`gh pr checkout\` there hijacks whatever branch the user is on and fails outright- on their uncommitted work. The bot branch normally exists only on the remote, so+ it out in {repoPath} — that is the app's live checkout, so a \`gh pr checkout\`+ there hijacks whatever branch the user is on and fails outright on their+ uncommitted work — and never inside this task's own worktree, whose branch is+ reserved for Phase 2's bumps. The bot branch normally exists only on the remote, soname the remote ref explicitly and let \`-b\` create the local branch. Call theworktree \`dep-{appSlug}-pr-<n>\` verbatim — {worktreesRoot} is shared by every appthis install manages, so a bare \`dep-pr-<n>\` collides with another app's PR of@@ -689,7 +703,10 @@ repo (a globally-configured \`gh\` will silently target an unrelated GitHub repo- Run tests- Verify the app starts correctly-7. Commit with a clear explanation and follow the repo's changelog convention.+7. If you changed anything, commit with a clear explanation and follow the repo's+ changelog convention. With nothing to change, leave the worktree clean — do not+ commit a run report or an audit timestamp alone, and never a lockfile churned by a+ verification install.8. Re-run affected audits and refresh forge alerts. Report each alert as fixed,mitigated (upstream alert still open), blocked, or awaiting merge/rescan, with its@@ -3925,7 +3942,8 @@ Skip this step when the options above say merging dependency updates is off.List open dependency-bot PRs (Dependabot, Renovate, or equivalent): \`gh pr list --repo <OWNER>/<REPO> --state open --search "author:app/dependabot" --json number,title,headRefName,mergeable\` (repeat for \`author:app/renovate\`). For each, oldest first:- Read the update's release notes for breaking changes that affect this codebase.- Green CI and no breaking change that affects the codebase: merge it.-- Red CI: check out the branch, fix what the new version broke, push the fix onto the PR branch, wait for CI, then merge. Never pin back or drop a security update to dodge a fix.+- ${DEPENDABOT_ADMISSION_HOLD_GUIDANCE}+- Red CI from the bump itself: check out the branch, fix what the new version broke, push the fix onto the PR branch, wait for CI, then merge. Never pin back or drop a security update to dodge a fix.- Conflicted or out of date: ask the bot to rebase (\`@dependabot rebase\`), or rebase it yourself, then merge once green.- Superseded by a newer bump of the same package: close it.diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex fb37c5dcaa..378395e888 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -43,7 +43,7 @@ export const PROMPT_VERSIONS = {'console-errors': 4, // v4: refer to framework-neutral UI lifecycle audit. v3: carries {modeInstructions}, collects real emitted output before diagnosing, groups duplicates by cause, and forbids "fixing" an error by suppressing it. Previously v2: unified `[Improvement: {appName}]` body (pre-unification defaults shipped separate self- and app-improvement bodies)'error-handling': 4, // v4: cedes sensitive detail in an error path to privacy and partial writes to data-integrity (#12086). v3: carries {modeInstructions} and covers resilience (timeouts, retry ceilings, degraded-dependency fallback, cleanup on the error path, actionable user-facing text) while handing swallowed errors and log context to observability. Previously v2: unified `[Improvement: {appName}]` body (older default used the `[App Improvement: {appName}]` header)'typing': 3, // v3: carries {modeInstructions}, exits cleanly on an untyped project, and targets boundary escape hatches and validator/type disagreement instead of a mechanical annotation sweep. Previously v2: unified `[Improvement: {appName}]` body (older default used the `[App Improvement: {appName}]` header)- 'dependency-updates': 8, // v8: installs and validation run through scripts/contained-run.js (Docker containment) when it is ready, and the summary says when they ran uncontained. v7: dependency-update worktrees keep package-manager writes out of the source checkout's shared node_modules. v6: the throwaway bot-PR worktree is `dep-{appSlug}-pr-<n>` — the app NAME alone did not isolate two managed apps sharing a name, and {appSlug} is rendered server-side rather than slugified by the agent (`appWorktreeSlug`, server/lib/worktreeOwnership.js). v5: inventory all Dependabot alerts and ecosystems, verify actual upstream fixes, and track unpatched mitigations separately from alert closure. v4: the Phase 1 GitLab MR listing gains `--output json` — without it glab answers with the human table, which carries the head branch but NOT the author, while the classification right below it reads both. The same bump drops `--state` from the MR-list recipes — that flag does not exist (MR state is selected by presence flags `--merged`/`--closed`/`--all`, and OPEN is the default), so `--state opened` exited 1 with `Unknown flag: --state` and Phase 1 skipped its bot-PR triage entirely on GitLab repos. v3: Phase 1 triages open Dependabot/Renovate PRs first (evidence → MERGE / FIX-THEN-MERGE / CLOSE / LEAVE, including conflict + CI-failure repair on the bot branch) before Phase 2 updates anything the bots didn't cover — an agent that bumped packages itself was duplicating and conflicting with open bot PRs. v2: generic {appName} body (older default hardcoded "PortOS")+ 'dependency-updates': 9, // v9: the task always runs in an isolated CoS worktree (schedule default `useWorktree: true`, locked) — the body no longer describes the live checkout as the usual cwd; an already-current repo exits with an empty branch as a success (`noChangeSuccess`); and Phase 1 recognizes a maintainer-admission CI hold on a bot PR (`held for maintainer review`) as a re-run after diff inspection, never a FIX-THEN-MERGE push. v8: installs and validation run through scripts/contained-run.js (Docker containment) when it is ready, and the summary says when they ran uncontained. v7: dependency-update worktrees keep package-manager writes out of the source checkout's shared node_modules. v6: the throwaway bot-PR worktree is `dep-{appSlug}-pr-<n>` — the app NAME alone did not isolate two managed apps sharing a name, and {appSlug} is rendered server-side rather than slugified by the agent (`appWorktreeSlug`, server/lib/worktreeOwnership.js). v5: inventory all Dependabot alerts and ecosystems, verify actual upstream fixes, and track unpatched mitigations separately from alert closure. v4: the Phase 1 GitLab MR listing gains `--output json` — without it glab answers with the human table, which carries the head branch but NOT the author, while the classification right below it reads both. The same bump drops `--state` from the MR-list recipes — that flag does not exist (MR state is selected by presence flags `--merged`/`--closed`/`--all`, and OPEN is the default), so `--state opened` exited 1 with `Unknown flag: --state` and Phase 1 skipped its bot-PR triage entirely on GitLab repos. v3: Phase 1 triages open Dependabot/Renovate PRs first (evidence → MERGE / FIX-THEN-MERGE / CLOSE / LEAVE, including conflict + CI-failure repair on the bot branch) before Phase 2 updates anything the bots didn't cover — an agent that bumped packages itself was duplicating and conflicting with open bot PRs. v2: generic {appName} body (older default hardcoded "PortOS")'documentation': 9, // v9: hunts instruction files, skills, and shipped task prompts for named files/functions/flags/tools/commands absent from the tree, one finding per file (#12093). v8: drops the read-instruction-files restatement the mode banners own (#12080). v7: carries {modeInstructions} and ranks wrong documentation above missing documentation, verifying instructions against the code rather than trusting the prose. Previously v6: the changelog step names `AGENTS.md` (or `CLAUDE.md`) as the file carrying the repo's documented convention — #4852 made AGENTS.md the canonical cross-vendor agent-instructions filename, and a managed app that adopted it would otherwise be told to read a file it no longer has. v5: the changelog step defers to the convention the repo documents (some repos collect per-branch fragments in a directory so parallel agents don't conflict) instead of prescribing an append to `.changelog/NEXT.md`. v4: generic {appName} body (v1 hardcoded "PortOS"; v2/v3 retired DONE.md wording)'ui-bugs': 4, // v4: hunts the unhappy branch of each primary action and statically provable crashes (a call to a member the imported module lacks), which no longer count as speculative; cedes stranded workflows to workflow-recovery and unfinished controls to feature-completeness. Previous version: v3: carries {modeInstructions}, exits cleanly when the interface is unreachable instead of filing from imagination, and cedes layout/a11y/UX/copy to their owners. Previously v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)'mobile-responsive': 4, // v4: owns every layout defect at viewport width ≤1024 plus touch; narrow containers on a desktop viewport stay with ux (#12084). v3: carries {modeInstructions} and requires the viewport width plus what a user cannot do there, rather than flagging any layout that merely looks different. Previously v2: generic {appName} app-UI body (older default hardcoded "PortOS" + http://localhost:5555)@@ -80,7 +80,7 @@ export const PROMPT_VERSIONS = {'better-test-quality': 2, // v2: adds mocks that drift from the module they replace (members/exports the real module lacks). Previous version: v1: vacuous/weak/redundant existing tests, proven with a mutation probe. Distinct from test-coverage, which owns the gaps.'stash-cleanup': 2, // v2: the STALE/ABANDONED heuristic names `AGENTS.md` (or `CLAUDE.md`) as the policy file to check before assuming a stash contradicts current architecture (#4852). v1: triage git stash list — supersession check against main, drop superseded/stale entries, leave real unlanded work in place. Net-new type (no retired-hash history needed).'repo-sync': 1, // v1: verify + finish the deterministic install-wide origin-sync sweep (services/repoSync.js) — resolve mid-flight merges/rebases, decide what to do with uncommitted work, land or report unpushed branches, triage the stashes it could not prove redundant. Net-new type (no retired-hash history needed).- 'do-release': 19, // v19: API calls target {portosApiUrl}, expanded at spawn to the loopback origin (#12405). v18: the run stays with the release PR through CI, fixes red checks (including ones inherited from the dev branch) and ends only with a merged, tagged, published release — v17 agent-36fff086 opened the release PR, got one idle nudge and reported INCOMPLETE with CI still pending. v17: previously accepted rules may be retired after documented value/feasibility reassessment. v16: unresolved accepted findings block release at every severity; optional reviewer availability remains optional. v15: renamed from `release-check` — the goal is a SHIPPED release, not a readiness check. The run first finishes in-flight work no live agent owns (open PRs, lingering branches via branch-reconcile), merges dependency-bot PRs, then releases; a blocker that survives three attempts goes to a sub-agent or a queued PortOS task instead of ending the run (v14 stopped at its 10-commit bound with the release PR open), local-only flakes no longer block a green-CI release, and routine design/preference decisions are made and listed for operator review. The operator's `{releaseOptions}` toggles (finishInFlight / mergeDependencyUpdates / resolveBlockers / autoDecide) gate each step. v14: the release agent names each release from its one or two biggest user-visible wins and writes the exact first heading the GitHub workflow promotes to the release title. v13: a failing test suite or red CI is work the run must FIX (reproduce, classify regression vs. bad test vs. environmental blocker, fix the root cause, verify, commit, resume) instead of a reason to halt the release — a pre-existing failure on main stopped v12 short with the release untouched; skipping/deleting/loosening a test to force green is explicitly not a fix, and the loop is bounded (3 attempts per failure, 10 fix commits per run). v12: code review is advisory and only CI gates release progress; v11: delegate release mechanics to bundled slashdo release and pin PortOS-configured reviewers. v10: the release-documentation search names the `AGENTS.md` (or `CLAUDE.md`) context instead of CLAUDE.md alone (#4852). v9: Step 1 reconciles missing GitHub Releases against git release tags (publishing any missing tag with .changelog/vX.Y.Z.md as body and --latest=false when a newer version exists) BEFORE evaluating if enough unreleased work has accumulated; v8: database-backed release tests are provisioned and run using the repo's documented isolated test database before the release PR gate; v7: Step 1 also reads the UNCOLLECTED changelog fragments (the fragment dir, plus whatever preview command that repo documents — release-check is a generic {appName} prompt, so it never names a PortOS script to run) and counts substantive entries across the assembled notes — reading only the staged `.changelog/NEXT.md` under-counts a release whose entries are still per-branch fragments, so a ready release reported as "not enough work". v6: generic {appName} body (older defaults hardcoded "PortOS")+ 'do-release': 20, // v20: Step 2 recognizes a maintainer-admission CI hold on a dependency-bot PR (`held for maintainer review`) — inspect the diff and re-run the held workflow instead of pushing a "fix" onto the bot branch, which re-arms the hold. v19: API calls target {portosApiUrl}, expanded at spawn to the loopback origin (#12405). v18: the run stays with the release PR through CI, fixes red checks (including ones inherited from the dev branch) and ends only with a merged, tagged, published release — v17 agent-36fff086 opened the release PR, got one idle nudge and reported INCOMPLETE with CI still pending. v17: previously accepted rules may be retired after documented value/feasibility reassessment. v16: unresolved accepted findings block release at every severity; optional reviewer availability remains optional. v15: renamed from `release-check` — the goal is a SHIPPED release, not a readiness check. The run first finishes in-flight work no live agent owns (open PRs, lingering branches via branch-reconcile), merges dependency-bot PRs, then releases; a blocker that survives three attempts goes to a sub-agent or a queued PortOS task instead of ending the run (v14 stopped at its 10-commit bound with the release PR open), local-only flakes no longer block a green-CI release, and routine design/preference decisions are made and listed for operator review. The operator's `{releaseOptions}` toggles (finishInFlight / mergeDependencyUpdates / resolveBlockers / autoDecide) gate each step. v14: the release agent names each release from its one or two biggest user-visible wins and writes the exact first heading the GitHub workflow promotes to the release title. v13: a failing test suite or red CI is work the run must FIX (reproduce, classify regression vs. bad test vs. environmental blocker, fix the root cause, verify, commit, resume) instead of a reason to halt the release — a pre-existing failure on main stopped v12 short with the release untouched; skipping/deleting/loosening a test to force green is explicitly not a fix, and the loop is bounded (3 attempts per failure, 10 fix commits per run). v12: code review is advisory and only CI gates release progress; v11: delegate release mechanics to bundled slashdo release and pin PortOS-configured reviewers. v10: the release-documentation search names the `AGENTS.md` (or `CLAUDE.md`) context instead of CLAUDE.md alone (#4852). v9: Step 1 reconciles missing GitHub Releases against git release tags (publishing any missing tag with .changelog/vX.Y.Z.md as body and --latest=false when a newer version exists) BEFORE evaluating if enough unreleased work has accumulated; v8: database-backed release tests are provisioned and run using the repo's documented isolated test database before the release PR gate; v7: Step 1 also reads the UNCOLLECTED changelog fragments (the fragment dir, plus whatever preview command that repo documents — release-check is a generic {appName} prompt, so it never names a PortOS script to run) and counts substantive entries across the assembled notes — reading only the staged `.changelog/NEXT.md` under-counts a release whose entries are still per-branch fragments, so a ready release reported as "not enough work". v6: generic {appName} body (older defaults hardcoded "PortOS")// A SCHEDULE task type absent from this map is silently exempt from// auto-upgrade forever: taskScheduleStore's upgrade block is gated ondiff --git a/server/services/taskSchedule.test.js b/server/services/taskSchedule.test.jsindex dc62e882a9..3361df8620 100644--- a/server/services/taskSchedule.test.js+++ b/server/services/taskSchedule.test.js@@ -190,7 +190,8 @@ import { RETIRED_CONSOLE_ERRORS_PROMPT } from './taskPromptDefaults/retiredPromp// — the posture guard below iterates it so the two can't drift apart.import { NON_COMMITTING_COORDINATOR_TASK_TYPES } from './taskTypeHooks.js'import { enforceManagedAgentOptions } from './taskScheduleRegistry.js'-import { modeContractFor, auditDoWorkRequiresWorktree, AUDIT_TASK_TYPES } from '../lib/auditCatalog.js'+import { modeContractFor, auditDoWorkRequiresWorktree, AUDIT_TASK_TYPES, isAuditTaskType } from '../lib/auditCatalog.js'+import { NO_CHANGE_SCHEDULED_TYPES } from '../lib/noChangeCompletion.js'import { loadState } from './cosState.js'@@ -508,6 +509,38 @@ describe('taskSchedule', () => {});});+ describe('dependency-updates isolation posture', () => {+ // Rationale lives on the registry entry: installs are never safe in the live checkout.+ it('ships worktree + PR delivery with the no-change marker and locks only useWorktree', () => {+ expect(DEFAULT_TASK_INTERVALS['dependency-updates'].taskMetadata).toEqual({ useWorktree: true, openPR: true, noChangeSuccess: true });+ expect(MANAGED_AGENT_OPTIONS['dependency-updates']).toEqual(['useWorktree']);+ });++ it('loadSchedule re-isolates an install whose stored config predates the lock', async () => {+ mockSchedule({+ tasks: {+ 'dependency-updates': { type: 'cron', cronExpression: '0 6 * * 1', enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false } }+ }+ })+ const meta = (await loadSchedule()).tasks['dependency-updates'].taskMetadata+ expect(meta.useWorktree).toBe(true)+ // Backfilled from the defaults by the taskMetadata deep-merge.+ expect(meta.openPR).toBe(true)+ expect(meta.noChangeSuccess).toBe(true)+ })++ // The finalizer admits a non-audit scheduled type to the no-change exemption by+ // name (lib/noChangeCompletion.js), while the schedule default is what tells the+ // agent a clean exit is allowed. Keep the two in parity so a type cannot carry+ // the marker without the exemption, or the exemption without the marker.+ it('keeps the no-change allowlist in parity with the shipped noChangeSuccess defaults', () => {+ const marked = Object.entries(DEFAULT_TASK_INTERVALS)+ .filter(([type, interval]) => !isAuditTaskType(type) && interval.taskMetadata?.noChangeSuccess === true)+ .map(([type]) => type)+ expect(new Set(marked)).toEqual(NO_CHANGE_SCHEDULED_TYPES)+ })+ });+describe('pr-reviewer (layered public-content review task)', () => {it('describes the preflight-owned prompt and ships the optional three-stage pipeline read-only', () => {expect(TASK_TYPE_PROMPT_INFO['pr-reviewer']).toMatchObject({ mode: 'runtime-generated' });diff --git a/server/services/taskScheduleRegistry.js b/server/services/taskScheduleRegistry.jsindex 965d41030a..54bfa15138 100644--- a/server/services/taskScheduleRegistry.js+++ b/server/services/taskScheduleRegistry.js@@ -244,7 +244,20 @@ const TASK_INTERVAL_DEFAULTS = {// needs no model and runs every pass regardless of whether any zombie exists.'issue-reconcile': { type: INTERVAL_TYPES.ON_DEMAND, perpetual: true, enabled: true, providerId: null, model: null, prompt: null, recheckCron: '0 4 * * *', drainDispatchCap: PERPETUAL_DRAIN_DISPATCH_CAP, taskMetadata: { ...NON_COMMITTING_COORDINATOR_METADATA, autoClose: true } },'console-errors': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },- 'dependency-updates': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null },+ // dependency-updates runs package-manager installs, so it ALWAYS gets an+ // isolated CoS worktree whose node_modules are private to it+ // (agentWorkspacePrep passes `linkDependencies: false`). In the live checkout+ // an `npm install` follows the shared-dependency symlinks into the source+ // tree and, for PortOS itself, rewrites the running server's node_modules on+ // whatever branch the user has checked out, then commits there. `useWorktree`+ // is therefore LOCKED (MANAGED_AGENT_OPTIONS). `openPR` is the shipped+ // delivery so a bump is validated by CI instead of merged back locally (a+ // local merge-back lands the new lockfile in the live checkout while its+ // node_modules stay at the old versions until a reinstall), but the operator+ // may flip it. `noChangeSuccess`: dependencies that are already+ // current are the common outcome — the run ends with an empty branch and is+ // still a success (lib/noChangeCompletion.js admits this type explicitly).+ 'dependency-updates': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: true, openPR: true, noChangeSuccess: true } },'documentation': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },'ui-bugs': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },'mobile-responsive': { type: INTERVAL_TYPES.ON_DEMAND, enabled: true, providerId: null, model: null, prompt: null, taskMetadata: { fileIssues: false } },@@ -486,6 +499,9 @@ export const MANAGED_AGENT_OPTIONS = {// even when a global/per-app metadata override tries to make it writable.'issue-watcher': ['useWorktree', 'openPR', 'readOnly', 'worktreeChangesExpected'],'pr-watcher': ['prAuthorFilter'],+ // Package-manager installs are never safe in the live checkout (see the task's+ // entry above), so isolation is not an operator choice; `openPR` stays free.+ 'dependency-updates': ['useWorktree'],// The non-committing coordinators (NON_COMMITTING_COORDINATOR_METADATA above) all// run in the app's LIVE checkout and ship no code, so a CoS-managed worktree is at// best unused and at worst harmful — branch-reconcile needs to see the sibling