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
release-check now fixes failing tests and red CI instead of halting the release
[._.]/ Adam Eivyc29e32b7bc83
diff --git a/scripts/migrations/332-release-check-fix-blockers-prompt.js b/scripts/migrations/332-release-check-fix-blockers-prompt.jsnew file mode 100644index 0000000000..fbf2bcebe5--- /dev/null+++ b/scripts/migrations/332-release-check-fix-blockers-prompt.js@@ -0,0 +1,52 @@+/**+ * Upgrade the scheduled release-check prompt to v13, where a failing test suite+ * or red CI is a blocker the run must fix rather than a reason to halt.+ *+ * Existing installs persist task prompts under data/cos/task-schedule.json (and+ * older installs may still use data/task-schedule.json). Customized prompts+ * remain untouched.+ */++import { readFile, writeFile } from 'fs/promises';+import { join } from 'path';+import { DEFAULT_TASK_PROMPTS, PROMPT_VERSIONS } from '../../server/services/taskPromptDefaults.js';++const SCHEDULE_PATHS = [+ join('data', 'cos', 'task-schedule.json'),+ join('data', 'task-schedule.json'),+];++async function readJson(path) {+ const raw = await readFile(path, 'utf-8').catch((err) => {+ if (err.code === 'ENOENT') return null;+ throw err;+ });+ if (raw == null) return null;+ try {+ return JSON.parse(raw);+ } catch {+ return null;+ }+}++export default {+ async up({ rootDir }) {+ let updatedCount = 0;+ for (const relPath of SCHEDULE_PATHS) {+ const fullPath = join(rootDir, relPath);+ const schedule = await readJson(fullPath);+ const task = schedule?.tasks?.['release-check'];+ if (!task) continue;++ const currentVersion = task.promptVersion || 1;+ if (task.promptCustomized || currentVersion >= PROMPT_VERSIONS['release-check']) continue;++ task.prompt = DEFAULT_TASK_PROMPTS['release-check'];+ task.promptVersion = PROMPT_VERSIONS['release-check'];+ await writeFile(fullPath, `${JSON.stringify(schedule, null, 2)}\n`);+ updatedCount += 1;+ console.log(`📝 ${relPath}: upgraded release-check prompt v${currentVersion} → v${PROMPT_VERSIONS['release-check']}`);+ }+ return { updated: updatedCount };+ },+};diff --git a/scripts/migrations/332-release-check-fix-blockers-prompt.test.js b/scripts/migrations/332-release-check-fix-blockers-prompt.test.jsnew file mode 100644index 0000000000..f7d31a41d1--- /dev/null+++ b/scripts/migrations/332-release-check-fix-blockers-prompt.test.js@@ -0,0 +1,70 @@+import { describe, it, expect, beforeEach, afterEach } from 'vitest';+import { mkdtempSync, rmSync, writeFileSync, readFileSync, mkdirSync } from 'fs';+import { tmpdir } from 'os';+import { join } from 'path';++import migration from './332-release-check-fix-blockers-prompt.js';+import { DEFAULT_TASK_PROMPTS, PROMPT_VERSIONS, PREVIOUS_DEFAULT_PROMPTS } from '../../server/services/taskPromptDefaults.js';++const writeJson = (path, value) => writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);+const readJson = (path) => JSON.parse(readFileSync(path, 'utf-8'));+const oldPrompt = PREVIOUS_DEFAULT_PROMPTS['release-check'].at(-1);++describe('migration 332 — make release-check fix release blockers', () => {+ let rootDir;++ beforeEach(() => {+ rootDir = mkdtempSync(join(tmpdir(), 'migration-332-'));+ mkdirSync(join(rootDir, 'data', 'cos'), { recursive: true });+ });++ afterEach(() => {+ rmSync(rootDir, { recursive: true, force: true });+ });++ it('updates both supported schedule locations and leaves custom prompts alone', async () => {+ const cosPath = join(rootDir, 'data', 'cos', 'task-schedule.json');+ const legacyPath = join(rootDir, 'data', 'task-schedule.json');+ writeJson(cosPath, {+ tasks: {+ 'release-check': { promptVersion: 12, promptCustomized: false, prompt: oldPrompt },+ custom: { promptVersion: 12, promptCustomized: true, prompt: 'keep this' },+ },+ });+ writeJson(legacyPath, {+ tasks: {+ 'release-check': { promptVersion: 12, promptCustomized: false, prompt: oldPrompt },+ },+ });++ const result = await migration.up({ rootDir });++ expect(result.updated).toBe(2);+ expect(readJson(cosPath).tasks['release-check']).toEqual({+ promptVersion: PROMPT_VERSIONS['release-check'],+ promptCustomized: false,+ prompt: DEFAULT_TASK_PROMPTS['release-check'],+ });+ expect(readJson(cosPath).tasks.custom).toEqual({+ promptVersion: 12,+ promptCustomized: true,+ prompt: 'keep this',+ });+ expect(readJson(legacyPath).tasks['release-check'].prompt).toBe(DEFAULT_TASK_PROMPTS['release-check']);+ });++ it('does not rewrite a current or customized prompt', async () => {+ const path = join(rootDir, 'data', 'cos', 'task-schedule.json');+ writeJson(path, {+ tasks: {+ current: { promptVersion: PROMPT_VERSIONS['release-check'], promptCustomized: false, prompt: DEFAULT_TASK_PROMPTS['release-check'] },+ custom: { promptVersion: 12, promptCustomized: true, prompt: 'custom release policy' },+ },+ });++ const result = await migration.up({ rootDir });++ expect(result.updated).toBe(0);+ expect(readJson(path).tasks.custom.prompt).toBe('custom release policy');+ });+});diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.jsindex 14a7bb7ba0..0363a2bb49 100644--- a/server/services/taskPromptDefaults.test.js+++ b/server/services/taskPromptDefaults.test.js@@ -603,9 +603,9 @@ describe('taskPromptDefaults integrity snapshot', () => {// release-check READS the changelog rather than writing it, so its fix is the// mirror image: an unreleased set that lives in uncollected fragments must not// read as "not enough work accumulated for a release".- it('release-check v12 keeps code review advisory and CI as the release gate, preserving v11', () => {+ it('release-check v13 fixes failing tests/CI instead of halting, preserving v12', () => {const current = DEFAULT_TASK_PROMPTS['release-check'];- expect(PROMPT_VERSIONS['release-check']).toBeGreaterThanOrEqual(12);+ expect(PROMPT_VERSIONS['release-check']).toBeGreaterThanOrEqual(13);expect(current).toContain('Reconcile Missing Releases');expect(current).toContain('Unpublished release detected');expect(current).toContain('--latest=false');@@ -624,6 +624,18 @@ describe('taskPromptDefaults integrity snapshot', () => {expect(current).toContain('Code review is optional');expect(current).toContain('Only CI is the review/merge gate');expect(current).toContain('inconclusive review must never stop the release');+ // v13: a red suite or red CI is work this run must FIX. A pre-existing+ // failure on the source branch is what ended a v12 run with the release+ // untouched, so the halt-on-test-failure sentence must be gone and the+ // repair loop present — including the guard against forcing green by+ // deleting/skipping/loosening a test.+ expect(current).toContain('Fix what blocks the release');+ expect(current).toContain('already existed on the source branch before this run started');+ expect(current).toContain('are NOT fixes');+ expect(current).toContain('--log-failed');+ expect(current).toContain('Bound the loop');+ expect(current).toContain('Environmental blocker');+ expect(current).not.toContain('its required tests/build checks fail, or CI fails, stop and report');expect(current).not.toContain('If the reviewer list is empty or unavailable, stop');expect(current).not.toContain('If it cannot run or a configured reviewer is unavailable or inconclusive, stop');expect(current).not.toMatch(/copilot/i);@@ -644,6 +656,9 @@ describe('taskPromptDefaults integrity snapshot', () => {const v11 = previous.find((prompt) => prompt.includes('configured reviewer is unavailable or inconclusive, stop'));expect(v11).toBeDefined();expect(v11).not.toBe(current);+ const v12 = previous.find((prompt) => prompt.includes('its required tests/build checks fail, or CI fails, stop and report'));+ expect(v12).toBeDefined();+ expect(v12).not.toBe(current);});// The PortOS custom catalog-refresh job still sources this versioned prompt:diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex a7035dd408..5b64014669 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -28,7 +28,7 @@"code-reviewer-implement": "2e10cac7c1e1cd021d06bfddb5c1eaf2","error-handling": "9afba2e99b90a8d5771c75e7f0615d96","typing": "1f2758ce0bb62d789a21aec241549531",- "release-check": "644e5f2f6df1daf06f3792a81ba7a51a",+ "release-check": "5a82eec9f86ad05185ed77a42dbfd9d4","stash-cleanup": "1c12bac5aac6bb27008c40981e7db08c","repo-sync": "0a648d35d43b023b758226b9c709c8ea","user-action-review": "945a716d446d26a03e2805d28bd1ae16",@@ -84,7 +84,7 @@"copy": 1,"stash-cleanup": 2,"repo-sync": 1,- "release-check": 12,+ "release-check": 13,"jira-sprint-manager": 1,"jira-status-report": 1},@@ -247,7 +247,8 @@"08c928e6f79f83535e40b6988ff6eae3","afa9039cfbff21d77d601dc74eb5b81f","2d2a6700c23b73bf738c2aa915e37277",- "64be10f6ac7bcf74d4fc257089fc179b"+ "64be10f6ac7bcf74d4fc257089fc179b",+ "644e5f2f6df1daf06f3792a81ba7a51a"],"branch-reconcile": ["7ef2b5f7d8f05937d4912b26ad45f42e",diff --git a/server/services/taskPromptDefaults/previousDefaults.js b/server/services/taskPromptDefaults/previousDefaults.jsindex b1fc593b81..360a2aa68b 100644--- a/server/services/taskPromptDefaults/previousDefaults.js+++ b/server/services/taskPromptDefaults/previousDefaults.js@@ -10897,7 +10897,23 @@ The PortOS Code Review Defaults rendered into \`{reviewers}\` are authoritativeRun the bundled \`/do:release\` workflow (or its equivalent \`release\` skill) exactly once, in autonomous mode with no \`--interactive\` flag. It owns release readiness, version/changelog finalization, tests/build, local review, PR creation, the configured reviewer loop, CI, merge, tagging, and the final report. If it cannot run or a configured reviewer is unavailable or inconclusive, stop and report instead of substituting another reviewer.The release workflow is attached to this task by metadata so every provider receives the same bundled body and reviewer pin. Do not reimplement any of its phases in this scheduled prompt.`;- return [...history, v10, v11];+ // v12 made code review advisory and CI the only merge gate; it touched only+ // the two Step 1 paragraphs, so derive it from v11 the way v10 is derived+ // from v9 rather than duplicating Step 0's bulk a third time. v13 then added+ // the fix-the-blockers mandate (repair failing local tests and red CI instead+ // of halting the release), so this outgoing v12 body must stay byte-for-byte+ // recognizable to auto-upgrade an existing uncustomized schedule.+ const v12 = v11+ .replace(+ `The PortOS Code Review Defaults rendered into \`{reviewers}\` are authoritative for this run. Use exactly that reviewer list and no other. The task builder attaches the same list to the bundled slashdo invocation; do not invoke a bare workflow that falls back to saved slashdo defaults. PortOS-only configured reviewers still run through the Local Reviewer Procedure appended to this prompt. If the reviewer list is empty or unavailable, stop before creating or updating a release PR.`,+ `The PortOS Code Review Defaults rendered into \`{reviewers}\` are advisory for this run. Use exactly that reviewer list and no other when review is available. The task builder attaches the same list to the bundled slashdo invocation; do not invoke a bare workflow that falls back to saved slashdo defaults. Code review is optional: run configured reviewers when available and address valid findings, but an empty, unavailable, timed-out, malformed, no-verdict, or otherwise inconclusive review must never stop the release.`,+ )+ .replace(+ `It owns release readiness, version/changelog finalization, tests/build, local review, PR creation, the configured reviewer loop, CI, merge, tagging, and the final report. If it cannot run or a configured reviewer is unavailable or inconclusive, stop and report instead of substituting another reviewer.`,+ `It owns release readiness, version/changelog finalization, tests/build, optional code review, PR creation, CI, merge, tagging, and the final report. Only CI is the review/merge gate; required release tests/build checks still must pass. If the workflow itself cannot run, its required tests/build checks fail, or CI fails, stop and report; do not stop or leave the release open because code review is unavailable or inconclusive.`,+ );+ if (v12 === v11 || v12.includes('are authoritative for this run')) throw new Error('release-check v12 historical prompt derivation did not match v11');+ return [...history, v10, v11, v12];})(),'branch-reconcile': [// v1 default — superseded by v2, whose Rules make "merged" (not "PR opened")diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex 58424eae08..673c3e01c4 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -1929,7 +1929,26 @@ If the release docs identify a separate database-backed test suite, the canonicaThe PortOS Code Review Defaults rendered into \`{reviewers}\` are advisory for this run. Use exactly that reviewer list and no other when review is available. The task builder attaches the same list to the bundled slashdo invocation; do not invoke a bare workflow that falls back to saved slashdo defaults. Code review is optional: run configured reviewers when available and address valid findings, but an empty, unavailable, timed-out, malformed, no-verdict, or otherwise inconclusive review must never stop the release.-Run the bundled \`/do:release\` workflow (or its equivalent \`release\` skill) exactly once, in autonomous mode with no \`--interactive\` flag. It owns release readiness, version/changelog finalization, tests/build, optional code review, PR creation, CI, merge, tagging, and the final report. Only CI is the review/merge gate; required release tests/build checks still must pass. If the workflow itself cannot run, its required tests/build checks fail, or CI fails, stop and report; do not stop or leave the release open because code review is unavailable or inconclusive.+Run the bundled \`/do:release\` workflow (or its equivalent \`release\` skill) exactly once, in autonomous mode with no \`--interactive\` flag. It owns release readiness, version/changelog finalization, tests/build, optional code review, PR creation, CI, merge, tagging, and the final report. Only CI is the review/merge gate; required release tests/build checks still must pass — but a failing test or a red CI run is work for you to do in Step 2, not a reason to end the run. Stop and report only if the workflow itself cannot run at all; never stop or leave the release open because code review is unavailable or inconclusive.++## Step 2: Fix what blocks the release — do not just report it++A failing test suite or a red CI run does NOT end this run. Unblocking the release is part of the task, including when the failure already existed on the source branch before this run started and nothing you did caused it. "The release was halted because tests failed" is not an acceptable outcome while the failure is fixable.++Work each blocking failure through this loop until the required suite and CI are green, or until you hit the bound below:++1. **Reproduce and localize.** Re-run only the failing file or test to confirm it fails on its own, repeating it a few times when the failure looks timing-dependent. Read the failing assertion and the code it exercises before changing anything.+2. **Classify it.**+ - **Real regression** — the test is right and the product code is wrong. Fix the product code.+ - **Bad test** — it races the code under test, depends on wall-clock time or ordering, leaks state between cases, asserts an implementation detail that legitimately changed, or carries a stale fixture. Fix the test.+ - **Environmental blocker** — a service the suite needs is unreachable, a credential is missing, or a required tool is absent. That is not fixable from here: report exactly what failed (the command and its error) and stop.+3. **Fix the root cause.** Deleting a test, skipping or narrowing it, loosening an assertion until it passes, or inflating a timeout to paper over a race are NOT fixes — never do them to force a green. If the correct fix is genuinely out of reach for this run, say precisely why and stop instead of disabling coverage.+4. **Verify.** Re-run the failing test, then the full suite the release requires, and confirm nothing else broke.+5. **Commit and push** each fix as its own commit on the source branch, with a subject stating what was broken and why the change fixes it (release notes are derived from commit subjects). Then resume the release workflow.++Apply the same loop to a red CI run on the release PR, driving it from the failing job's logs (for example \`gh pr checks <PR_NUM>\` to find the run, then \`gh run view <RUN_ID> --log-failed\`). Push the fix to the PR's branch, wait for the re-run, and merge once CI is green. A CI failure that does not reproduce locally is still yours to diagnose — look for platform differences (OS, runtime version, installed dependencies) and for state the local run has that CI does not.++**Bound the loop.** Stop and report if the same failure survives three distinct fix attempts, or once you have made ten fix commits in this run without reaching green. A failure that resists that much needs a human, not more grinding.The release workflow is attached to this task by metadata so every provider receives the same bundled body and reviewer pin. Do not reimplement any of its phases in this scheduled prompt.`,diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex 66524f4593..03681e2b7c 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -53,7 +53,7 @@ export const PROMPT_VERSIONS = {'copy': 1, // v1: copy/text-clarity audit (jargon, ambiguous action verbs, dead-end errors, pluralization). Net-new type. Mode injected at dispatch.'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 PREVIOUS_DEFAULT_PROMPTS entry 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 PREVIOUS_DEFAULT_PROMPTS entry needed).- 'release-check': 12, // 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")+ 'release-check': 13, // 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 on