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
feat(cos): route claim-work on JIRA apps to a per-ticket claim-issue-jira flow
Adam Eivybf06d8d2a67e
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 97034c0694..12a20f8161 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -40,7 +40,7 @@## Changed-- The **Social Agents** page now lives under the **Chief of Staff** sidebar section instead of **Brain**, in both the sidebar and the ⌘K / voice nav manifest.+- **`claim-work` on a JIRA app now claims and ships ONE sprint ticket instead of running the broad sprint-manager triage job.** When an app's Work Tracker resolves to JIRA, the scheduled `claim-work` flow (and the `/do:next` button) used to route to `jira-sprint-manager` — which triages *every* sprint ticket and only then implements the top one as a CoS-managed run, and which left the ticket's status untouched after opening the MR. The JIRA route now uses a new per-ticket `claim-issue-jira` flow, the JIRA sibling of the GitHub/GitLab claim-issue flows: it picks the next ready ("To Do") ticket assigned to you in the active sprint, moves it **To Do → In Progress** before coding, implements it in its own `claim/<KEY>` worktree, opens an MR/PR referencing the ticket (forge auto-detected — `gh` or `glab`), then moves the ticket **→ In Review** and comments the MR/PR link. It leaves the MR/PR open for a human to land (no auto-merge). The standalone **JIRA Sprint Manager** scheduled job is unchanged and still available on its own for full-sprint triage. (`server/lib/workTracker.js`, `server/services/taskPromptDefaults/prompts.js`)- The **Songs** workbench is now called **Rounds** (its real subject is musical rounds — Hey Ho Nobody Home, the quodlibet trio, the "500 Miles" worked example). This is a full-stack rename: the page moved from `/songs` to `/rounds`, the API from `/api/songs` to `/api/rounds`, and the on-disk store from `data/songs.json` to `data/rounds.json` (top-level `songs[]` → `rounds[]`, per-record `partnerSongIds` → `partnerRoundIds`). An auto-running migration (120) converts existing installs on the next boot/update, preserving every saved round, recording, and training-progress record — nothing to do by hand. The ⌘K palette and voice navigation still resolve "songs"/"song" to the page, so old muscle memory keeps working.## Fixed@@ -82,7 +82,7 @@## Fixed- **The Local LLM installer no longer offers Ollama a sharded GGUF it can't pull.** Picking a large quant whose GGUF is split into parts (e.g. `unsloth/Qwen3-Coder-Next-GGUF:UD-Q8_K_XL`, ~80 GB across two files) failed with Ollama's raw `400: The specified tag is a sharded GGUF. Ollama does not support this yet.` ([ollama/ollama#5245](https://github.com/ollama/ollama/issues/5245)). The Hugging Face catalog already detected multi-part shards (it sums their sizes) but still presented them as Ollama-installable. Each variant now carries a `sharded` flag; on the Ollama backend a sharded quant is marked unsupported, the quant picker tags it `· sharded (not on Ollama)`, the **Install** button is disabled with the reason, and the RAM-aware default skips it so it never auto-selects a build that can't be pulled. LM Studio is unaffected — it loads sharded GGUFs natively, so the same quant stays installable there. As defense-in-depth for the pull-by-name path, an Ollama pull that hits the sharded-GGUF 400 is now tagged `code: SHARDED_GGUF` and surfaces an actionable toast ("pick a smaller single-file quant, or install on LM Studio") instead of the raw error. (`server/services/huggingFaceCatalog.js`, `server/services/ollamaManager.js`, `client/src/components/settings/LocalLlmTab.jsx`)-- **The `/do:next` Slashdo button now honors the app's Work Tracker.** Per-app Work Tracker (PLAN.md / GitHub / GitLab / JIRA) already routed the *scheduled* `claim-work` flow, but the manual `/do:next` button inlined the raw slashdo command body — which always drains PLAN.md unless `--issues` is passed. Clicking it for an app set to GitHub/GitLab/JIRA Issues silently worked the wrong queue. The button now resolves the app's Work Tracker and delegates to the same claim flow the scheduler uses (`plan-task` / `claim-issue` / `claim-issue-gitlab` / `jira-sprint-manager`, via a shared `buildClaimWorkTask` router that also drives the scheduled path), inheriting the JIRA flow's CoS-managed worktree+PR isolation. It also resolves the same configured `claim-work` metadata the scheduler does (global → per-app override → Code Review Defaults), so clicking it honors the app's `issueAuthorFilter` (e.g. claim any open issue, not just owner-filed) and configured reviewers instead of silently forcing owner-only + Copilot. The task description and button tooltip now read generically ("claim the next work item per this app's Work Tracker") instead of naming PLAN.md.+- **The `/do:next` Slashdo button now honors the app's Work Tracker.** Per-app Work Tracker (PLAN.md / GitHub / GitLab / JIRA) already routed the *scheduled* `claim-work` flow, but the manual `/do:next` button inlined the raw slashdo command body — which always drains PLAN.md unless `--issues` is passed. Clicking it for an app set to GitHub/GitLab/JIRA Issues silently worked the wrong queue. The button now resolves the app's Work Tracker and delegates to the same claim flow the scheduler uses (`plan-task` / `claim-issue` / `claim-issue-gitlab` / `claim-issue-jira`, via a shared `buildClaimWorkTask` router that also drives the scheduled path), each of which self-manages its own worktree + MR/PR. It also resolves the same configured `claim-work` metadata the scheduler does (global → per-app override → Code Review Defaults), so clicking it honors the app's `issueAuthorFilter` (e.g. claim any open issue, not just owner-filed) and configured reviewers instead of silently forcing owner-only + Copilot. The task description and button tooltip now read generically ("claim the next work item per this app's Work Tracker") instead of naming PLAN.md.- **The GitHub Release workflow no longer crashes on a large changelog.** The v2.22.0 release (a ~175KB changelog) failed at the "Create Release" step with `Argument list too long`: the changelog was passed to `softprops/action-gh-release` as the `body:` input, which GitHub materializes as an `INPUT_BODY` environment variable, and a 175KB env var overflows `ARG_MAX` when the action's Node process is exec'd. The body also exceeds GitHub's hard 125,000-character release-note limit (a separate HTTP 422). The workflow now writes the (placeholder-substituted) changelog to a file and feeds it via `body_path:` instead of an env var, and caps it at 120,000 chars on a whole-line boundary — appending a pointer to the full changelog file at the tag when truncated. (`.github/workflows/release.yml`)- Scheduled-task descriptions in the Automation UI no longer fall back to a raw dasherized label. `claim-work` (the single-source work-tracker router), `code-reviewer-a`/`code-reviewer-b`, and `do-replan` now show real one-line descriptions instead of "claim work" / "code reviewer a", which read as orphaned/legacy tasks. A parity guard test now keeps the description map in sync with the task-type list.- PM2 standardization no longer assigns ports that are already in use. The analysis now feeds the AI the set of listening/reserved ports (plus the common Vite defaults 5173/5174) to avoid, and a deterministic post-pass reassigns any port that still collides into the 6000–6099 range — so standardizing an app never lands on a port another app already holds.diff --git a/server/lib/workTracker.js b/server/lib/workTracker.jsindex 2b26890306..8046227645 100644--- a/server/lib/workTracker.js+++ b/server/lib/workTracker.js@@ -70,15 +70,20 @@ export function forgeCliForTracker(tracker) {* plan → plan-task (PLAN.md flow)* github → claim-issue (gh issue flow)* gitlab → claim-issue-gitlab (glab issue flow)- * jira → jira-sprint-manager (JIRA flow)+ * jira → claim-issue-jira (JIRA sprint-ticket flow)* Returns null for an unknown tracker.+ *+ * Note: 'jira' routes to the per-ticket `claim-issue-jira` flow (claim ONE ready+ * sprint ticket, ship it, move it To Do → In Progress → In Review), NOT the+ * broader `jira-sprint-manager` triage job — that remains a separate standalone+ * scheduled task.*/export function trackerToClaimTaskType(tracker) {switch (tracker) {case 'plan': return 'plan-task';case 'github': return 'claim-issue';case 'gitlab': return 'claim-issue-gitlab';- case 'jira': return 'jira-sprint-manager';+ case 'jira': return 'claim-issue-jira';default: return null;}}diff --git a/server/lib/workTracker.test.js b/server/lib/workTracker.test.jsindex 175cd192fc..4ce3a0bc6e 100644--- a/server/lib/workTracker.test.js+++ b/server/lib/workTracker.test.js@@ -53,7 +53,7 @@ describe('trackerToClaimTaskType', () => {expect(trackerToClaimTaskType('plan')).toBe('plan-task');expect(trackerToClaimTaskType('github')).toBe('claim-issue');expect(trackerToClaimTaskType('gitlab')).toBe('claim-issue-gitlab');- expect(trackerToClaimTaskType('jira')).toBe('jira-sprint-manager');+ expect(trackerToClaimTaskType('jira')).toBe('claim-issue-jira');expect(trackerToClaimTaskType('auto')).toBeNull();expect(trackerToClaimTaskType('nonsense')).toBeNull();});diff --git a/server/routes/cosTaskRoutes.js b/server/routes/cosTaskRoutes.jsindex db9d033232..816ef5f9d4 100644--- a/server/routes/cosTaskRoutes.js+++ b/server/routes/cosTaskRoutes.js@@ -103,7 +103,10 @@ router.post('/tasks/slashdo', asyncHandler(async (req, res) => {const claim = await buildClaimWorkTask(appObj);context = claim.prompt;// claim.taskMetadata overrides the false/false default only where it carries- // a key (jira-sprint-manager flips both to CoS-managed worktree+PR).+ // a key. All current claim flows (plan-task / claim-issue / claim-issue-gitlab+ // / claim-issue-jira) self-manage their worktree + MR/PR, so false/false+ // stands; the spread stays for a future delegated type that needs CoS-managed+ // isolation.taskMetadata = { ...taskMetadata, ...claim.taskMetadata };description = `Run /do:next for ${appObj.name} — claim next ${workTrackerLabel(claim.tracker)} item and ship a PR`;} else {diff --git a/server/services/cosTaskGenerator.js b/server/services/cosTaskGenerator.jsindex d5221919dd..476f8fe955 100644--- a/server/services/cosTaskGenerator.js+++ b/server/services/cosTaskGenerator.js@@ -180,9 +180,9 @@ export function resolveIssueAuthorFilterBlock(promptTaskType, mode = 'owner') {* configured workTracker — the manual (Slashdo `/do:next` button) counterpart to* the scheduled `claim-work` router below. Resolves the tracker, delegates to the* matching claim prompt body (plan-task / claim-issue / claim-issue-gitlab /- * jira-sprint-manager), substitutes the standard placeholders, and surfaces the- * delegated flow's worktree/PR posture (jira-sprint-manager needs CoS-managed- * isolation; the plan/github/gitlab prompts self-manage their worktree + PR).+ * claim-issue-jira), substitutes the standard placeholders, and surfaces the+ * delegated flow's worktree/PR posture (all four claim prompts self-manage their+ * own worktree + MR/PR, so the self-managed false/false posture is correct).** `issueAuthorFilter` and `reviewers` default to the app's *configured** `claim-work` behavior (global schedule metadata → per-app override → Code@@ -1411,13 +1411,13 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, stpromptTaskType = trackerToClaimTaskType(wt.resolved) || 'plan-task';emitLog('info', `claim-work for ${app.name}: tracker=${wt.resolved} (${wt.source}) → ${promptTaskType}`, { appId: app.id, analysisType: taskType });// Inherit the resolved flow's isolation posture, overriding claim-work's- // own useWorktree/openPR=false defaults. The plan/github/gitlab claim- // prompts self-manage their worktree + PR (false/false is correct), but- // jira-sprint-manager relies on CoS-MANAGED isolation (useWorktree/openPR- // true) and implements directly in {repoPath} — so without this the JIRA- // route would run against the live checkout. Pull the delegated type's- // managed-agent defaults; a prompt-only type with no DEFAULT_TASK_INTERVALS- // entry (e.g. claim-issue-gitlab) keeps claim-work's self-managed false.+ // own useWorktree/openPR=false defaults. All four concrete claim prompts+ // (plan-task / claim-issue / claim-issue-gitlab / claim-issue-jira)+ // self-manage their own worktree + MR/PR, so the self-managed false/false+ // posture is correct for every tracker. This hook stays in place so a+ // future delegated type that DOES carry a CoS-managed DEFAULT_TASK_INTERVALS+ // entry (useWorktree/openPR true) would have it applied; a prompt-only type+ // with no entry (claim-issue-gitlab, claim-issue-jira) keeps false/false.const delegatedMeta = taskSchedule.DEFAULT_TASK_INTERVALS[promptTaskType]?.taskMetadata;if (delegatedMeta) {if ('useWorktree' in delegatedMeta) metadata.useWorktree = delegatedMeta.useWorktree;@@ -1427,9 +1427,10 @@ export async function generateManagedAppImprovementTaskForType(taskType, app, st// Honor a direct claim-work prompt customization if the user set one;// otherwise delegate to the resolved tracker's prompt body via// getTaskPrompt(promptTaskType), which reads THAT type's interval.prompt- // override — so a user's claim-issue / plan-task / jira-sprint-manager- // customization flows through. (The GitLab body, claim-issue-gitlab, has no- // schedule/UI customization slot, so it always renders the shipped default.)+ // override — so a user's claim-issue / plan-task customization flows+ // through. (The prompt-only bodies claim-issue-gitlab and claim-issue-jira+ // have no schedule/UI customization slot, so they always render the shipped+ // default.)const promptKeyForBody = (taskType === 'claim-work' && !interval.prompt) ? promptTaskType : taskType;const promptTemplate = metadata.pipeline?.stagesdiff --git a/server/services/cosTaskGenerator.test.js b/server/services/cosTaskGenerator.test.jsindex 468ef406a4..f55d218f69 100644--- a/server/services/cosTaskGenerator.test.js+++ b/server/services/cosTaskGenerator.test.js@@ -81,7 +81,7 @@ describe('{reviewers} interpolation honors Code Review Defaults', () => {// claim-work is the single-source router: one toggle that resolves the app's// workTracker (default 'auto' → git origin host) and delegates to the matching// claim prompt body — plan→plan-task, github→claim-issue, gitlab→claim-issue-gitlab,-// jira→jira-sprint-manager. These source-level guards pin that wiring so a+// jira→claim-issue-jira. These source-level guards pin that wiring so a// future edit can't silently drop the resolution, the delegated prompt// selection, the PLAN gate routing, or the GitLab forge directive.describe('claim-work single-source routing', () => {@@ -111,10 +111,11 @@ describe('claim-work single-source routing', () => {expect(GEN_SRC).toContain('glab issue list');});- it('inherits the delegated flow isolation posture so the JIRA route keeps CoS worktree+PR', () => {- // claim-work forces useWorktree/openPR=false (correct for the self-managing- // plan/github/gitlab claim prompts) but jira-sprint-manager needs CoS-managed- // isolation — pull the delegated type's DEFAULT_TASK_INTERVALS metadata.+ it('pulls the delegated flow isolation posture from DEFAULT_TASK_INTERVALS metadata', () => {+ // claim-work forces useWorktree/openPR=false, correct for all four+ // self-managing claim prompts (plan/github/gitlab/jira). The hook stays so a+ // future delegated type that DOES need CoS-managed isolation would have its+ // DEFAULT_TASK_INTERVALS metadata applied here.expect(GEN_SRC).toContain('taskSchedule.DEFAULT_TASK_INTERVALS[promptTaskType]?.taskMetadata');expect(GEN_SRC).toContain("'useWorktree' in delegatedMeta");expect(GEN_SRC).toContain("'openPR' in delegatedMeta");diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.jsonindex 14b7bc8651..58c96a350c 100644--- a/server/services/taskPromptDefaults/integrity.snapshot.json+++ b/server/services/taskPromptDefaults/integrity.snapshot.json@@ -14,6 +14,7 @@"plan-task": "5425306bf082b15b6a17f972557d4dd9","claim-issue": "28f09436566c281a6915d6ad4c1b80f8","claim-issue-gitlab": "880dd7820ac90c689065e28cdca032fb",+ "claim-issue-jira": "157cfc80c3d00bcbf3e97aae3998c372","code-reviewer-review": "1cd13ee5142d130f95cc390098d0f278","code-reviewer-implement": "ab2c3e16d54e195bdf856574b7702042","error-handling": "9afba2e99b90a8d5771c75e7f0615d96",@@ -35,6 +36,7 @@"plan-task": 8,"claim-issue": 2,"claim-issue-gitlab": 1,+ "claim-issue-jira": 1,"pr-reviewer": 3,"code-reviewer-a": 1,"code-reviewer-b": 1,diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.jsindex 9b01633fd8..51e9869ca0 100644--- a/server/services/taskPromptDefaults/prompts.js+++ b/server/services/taskPromptDefaults/prompts.js@@ -728,6 +728,125 @@ git branch -d "claim/issue-\${NUM}"If \`git branch -d\` refuses, use \`-D\` — the MR is confirmed merged, so the local branch is redundant. Verify the issue closed (the \`Closes #\${NUM}\` line auto-closes it on merge to the default branch); if it's still open, close it manually (\`glab issue close "\${NUM}"\`) and remove the \`in-progress\` label (\`glab issue update "\${NUM}" --unlabel in-progress\`). **Do NOT \`git pull\`** from inside this phase — the work is already integrated on GitLab via \`glab mr merge\`; leave the user's working tree alone.`,+ // JIRA sibling of 'claim-issue' / 'claim-issue-gitlab'. SAME claim-one-item,+ // self-managed-worktree, ship-and-review shape — but the work source is the+ // app's configured JIRA project (reached through the PortOS JIRA API, so it+ // works on any install with JIRA configured, no `jira` CLI required), the+ // "claim" is the To Do → In Progress transition (JIRA has no assignee/label+ // dance — my-sprint-tickets is already scoped to me), and the forge (gh vs+ // glab for the MR/PR) is detected from the git origin. There is NO+ // \`Closes #\` auto-close — JIRA tickets are not closed by a git merge, so the+ // ticket is left "In Review" with the MR/PR linked for a human to land.+ // Reached only via the claim-work router when an app's resolved workTracker+ // is 'jira'. Keep the git/MR/review phases in lockstep with claim-issue-gitlab.+ 'claim-issue-jira': `[Claim Issue: {appName}] Claim and ship the next ready JIRA ticket++Pick the next ready JIRA ticket assigned to me in the current sprint, move it to **In Progress**, **create your own worktree at \`claim/<KEY>\`**, implement it, open a merge/pull request that references the ticket, move the ticket to **In Review**, and clean up. This is the \`/claim --issues\` flow for JIRA: same self-managed worktree and no-local-merge cleanup, but the work source is the app's **JIRA** project (via the PortOS JIRA API) and the ticket *status* — not an assignee/label — is the claim. **YOU pick the ticket in Phase 1.** Do NOT modify files in the source repo directly; ALL editing happens inside the worktree you create.++All PortOS API calls below are relative to this base URL: ${PORTOS_API_URL}++**How claiming works.** A ticket is "in flight" when (a) a \`claim/<KEY>\` or \`cos/<task>/<KEY>/<agent>\` ref exists across local branches, remote branches, or open MR/PR source refs, OR (b) its JIRA status is anything other than a not-started status (so "In Progress", "In Review", "Done", etc. are already taken). Moving the ticket to **In Progress** + the \`claim/<KEY>\` branch ARE the claim, visible to every other agent and to the human looking at the sprint board.++## Phase 1 — Pick the target ticket++Run steps 1–5 in order.++1. Resolve the app's JIRA config: GET ${PORTOS_API_URL}/api/apps and find the app whose \`id\` is \`{appId}\`. Read \`jira.enabled\`, \`jira.instanceId\`, and \`jira.projectKey\`. If \`jira.enabled\` is not true or either id is missing, exit cleanly — this task only works against JIRA-configured apps.+2. Fetch my current-sprint tickets: GET ${PORTOS_API_URL}/api/jira/instances/<instanceId>/my-sprint-tickets/<projectKey>. This returns the tickets assigned to me in the active sprint.+3. Build the in-flight set from git refs:+ \`\`\`bash+ cd {repoPath}+ git fetch --prune 2>/dev/null+ git branch -a --no-color --format='%(refname:short)'+ \`\`\`+ For each ref (after stripping any leading \`origin/\` / \`upstream/\` prefix), extract the ticket KEY **only when the ref matches** \`claim/<KEY>\` (the segment after \`claim/\`) or \`cos/<task>/<KEY>/<agent>\` (the \`<KEY>\` third segment). A KEY looks like \`PROJ-1234\`.+4. **Pick the target ticket:** walk the sprint tickets and pick the FIRST where ALL of the following are true (prefer higher priority — Blocker/Highest/High — then oldest):+ - Its status is a not-started status (e.g. "To Do", "Open", "Backlog", "Selected for Development", "Ready"). Skip tickets already "In Progress", "In Review", "Done", or any closed/resolved status — those are claimed or finished.+ - Its KEY is NOT in the in-flight set from step 3.+ - It is well-defined: a summary plus enough description/acceptance criteria to implement without further clarification.+ - It is NOT an Epic (issue type "Epic", or a title ending in "(epic)"). Leave epics for a human to split.+5. **If no eligible ticket exists**, exit cleanly — an empty actionable queue is a healthy state, not a failure. If a ticket is in the sprint but too vague or blocked to start, create a Review Hub todo (POST ${PORTOS_API_URL}/api/review/todo with title "[<KEY>] Needs clarification" or "[<KEY>] Blocked" and a description of what's missing) instead of claiming it.++Capture the ticket KEY as \`KEY\`, its summary, and its full description — you'll reuse them in the branch, the MR/PR, and the commit trailer.++## Phase 2 — Claim (In Progress + worktree)++First move the ticket to **In Progress** (this is the claim, and it must happen BEFORE you start coding), then create the worktree. Transition names vary per project workflow, so resolve the id dynamically:++1. GET ${PORTOS_API_URL}/api/jira/instances/<instanceId>/tickets/<KEY>/transitions to list available transitions.+2. Pick the transition whose target status best matches "In Progress" (e.g. "In Progress", "Start Progress", "Start Work"); match case-insensitively. If none clearly matches, pick the transition that moves the ticket out of the To Do / Backlog column.+3. POST ${PORTOS_API_URL}/api/jira/instances/<instanceId>/tickets/<KEY>/transition with body {"transitionId": "<id>"}. If this fails (the status is unreachable), the ticket may have been claimed concurrently — return to Phase 1 and pick the next eligible ticket.++Then create the worktree on a branch named \`claim/<KEY>\`. Do all editing inside the worktree, NEVER in the source repo's working tree:++\`\`\`bash+KEY=<picked-key>+DEFAULT_BRANCH="$(git -C {repoPath} symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null | sed 's@^origin/@@')"+DEFAULT_BRANCH="\${DEFAULT_BRANCH:-main}"+WORKTREE="{repoPath}/data/cos/worktrees/claim-\${KEY}"+mkdir -p "{repoPath}/data/cos/worktrees"+git -C {repoPath} fetch origin "\${DEFAULT_BRANCH}"+git -C {repoPath} worktree add -b "claim/\${KEY}" "\${WORKTREE}" "origin/\${DEFAULT_BRANCH}"+cd "\${WORKTREE}"+\`\`\`++**If \`git worktree add\` fails because the \`claim/<KEY>\` branch already exists** (a concurrent run won the race), do NOT force or reuse it — that branch IS another run's claim. Move the ticket back to its prior status if you transitioned it, treat the ticket as in-flight, return to Phase 1, and pick the next eligible ticket. Stash \`WORKTREE\` — you'll need it for Phase 6 cleanup.++## Phase 3 — Verify still valid++Re-read the ticket (GET ${PORTOS_API_URL}/api/jira/instances/<instanceId>/tickets/<KEY>) before writing any code. **If ANY of these are true, release the claim and re-pick** (transition the ticket back to its not-started status, remove the worktree, return to Phase 1):++- The ticket references a function, file, or component that no longer exists (\`grep -rn\` the named identifiers — if they're gone, it's stale).+- The work would require touching files far outside the ticket's scope (>5 unrelated files), suggesting it's bigger than a single claim.+- The requirements are too ambiguous to implement without user clarification — in that case also create a Review Hub todo ("[<KEY>] Needs clarification") so a human can refine it.++Do NOT leave a half-claimed ticket parked "In Progress" with no branch.++## Phase 4 — Implement++Write the code, tests, and any docs the ticket requires. Follow the repo conventions in CLAUDE.md (no try/catch in route handlers, functional programming, Zod validation, Tailwind tokens, reactive UI updates). Run the relevant test suite as you go.++**Roll discovered backbone work INTO this MR/PR** — small supporting helpers, refactors, and tests the fix depends on belong here, not a follow-up. Only defer genuinely-large adjacent work.++Commit with a conventional message referencing the ticket so the trail is grep-able:++\`\`\`+<type>: <one-line description> (<KEY>)+\`\`\`++## Phase 5 — Open the MR/PR and move to In Review++The audit trail is the merged MR/PR + \`git log\`. Detect the forge from the git origin and use the matching CLI (\`gh\` for GitHub, \`glab\` for GitLab).++1. If the repo maintains a changelog (\`.changelog/NEXT.md\`, or a \`## Unreleased\` section in \`CHANGELOG.md\`), append a one-line entry mirroring the repo's existing prose style. Otherwise skip it.+2. Push the branch: \`git push -u origin "claim/\${KEY}"\`+3. Open the MR/PR. Reference the JIRA \`KEY\` in the title and description (there is NO \`Closes\` auto-close for JIRA). Summarize what shipped + a short test plan.+ - GitHub: \`gh pr create --fill --head "claim/\${KEY}"\` (then edit the body to mention \`KEY\` if \`--fill\` didn't).+ - GitLab: \`glab mr create --fill --source-branch "claim/\${KEY}" --target-branch "\${DEFAULT_BRANCH}" --yes\`.+ Capture the MR/PR URL as \`PR_URL\`.+4. **Move the ticket to "In Review" — REQUIRED, not optional. Do not finish while it is still "In Progress":**+ - GET ${PORTOS_API_URL}/api/jira/instances/<instanceId>/tickets/<KEY>/transitions again (transitions change once In Progress).+ - Pick the transition whose target status best matches "In Review" (e.g. "In Review", "Code Review", "Review", "Ready for Review"); match case-insensitively.+ - POST ${PORTOS_API_URL}/api/jira/instances/<instanceId>/tickets/<KEY>/transition with body {"transitionId": "<id>"}.+5. Add the MR/PR link to the ticket: POST ${PORTOS_API_URL}/api/jira/instances/<instanceId>/tickets/<KEY>/comments with body {"comment": "Implementation complete. MR/PR: \${PR_URL}\\n\\nReady for code review."}. If a transition in step 4 failed (status unreachable), say so in this comment AND in the Phase 6 summary — do not silently drop it.++## Phase 6 — Review and clean up++The configured reviewers for this task, in order, are \`{reviewers}\`. \`claude\` / \`codex\` / \`antigravity\` invoke a local-CLI critique. (\`copilot\` is GitHub-only — skip it on GitLab.) When more than one is configured, run each in the listed order.++1. **Self-review your diff for reuse, quality, and efficiency** (DRY, dead code, naming, simpler equivalents, missed edge cases) and fix findings in the same diff. Claude Code runs this as the three-agent \`/simplify\` pass; on other CLIs, do the equivalent by hand.+2. **Run each configured CLI reviewer** headless against the MR/PR diff, apply fixes, run tests, re-push — capped at 3 rounds — then advance to the next reviewer.+3. **Leave the MR/PR open for a human to land.** Unlike the GitHub/GitLab issue flows, this flow does NOT auto-merge — the ticket is "In Review" and a human reviews + merges. After the reviewers finish, run the worktree-only cleanup so the source checkout is left clean:+ \`\`\`bash+ cd {repoPath}+ git worktree remove "\${WORKTREE}"+ \`\`\`+ Leave the local \`claim/<KEY>\` branch and the open MR/PR in place. **Do NOT \`git merge\`, \`gh pr merge\`, \`glab mr merge\`, or \`git pull\`** — landing the change and moving the ticket to Done is the human's call.++## Phase 7 — Report++Generate a short summary: the ticket KEY + summary worked, the MR/PR URL, the ticket's FINAL JIRA status (confirm it is "In Review"), reviewers run, and any status transition that failed and why.`,+'code-reviewer-review': `[Review: {appName}] Deep Codebase Review (Stage 1)Perform a comprehensive review of {appName} and write your findings to REVIEW.md.diff --git a/server/services/taskPromptDefaults/versions.js b/server/services/taskPromptDefaults/versions.jsindex 5863bc0630..ad34c8b00c 100644--- a/server/services/taskPromptDefaults/versions.js+++ b/server/services/taskPromptDefaults/versions.js@@ -11,6 +11,7 @@ export const PROMPT_VERSIONS = {'plan-task': 8, // v8: Phase-6 merge fallback prefers --merge over --squash (after --auto), matching the /do:pr + review-loop default and PortOS's merge-only policy'claim-issue': 2, // v2: stop treating the bare `plan` label as a skip — `plan` is the claimable-queue label (do-replan --issues labels every migrated backlog item `plan`), so v1's exclusion emptied the whole actionable queue; now skip only true epics (`epic` label or "(epic)" title)'claim-issue-gitlab': 1, // v1: GitLab sibling of claim-issue — same 7-phase /claim --issues flow over `glab` issues + merge requests. Reached via the claim-work router when an app's resolved workTracker is 'gitlab'.+ 'claim-issue-jira': 1, // v1: JIRA sibling of claim-issue — claim ONE ready sprint ticket, move it To Do→In Progress→In Review around a self-managed worktree + MR/PR. Reached via the claim-work router when an app's resolved workTracker is 'jira' (replaces the prior jira→jira-sprint-manager route).'pr-reviewer': 3, // v3: multi-stage pipeline (security scan → code review + merge)'code-reviewer-a': 1, // v1: 2-stage pipeline (codebase review → triage & implement)'code-reviewer-b': 1, // v1: 2-stage pipeline (codebase review → triage & implement)diff --git a/server/services/taskSchedule.js b/server/services/taskSchedule.jsindex bd06de356c..b384017884 100644--- a/server/services/taskSchedule.js+++ b/server/services/taskSchedule.js@@ -204,8 +204,10 @@ export const DEFAULT_TASK_INTERVALS = {// (app.workTracker, default 'auto' → resolved from the git origin host). At// dispatch the generator resolves the tracker and delegates to the matching// prompt body — plan→plan-task, github→claim-issue, gitlab→claim-issue-gitlab,- // jira→jira-sprint-manager — so the agent still creates its OWN worktree and- // opens its OWN PR. Both `useWorktree` and `openPR` are OFF on the CoS side+ // jira→claim-issue-jira — so the agent still creates its OWN worktree and+ // opens its OWN MR/PR. (jira routes to the per-ticket claim-issue-jira flow,+ // NOT the broader jira-sprint-manager triage job, which stays standalone.)+ // Both `useWorktree` and `openPR` are OFF on the CoS side// for the SAME reasons as plan-task/claim-issue (a CoS-managed worktree would// hide the claim slug and trigger cleanupAgentWorktree's auto-merge).// `issueAuthorFilter` applies only when the resolved tracker is a forge