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: make release checks database-aware

[._.]/ Adam Eivyfcf5850286a0
diff --git a/server/services/taskPromptDefaults.test.js b/server/services/taskPromptDefaults.test.js
index d7d2b4542f..bf9f62be72 100644
--- a/server/services/taskPromptDefaults.test.js
+++ b/server/services/taskPromptDefaults.test.js
@@ -442,10 +442,14 @@ describe('taskPromptDefaults integrity snapshot', () => {
// repo's own documented command, never name a PortOS script to run.
expect(current).not.toContain('changelog:preview');
expect(current).toContain('Do NOT guess a command name');
+ expect(current).toContain('database-backed test suite');
+ expect(current).toContain('test-database provisioning/setup command');
+ expect(current).toContain('never substitute a production database');
const previous = PREVIOUS_DEFAULT_PROMPTS['release-check'];
const outgoing = previous[previous.length - 1];
- expect(outgoing).not.toContain('per-branch fragments');
+ expect(outgoing).toContain('per-branch fragments');
+ expect(outgoing).not.toContain('database-backed test suite');
expect(outgoing).not.toBe(current);
});
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 13096b8d89..8aeb65fc92 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -20,7 +20,7 @@
"code-reviewer-implement": "ab2c3e16d54e195bdf856574b7702042",
"error-handling": "9afba2e99b90a8d5771c75e7f0615d96",
"typing": "1f2758ce0bb62d789a21aec241549531",
- "release-check": "746f11daaf721eae9e16845858ef55ee",
+ "release-check": "08c928e6f79f83535e40b6988ff6eae3",
"jira-sprint-manager": "3e63c8a3bdf0d5a05a30faaa2dc07980",
"do-replan": "35660eb7b43e4259a6a9253ed288a1db",
"jira-status-report": "9d374a9d8ccb92c5c8fd0aa9899e79a5",
@@ -59,7 +59,7 @@
"ui-bugs": 2,
"mobile-responsive": 2,
"ux": 1,
- "release-check": 7
+ "release-check": 8
},
"REFERENCE_WATCH_AUDITED_VERSION": 3,
"PREVIOUS_DEFAULT_PROMPTS": {
@@ -177,7 +177,8 @@
"133c221608545a26f328dead099a4d0a",
"609167c41331e6bbfc6d5f5edc452d4c",
"9c7508598ee772d1cee8f609f9ed7372",
- "8436a47b5b1c9b2a342795e5634552da"
+ "8436a47b5b1c9b2a342795e5634552da",
+ "746f11daaf721eae9e16845858ef55ee"
],
"branch-reconcile": [
"7ef2b5f7d8f05937d4912b26ad45f42e",
diff --git a/server/services/taskPromptDefaults/previousDefaults.js b/server/services/taskPromptDefaults/previousDefaults.js
index 28c6026ead..4f6603e6b2 100644
--- a/server/services/taskPromptDefaults/previousDefaults.js
+++ b/server/services/taskPromptDefaults/previousDefaults.js
@@ -7963,6 +7963,122 @@ If merge fails (e.g., branch protections), try: \`gh pr merge <PR_NUM> --merge -
## Step 7: Report
+Summarize:
+- Version released
+- Key changes (from changelog)
+- Number of review iterations needed
+- Any unresolved issues`,
+ // v7 default prompt - pre-database-test provisioning gate
+ `[Improvement: {appName}] Release Check
+
+Repository: {repoPath}
+
+Check if {appName} has accumulated enough work for a release, following the project's own documented release process.
+
+## Step 0: Discover the Release Process
+
+You need to determine these values (use angle-bracket names as placeholders in subsequent steps):
+- \`<SOURCE_BRANCH>\` — where development happens
+- \`<TARGET_BRANCH>\` — where releases go
+- Changelog format and location
+- Pre-release checks (tests, builds)
+- Push/rebase conventions
+
+First, extract \`<OWNER>\` and \`<REPO>\`:
+\`\`\`bash
+cd {repoPath} && gh repo view --json owner,name --jq '"OWNER=" + .owner.login + " REPO=" + .name'
+\`\`\`
+
+Then search for release documentation. Check your CLAUDE.md context (already provided above) for "Git Workflow", "Release", or "Changelog" sections. If the release process is not clear from CLAUDE.md, check these files in order (use whichever exist):
+1. \`cat {repoPath}/README.md\` — look for release/deployment/workflow sections
+2. \`cat {repoPath}/.changelog/README.md\` — changelog format and release conventions
+3. \`cat {repoPath}/CONTRIBUTING.md\` — contributing/release guidelines
+4. \`ls {repoPath}/docs/\` — look for release process docs (e.g., RELEASE.md, DEPLOY.md)
+5. \`ls {repoPath}/.github/workflows/\` — infer branch flow from CI workflow triggers
+6. \`gh api repos/<OWNER>/<REPO>/branches --jq '.[].name'\` — list branches to identify the flow
+
+If no documentation specifies a release flow, fall back to: source=dev, target=main.
+
+## Step 1: Evaluate Readiness
+
+Using the changelog location discovered in Step 0:
+- Read the current changelog (e.g., \`.changelog/NEXT.md\` or \`.changelog/v*.x.md\`)
+- **Also read the entries not yet folded into that file.** Repos that collect per-branch fragments (e.g. \`.changelog/next/\`, so parallel agents don't conflict on a shared file) keep unreleased entries there until the release collects them, so the staged file alone under-counts the work. Read the fragment directory directly, and if the repo's changelog README documents a preview/collect command, use that to assemble the unreleased notes in one call. Do NOT guess a command name — only run one this repo actually documents.
+- Read the current version: \`node -p "require('{repoPath}/package.json').version"\` or equivalent
+
+Count substantive entries (lines starting with "###" or "- **" under Features, Fixes, Improvements sections) across the **assembled** unreleased notes — the staged file plus any uncollected fragments. If fewer than 2 substantive entries exist, stop and report: "Not enough work accumulated for a release." Do NOT create a PR.
+
+## Step 2: Verify Clean State
+
+Run these checks on \`<SOURCE_BRANCH>\` (stop if any fail):
+1. \`git -C {repoPath} fetch origin\` and ensure \`<SOURCE_BRANCH>\` is up to date
+2. Run the project's test suite (use the command from release docs)
+3. Run the project's build (use the command from release docs)
+
+## Step 3: Create or Find PR
+
+Check for existing PR: \`gh pr list --repo <OWNER>/<REPO> --base <TARGET_BRANCH> --head <SOURCE_BRANCH> --state open --json number,url\`
+
+If a PR exists, use it. If not, create one following the project's documented release PR conventions.
+
+Capture the PR number as \`<PR_NUM>\` and URL.
+
+## Step 4: Wait for Copilot Review
+
+Copilot review is triggered automatically on push. Poll every 15 seconds until the review appears:
+\`\`\`bash
+gh api repos/<OWNER>/<REPO>/pulls/<PR_NUM>/reviews --jq '.[] | select(.user.login == "copilot-pull-request-reviewer") | .state'
+\`\`\`
+
+Wait until you see APPROVED or CHANGES_REQUESTED. Timeout after 5 minutes of polling.
+
+## Step 5: Address Feedback Loop (max 5 iterations)
+
+### 5a. Fetch unresolved review threads
+
+Use gh api graphql (JSON input to avoid shell escaping issues with GraphQL variables):
+
+\`\`\`bash
+echo '{"query":"query{repository(owner:\\"<OWNER>\\",name:\\"<REPO>\\"){pullRequest(number:<PR_NUM>){reviewThreads(first:100){nodes{id,isResolved,comments(first:10){nodes{body,path,line,author{login}}}}}}}}"}' | gh api graphql --input -
+\`\`\`
+
+### 5b. If no unresolved threads: skip to Step 6 (Merge).
+
+### 5c. If unresolved threads exist, evaluate each one:
+
+For each comment, read the referenced file and critically evaluate the suggestion:
+- **If the suggestion is valid and improves the code**: apply the fix
+- **If the suggestion is a false positive, overly pedantic, or would make the code worse**: do NOT change the code
+
+Either way, resolve every thread — the goal is zero unresolved threads before merge.
+
+After evaluating all threads:
+- If any code changes were made: run the project's test suite to verify, then commit and push using \`/do:push\` (or manually: stage specific files, conventional commit prefix, \`git pull --rebase && git push\`)
+
+### 5d. Resolve ALL threads via GraphQL mutation (both fixed and dismissed):
+
+For each thread, use the thread node id from 5a:
+\`\`\`bash
+echo '{"query":"mutation{resolveReviewThread(input:{threadId:\\"THREAD_NODE_ID\\"}){thread{isResolved}}}"}' | gh api graphql --input -
+\`\`\`
+
+### 5e. Wait for new Copilot review if code was pushed (repeat Step 4)
+
+If you pushed changes in 5c, the push automatically triggers a new Copilot review. Poll for it, then loop back to 5a. If no code changes were made (all threads were false positives), skip straight to Step 6.
+
+If after 5 iterations there are still unresolved threads, stop and report what remains.
+
+## Step 6: Merge
+
+Only merge when Copilot's most recent review has NO unresolved threads:
+\`\`\`bash
+gh pr merge <PR_NUM> --merge
+\`\`\`
+
+If merge fails (e.g., branch protections), try: \`gh pr merge <PR_NUM> --merge --admin\`
+
+## Step 7: Report
+
Summarize:
- Version released
- Key changes (from changelog)
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index b2aa2bf351..d69bd8b434 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -1269,7 +1269,13 @@ Count substantive entries (lines starting with "###" or "- **" under Features, F
Run these checks on \`<SOURCE_BRANCH>\` (stop if any fail):
1. \`git -C {repoPath} fetch origin\` and ensure \`<SOURCE_BRANCH>\` is up to date
-2. Run the project's test suite (use the command from release docs)
+2. Run the project's test suite (use the command from release docs). If the
+ release docs identify a separate database-backed test suite, first run the
+ documented test-database provisioning/setup command, then run that database
+ test command as well. Keep the database test target isolated from any real
+ user database; never substitute a production database just to make tests
+ pass. If setup cannot reach the documented database service, report the
+ environmental blocker and stop before creating the release PR.
3. Run the project's build (use the command from release docs)
## Step 3: Create or Find PR
diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.js
index 100eb698cc..88f257bd94 100644
--- a/server/services/taskPromptDefaults/versions.js
+++ b/server/services/taskPromptDefaults/versions.js
@@ -39,7 +39,7 @@ export const PROMPT_VERSIONS = {
'ui-bugs': 2, // v2: generic {appName} + the app UI (older default hardcoded "PortOS" + http://localhost:5555)
'mobile-responsive': 2, // v2: generic {appName} app-UI body (older default hardcoded "PortOS" + http://localhost:5555)
'ux': 1, // v1: walk the running UI with Playwright MCP against a 7-item named UX checklist and file ONE tracker item per finding via {trackerInstructions} — read-only on source, no branches/PRs. Net-new type (no PREVIOUS_DEFAULT_PROMPTS entry needed).
- 'release-check': 7, // 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': 8, // 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")
};
// Audit anchor for reference-watch's read/write coupling.
diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.js
index 91f5d98a95..91af2eea56 100644
--- a/server/services/taskSchedule.js
+++ b/server/services/taskSchedule.js
@@ -233,7 +233,7 @@ export const SELF_IMPROVEMENT_TASK_TYPES = [
// Shared taskMetadata posture for the NON-COMMITTING COORDINATOR types
// (NON_COMMITTING_COORDINATOR_TASK_TYPES in taskTypeHooks.js — branch-reconcile /
-// issue-reconcile / jira-status-report). Each delivers its work
+// issue-reconcile / branch-cleanup / jira-status-report / release-check). Each delivers its work
// as a SIDE EFFECT in the app's live checkout — a deleted branch, a merged PR, a
// relabeled issue, a posted report — and by design produces no commit of its own.
// Two code-shipping criteria therefore have to be switched off or every SUCCESSFUL
@@ -392,7 +392,11 @@ export const DEFAULT_TASK_INTERVALS = {
'claim-work': { type: INTERVAL_TYPES.DAILY, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { useWorktree: false, openPR: false, claimFlow: true, simplify: true, issueAuthorFilter: 'self' } },
'error-handling': { type: INTERVAL_TYPES.ROTATION, enabled: false, providerId: null, model: null, prompt: null },
'typing': { type: INTERVAL_TYPES.ONCE, enabled: false, providerId: null, model: null, prompt: null },
- 'release-check': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null },
+ // Release-check inspects and mutates release state (for example, the main →
+ // release PR) rather than producing source commits. It must run from the app's
+ // live main checkout so its branch/ref checks describe the real release flow;
+ // a CoS worktree hides that checkout and creates an irrelevant task branch.
+ 'release-check': { type: INTERVAL_TYPES.ON_DEMAND, enabled: false, providerId: null, model: null, prompt: null, taskMetadata: { ...NON_COMMITTING_COORDINATOR_METADATA } },
'pr-reviewer': { type: INTERVAL_TYPES.CUSTOM, intervalMs: 7200000, enabled: false, weekdaysOnly: true, providerId: null, model: null, prompt: null, taskMetadata: { readOnly: true, pipeline: { stages: [{ name: 'Security Scan', promptKey: 'pr-reviewer-security', readOnly: true }, { name: 'Code Review & Merge', promptKey: 'pr-reviewer-review', readOnly: false }] } } },
'code-reviewer-a': { ...CODE_REVIEWER_INTERVAL },
'code-reviewer-b': { ...CODE_REVIEWER_INTERVAL },
@@ -489,7 +493,8 @@ export const MANAGED_AGENT_OPTIONS = {
'claim-work': ['useWorktree', 'openPR', 'claimFlow'],
// ux's deliverable is tracker issues, not code — it never edits source, so a
// worktree/PR would only produce an empty branch. Lock both off.
- 'ux': ['useWorktree', 'openPR']
+ 'ux': ['useWorktree', 'openPR'],
+ 'release-check': ['useWorktree', 'openPR', 'worktreeChangesExpected']
};
// Strip managed-agent fields from a per-app override map before merging on top
diff --git a/server/services/taskTypeHooks.js b/server/services/taskTypeHooks.js
index 2e364301a9..026539799b 100644
--- a/server/services/taskTypeHooks.js
+++ b/server/services/taskTypeHooks.js
@@ -121,10 +121,10 @@ export function resolveTaskHookType(task) {
* TEMPLATE — its shipped prompt explicitly says "the operator customizes this prompt to
* change what happens on each opened PR" (and it ships `readOnly:false`), i.e. it is
* designed to be rewritten, commonly into a commit-pushing flow, so a type-level exemption
- * would be the wrong default for it. The four types here are complete tasks that finish
+ * would be the wrong default for it. The coordinator types here are complete tasks that finish
* YOUR in-flight work via a git/gh/API side effect. CAVEAT: the exemption keys on the
* SCHEDULED TYPE, not the actual per-install prompt, so an operator who rewrites one of
- * these four prompts to make source commits would have that customized run judged by exit
+ * these coordinator prompts to make source commits would have that customized run judged by exit
* code instead of its commit (a telemetry-accuracy tradeoff, not a functional bug). A
* per-task `noCommitCriterion` contract would remove that caveat but complicates the
* migration's static type→bucket mapping; deferred as not worth it for the default case.
@@ -134,7 +134,7 @@ export function resolveTaskHookType(task) {
* buckets these already poisoned on existing installs.
*/
export const NON_COMMITTING_COORDINATOR_TASK_TYPES = new Set([
- 'branch-reconcile', 'issue-reconcile', 'branch-cleanup', 'jira-status-report',
+ 'branch-reconcile', 'issue-reconcile', 'branch-cleanup', 'jira-status-report', 'release-check',
]);
/**