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(cos): use baseBranch for PR target, improve prompt and docs
Adam Eivy91605dfd4f79
diff --git a/server/lib/taskParser.js b/server/lib/taskParser.jsindex 069f5f9081..b786daf01b 100644--- a/server/lib/taskParser.js+++ b/server/lib/taskParser.js@@ -137,7 +137,10 @@ function escapeNewlines(value) {/*** Parse metadata line (indented under task)- * Format: - Key: Value+ * Format: - key: Value+ * Keys are written in camelCase (e.g., openPR, useWorktree, reviewLoop).+ * Legacy Title-Case keys (e.g., Context, App) are accepted and normalized+ * to camelCase by lowercasing the first character.*/function parseMetadataLine(line) {const match = line.match(/^\s+-\s*(\w+):\s*(.+)$/);diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.jsindex 9e877ec734..89a061bca1 100644--- a/server/services/cleanupAgentWorktree.test.js+++ b/server/services/cleanupAgentWorktree.test.js@@ -272,7 +272,7 @@ describe('cleanupAgentWorktree - openPR path', () => {expect(removeWorktree).toHaveBeenCalledWith('agent-1', '/mock/workspace', 'cos/task-abc123', { merge: false });});- it('should use devBranch as PR base when available', async () => {+ it('should use baseBranch as PR base (not devBranch, since worktrees are created from baseBranch)', async () => {git.push.mockResolvedValue(undefined);git.createPR.mockResolvedValue({ success: true, url: 'https://github.com/test/repo/pull/3' });git.getRepoBranches.mockResolvedValue({ baseBranch: 'main', devBranch: 'develop' });@@ -280,7 +280,7 @@ describe('cleanupAgentWorktree - openPR path', () => {await cleanupAgentWorktree('agent-1', true, { openPR: true, description: 'Test' });expect(git.createPR).toHaveBeenCalledWith(expect.any(String), expect.objectContaining({- base: 'develop'+ base: 'main'}));});diff --git a/server/services/subAgentSpawner.js b/server/services/subAgentSpawner.jsindex ba4d082918..f303a99d6d 100644--- a/server/services/subAgentSpawner.js+++ b/server/services/subAgentSpawner.js@@ -1984,7 +1984,8 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, d// Only create PR if push succeeded; preserve worktree/branch for manual intervention if push failsif (pushResult) {- const targetBranch = branchInfo.devBranch || branchInfo.baseBranch || 'main';+ // Use baseBranch (not devBranch) since worktrees are created from the default branch+ const targetBranch = branchInfo.baseBranch || 'main';const taskDesc = description || 'CoS automated task';const prTitle = taskDesc.replace(/[\r\n]+/g, ' ').trim().substring(0, 100);@@ -2803,7 +2804,7 @@ ${skillSection ? `## Task-Type Skill Guidelines\n\n${skillSection}\n` : ''}${pla- Do not make unrelated changes- If blocked, explain clearly why- Never update the PortOS changelog (\`.changelog/\`) for work on managed apps — the PortOS changelog tracks PortOS core changes only-${task.metadata?.app && worktreeInfo && willOpenPR ? `- Commit code after each feature or bug fix using the git tools or /cam skill. A pull request will be automatically created when your task completes — do NOT open a PR manually.` : task.metadata?.app && worktreeInfo ? `- Commit code after each feature or bug fix using the git tools or /cam skill. Your worktree branch will be automatically merged back to the default branch when your task completes — do NOT open a PR.` : `- Commit code after each feature or bug fix using the git tools or /cam skill`}+${task.metadata?.app && worktreeInfo && willOpenPR ? `- Commit code after each feature or bug fix using the git tools or /cam skill. A pull request will be automatically created when your task completes — do NOT open a PR manually.` : task.metadata?.app && worktreeInfo ? `- Commit code after each feature or bug fix using the git tools or /cam skill. Your worktree branch will be automatically merged back to the source branch when your task completes — do NOT open a PR.` : `- Commit code after each feature or bug fix using the git tools or /cam skill`}## Git Hygiene (CRITICAL)- **Before starting work**, run \`git status\` to verify a clean working tree. If there are uncommitted changes from a previous agent or manual work, **stash or discard them** before proceeding — do NOT commit someone else's changes.