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

address review: accurate failure-cleanup wording; skip git-test if git missing

Adam Eivy86a42b78a655
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index eff0af1067..96083f4e0e 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -325,7 +325,7 @@ ${skillSection ? `## Task-Type Skill Guidelines\n\n${skillSection}\n` : ''}${too
- If blocked, explain clearly why
- Never update the PortOS changelog (\`.changelog/\`) for work on managed apps — the PortOS changelog tracks PortOS core changes only
- **BTW Messages**: The user may send you additional context while you work. Check for a \`BTW.md\` file in your working directory root — if it exists, read it for important messages from the user. Incorporate that context into your work. Do not delete or modify BTW.md.
-${isTruthyMetaFn(task.metadata?.readOnly) ? `- **This is a read-only task.** Do NOT commit, push, or modify any files in the repository. Only read data and generate reports.` : worktreeInfo && willOpenPR ? `- On successful completion, the system will push your branch and open a pull request — do NOT open a PR manually. (If the task fails, the worktree is preserved for debugging and no PR is opened.)${willReviewLoop ? ' For GitHub PRs, a Copilot code review will also be requested automatically (skipped on GitLab and other non-GitHub forges) — do NOT run \`/do:rpr\` or attempt to address review comments yourself; you will have already exited.' : ''}` : worktreeInfo ? `- Your worktree branch will be automatically merged back to the source branch when your task completes — do NOT open a PR.` : ``}
+${isTruthyMetaFn(task.metadata?.readOnly) ? `- **This is a read-only task.** Do NOT commit, push, or modify any files in the repository. Only read data and generate reports.` : worktreeInfo && willOpenPR ? `- On successful completion, the system will push your branch and open a pull request — do NOT open a PR manually. (If the task fails, no PR is opened; the worktree is then cleaned up unless a safety check preserves it for manual recovery.)${willReviewLoop ? ' For GitHub PRs, a Copilot code review will also be requested automatically (skipped on GitLab and other non-GitHub forges) — do NOT run \`/do:rpr\` or attempt to address review comments yourself; you will have already exited.' : ''}` : worktreeInfo ? `- Your worktree branch will be automatically merged back to the source branch when your task completes — do NOT open a PR.` : ``}
## Git Hygiene (CRITICAL)
- **Before starting work**, run \`git status\` to verify a clean working tree. Do NOT stash or discard uncommitted changes — other agents may be working concurrently and expecting those changes to be present. If the tree is dirty, only commit files YOU changed for this task.
diff --git a/server/services/git.test.js b/server/services/git.test.js
index 0e9c4c636e..ab81331dce 100644
--- a/server/services/git.test.js
+++ b/server/services/git.test.js
@@ -187,8 +187,15 @@ describe('requestCopilotReview', () => {
// back to cli: 'gh' and the test would silently pass even if the skip path broke.
const { mkdtempSync, rmSync } = await import('fs');
const { tmpdir } = await import('os');
- const { execSync } = await import('child_process');
+ const { execSync, spawnSync } = await import('child_process');
const path = await import('path');
+
+ // CI environments without `git` should not fail this test — bail out cleanly.
+ // spawnSync returns { status: null, error } on ENOENT instead of throwing,
+ // so we can probe for git availability without try/catch.
+ const probe = spawnSync('git', ['--version'], { stdio: 'ignore' });
+ if (probe.status !== 0) return;
+
const repo = mkdtempSync(path.join(tmpdir(), 'portos-git-skip-'));
try {
execSync('git init -q', { cwd: repo });