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
Issue Reconcile — kill zombie issues, self-heal partial ships
Date: 2026-07-06 Status: approved → implementing Related: #2220 (closed, follow-up #2241), #2179, #2175 (released); epic tie-in with the branch-reconcile CoS task (#2237/#2240)
Problem
An issue that is only PARTIALLY completed by a merged PR becomes a zombie:
OPEN + in-progress label + assignee, with its PR already merged. The claim
queue treats in-progress as "claimed and being worked" and skips it, so the
remaining scope is never re-claimed and never completed.
Root cause — the completion flow has no "partial completion" state:
/do:nextPhase 7 (taskPromptDefaults/prompts.js) is binary: it verifies the issue auto-closed via aCloses #NUMtrailer, and if still open closes it + removesin-progress. There is no branch for "I shipped part of the scope." The only pre-ship escape (needs-input,:558) releases without shipping.- Branch reconciler (
branchReconcile.js) is entirely branch-centric — after it merges anIN_REVIEWPR it deletes the branch/worktree but never touches the linked issue's label or state.
So a sensible partial ship with Refs #NUM (not Closes) merged via the
reconciler/swarm path → zombie. Live examples: #2220, #2179, #2175.
Design
Agent-judged hybrid partial-ship policy, applied in two places.
Part A — teach the completion flow "partial ship" (future direct claims)
claim-issue, claim-issue-gitlab, claim-issue-jira Phase 5/7:
- Phase 5: the PR body uses
Closes #NUMonly when the PR fully satisfies the issue; a partial ship usesRefs #NUM+ a "Remaining" section. - Phase 7: after merge, decide did this PR fully satisfy the issue?
- Yes → existing close + remove
in-progress. - No, remainder is a clean separable chunk → close original (comment:
shipped ✓ / moved to #NEW), file a scoped follow-up (
plan+ inherited area labels,Refs #orig). - No, remainder is a continuation of the same scope → keep open, post
Done ✓ / Remaining ▢comment, removein-progress+ assignee → re-claimable.
- Yes → existing close + remove
Prompt-version discipline (CLAUDE.md "Distribution model"): bump PROMPT_VERSIONS
for all three keys, append the outgoing bodies verbatim to
PREVIOUS_DEFAULT_PROMPTS, regenerate integrity.snapshot.json.
Part B — new issue-reconcile per-app CoS task (self-heal + reconciler path)
Mirrors the branch-reconcile shape:
server/services/issueReconcile.js(pure classifier +ghgatherers, unit-tested): scan open +in-progressissues; classify eachZOMBIEiff a linked merged PR references it (head ref encodesissue-<num>, or body mentions#<num>) and there is no live claim (no open PR / local / remote /cos/*/issue-<num>/*branch for it) and no active CoS agent. Emit azombieSignatureconvergence guard so the perpetual drain parks instead of looping.cosTaskGenerator.js: deterministic pre-step + dispatch block parallel to the branch-reconcile block — zombies → dispatch a coordinator agent that reads each issue+PR and applies the SAME hybrid decision; none → park onrecheckCron.- Registration:
SELF_IMPROVEMENT_TASK_TYPES,DEFAULT_TASK_INTERVALS(PERPETUAL, disabled,recheckCron: '0 4 * * *',taskMetadata.autoClose: true),MANAGED_AGENT_OPTIONS(lockuseWorktree/openPRoff — the coordinator works overgh, no worktree), the task-description map,PROMPT_VERSIONS(issue-reconcile: 1),ALLOWED_TASK_METADATA_KEYS(autoClose), and the new coordinator prompt body. - Disabled by default → no migration needed (new opt-in task).
autoClosetoggle (default ON): when OFF the coordinator never closes an issue, only comments + unlabels — a safety valve for users who prefer one thread per feature.
Peer safety (differs from branch-reconcile, which is local-ref-only): issue
state is shared GitHub state across federated peers (void/null/NaN/undefined).
Close/unlabel are idempotent; the one real race is filing a duplicate follow-up
from two machines, so the coordinator dedupes by searching for an existing
follow-up (Refs #orig marker) before filing. v1 pre-step is gh-only and parks
on non-GitHub apps; GitLab/JIRA siblings are deferred (see PLAN.md).
Part D — forge siblings (#2249)
- GitLab (shipped #2249).
issueReconcile.jsis now forge-aware: it resolves the forge from the app's gitoriginhost insidereconcile()(github.* → GitHub viagh, gitlab.* → GitLab viaglab, anything else → null/skip) and delegates to a per-forge state gatherer. Both gatherers normalize into ONE common issue shape ({ number, title, url, labels, assignees }) + change shape ({ number, headRefName, body, url }), so the pure classifier, ref matchers, andzombieSignatureare shared — no forge branching in the classify/merge logic. GitLab mapsiid→number, MRsource_branch→head ref (carriesclaim/issue-<iid>), MRdescription→body (carriesRefs #<iid>). Routing decision: one task type, not three —issue-reconcileresolves the forge internally (theclaim-workrouter splits by tracker only because each tracker has a distinct multi-phase claim prompt; here the coordinator prompt is shared and just gets the forge + gh/glab command table injected via{zombieIssues}). Coordinator prompt bumped to v2 (forge-aware gh/glab commands); v1 preserved inPREVIOUS_DEFAULT_PROMPTS.glabexec helper added atserver/services/gitlab.js(mirrorsexecGh, cwd-aware). - Deferred (both forges). The merged/open PR/MR list queries degrade to
[]on failure while only the in-progress ISSUE list is load-bearing (null → skip). This is the intentional v1 GitHub contract, preserved for GitLab parity — but it means a transient MR-list failure could momentarily misclassify (an issue with a live open MR whose list call failed looks like a zombie; a real zombie whose merged-list failed looks stalled). Low-impact because the coordinator re-verifies each zombie live before acting AND the convergence signature only drives, never destroys — but promoting open/merged list failures to transient-null (skip, don't misclassify) is a worthwhile cross-forge hardening. Not done here to keep the two forges behaviorally identical to the reviewed v1. - JIRA (shipped #2259). The JIRA "zombie" analog is status-based, not
label-based (a ticket left In Review with remaining scope + no live claim; JIRA
has no
in-progresslabel to release), and heals through the PortOS JIRA API (my-sprint-tickets+ ticket status → record remaining scope + ticket transitions +POST /api/jira/instances/:id/tickets) rather than a forge CLI. Implemented by normalizing JIRA sprint tickets into the SAME common issue shape the forge gatherers produce (KEY →number, status carried for the convergence signature) so the pure classifier / signature stay shared: an In-Progress- category ticket whose status name matches In Review → ZOMBIE, a plain In-Progress → STALLED, To Do (not started) / Done (terminal) → excluded so the scan converges. The live-claim guard scansclaim/<KEY>/cos/…/<KEY>/…refs (local AND remote) by ticket KEY — an MR still open under review keeps its branch, reading LIVE; a merged-and-deleted branch reads as a zombie. Routing mirrorsresolveAppWorkTracker: JIRA is NEVER auto-selected from the git host — it's chosen only when the app's resolvedworkTrackeris'jira'with enabledjira.instanceId/projectKey, threaded intoreconcile()as ajiraoption (a JIRA-specific gatherer branch, not an origin-host lookup). Added a strictfetchMyCurrentSprintTickets(the existinggetMyCurrentSprintTicketsswallows errors to[]for the UI; the reconcile scan needs the throw so a transient failure skips-without-parking instead of being misread as an empty sprint). Coordinator prompt bumped to v3 (adds the JIRA arm — transitions +POST tickets); v2 preserved inPREVIOUS_DEFAULT_PROMPTS.
Part C — heal the three current zombies (done)
- #2220 — separable remainder → closed, follow-up #2241 filed.
- #2179, #2175 — continuation → kept open,
Done/Remainingcomment,in-progress+ assignee removed.