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
address review (codex): scan nested-subgroup GitLab remotes (owner/repo unparseable); document MR-list-degrade parity as deferred
Adam Eivyce36e3133b68
diff --git a/docs/plans/2026-07-06-issue-reconcile.md b/docs/plans/2026-07-06-issue-reconcile.mdindex 381fa152be..b183958f33 100644--- a/docs/plans/2026-07-06-issue-reconcile.md+++ b/docs/plans/2026-07-06-issue-reconcile.md@@ -94,7 +94,17 @@ on non-GitHub apps; GitLab/JIRA siblings are deferred (see PLAN.md).gh/glab command table injected via `{zombieIssues}`). Coordinator prompt bumped tov2 (forge-aware gh/glab commands); v1 preserved in `PREVIOUS_DEFAULT_PROMPTS`.`glab` exec helper added at `server/services/gitlab.js` (mirrors `execGh`, cwd-aware).-- **JIRA (deferred → follow-up #NEW).** The JIRA "zombie" analog is status-based,+- **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 (deferred → follow-up #2259).** The JIRA "zombie" analog is status-based,not label-based (a ticket left *In Review*/*Done* with remaining scope + no liveclaim), and heals through the PortOS JIRA API (`my-sprint-tickets` + ticket status+ linked MR/PR → record remaining scope + `POST /api/jira/instances/:id/tickets`)diff --git a/server/services/issueReconcile.js b/server/services/issueReconcile.jsindex a57fda7940..c60f30f48d 100644--- a/server/services/issueReconcile.js+++ b/server/services/issueReconcile.js@@ -36,8 +36,8 @@import { execGit } from '../lib/execGit.js';import { execGh } from './github.js';import { execGlab } from './gitlab.js';-import { getOriginInfo } from '../lib/gitRemote.js';-import { hostToWorkTracker } from '../lib/workTracker.js';+import { getOriginInfo, readOriginRemoteUrl } from '../lib/gitRemote.js';+import { hostToWorkTracker, hostFromOriginUrl } from '../lib/workTracker.js';import { safeJSONParse, PATHS } from '../lib/fileUtils.js';// Bound the forge queries (single-user repos never realistically truncate at 200).@@ -253,21 +253,49 @@ async function getGitlabState(repoPath, fullName) {};}+/**+ * Best-effort `group[/subgroup...]/project` display path from a GitLab origin+ * URL. Only cosmetic (it feeds the prompt header) — `glab` targets the project+ * from the repo cwd, not this string — so it degrades to the host classifier's+ * fullName or the raw origin URL rather than blocking the scan.+ */+function gitlabProjectPath(originUrl) {+ if (typeof originUrl !== 'string') return null;+ // scheme://[user@]host[:port]/<path> OR [user@]host:<path> — capture <path>,+ // then strip a trailing `.git`.+ const m = originUrl.trim().match(/^[a-zA-Z][\w+.-]*:\/\/(?:[^/@]+@)?[^/]+\/(.+)$/)+ || originUrl.trim().match(/^(?:[^@/]+@)?[^/:]+:(.+)$/);+ return m ? m[1].replace(/\.git$/i, '').replace(/\/$/, '') : null;+}+/*** Resolve the app's forge from its git origin host and fetch the corresponding- * state. github.* → GitHub, gitlab.* → GitLab; any other remote (or no origin)+ * state. github.com → GitHub, gitlab.* → GitLab; any other remote (or no origin)* returns null so the caller skips without parking.+ *+ * GitHub uses `getOriginInfo().isGithub` (authoritative, github.com-only — same+ * scope as v1). GitLab is classified straight off the origin HOST via the+ * subgroup-safe `hostFromOriginUrl`, NOT `getOriginInfo().fullName`: the latter's+ * strict `owner/repo` parse returns null for a nested `group/subgroup/project`+ * remote (the common GitLab layout), which would silently skip the scan even+ * though `glab` resolves the project from the cwd regardless.* @param {string} repoPath* @returns {Promise<object|null>}*/async function getForgeState(repoPath) {const origin = await getOriginInfo(repoPath).catch(() => null);- if (!origin?.fullName) return null;- // getOriginInfo already classifies GitHub authoritatively (older callers/tests- // may not carry a `host`), so trust isGithub first; fall back to the canonical- // host classifier for GitLab (and any future forges hostToWorkTracker adds).- if (origin.isGithub) return getGithubState(origin.fullName);- if (hostToWorkTracker(origin.host) === 'gitlab') return getGitlabState(repoPath, origin.fullName);+ // GitHub: authoritative, github.com-only, needs a parsed owner/repo for --repo.+ if (origin?.isGithub && origin.fullName) return getGithubState(origin.fullName);++ // GitLab: classify off the host (subgroup-safe). `glab` is cwd-based, so a+ // display path is best-effort — prefer getOriginInfo's fullName, else derive the+ // full project path from the URL, else fall back to the host.+ const originUrl = await readOriginRemoteUrl(repoPath).catch(() => null);+ const host = origin?.host || hostFromOriginUrl(originUrl);+ if (hostToWorkTracker(host) === 'gitlab') {+ const displayName = origin?.fullName || gitlabProjectPath(originUrl) || host;+ return getGitlabState(repoPath, displayName);+ }return null;}diff --git a/server/services/issueReconcile.test.js b/server/services/issueReconcile.test.jsindex 30f2e27162..734f4ad9f8 100644--- a/server/services/issueReconcile.test.js+++ b/server/services/issueReconcile.test.js@@ -21,13 +21,17 @@ vi.mock('./github.js', () => ({ execGh: vi.fn(async () => '[]') }));vi.mock('./gitlab.js', () => ({ execGlab: vi.fn(async () => '[]') }));vi.mock('../lib/gitRemote.js', () => ({getOriginInfo: vi.fn(async () => ({ isGithub: true, host: 'github.com', fullName: 'atomantic/PortOS' })),+ readOriginRemoteUrl: vi.fn(async () => '[email protected]:atomantic/PortOS.git'),}));// hostToWorkTracker is the canonical host→forge classifier. Import the REAL pure// implementation (partial mock) so the GitLab branch is exercised through the// exact mapping production uses — no drift-prone re-implementation here.vi.mock('../lib/workTracker.js', async (importActual) => {const actual = await importActual();- return { hostToWorkTracker: actual.hostToWorkTracker };+ return {+ hostToWorkTracker: actual.hostToWorkTracker,+ hostFromOriginUrl: actual.hostFromOriginUrl,+ };});vi.mock('../lib/fileUtils.js', () => ({PATHS: { root: '/repo' },@@ -42,12 +46,13 @@ import {import { execGit } from '../lib/execGit.js';import { execGh } from './github.js';import { execGlab } from './gitlab.js';-import { getOriginInfo } from '../lib/gitRemote.js';+import { getOriginInfo, readOriginRemoteUrl } from '../lib/gitRemote.js';beforeEach(() => {vi.clearAllMocks();execGit.mockResolvedValue({ stdout: '', exitCode: 0 });getOriginInfo.mockResolvedValue({ isGithub: true, host: 'github.com', fullName: 'atomantic/PortOS' });+ readOriginRemoteUrl.mockResolvedValue('[email protected]:atomantic/PortOS.git');});describe('issueNumberFromRef', () => {@@ -199,8 +204,9 @@ describe('reconcile', () => {expect(result.stalled.map((s) => s.number)).toEqual([2220]);});- it('returns null (skip, do not park) when the origin has no fullName', async () => {+ it('returns null (skip, do not park) when there is no origin / no host', async () => {getOriginInfo.mockResolvedValue({ isGithub: false, host: null, fullName: null });+ readOriginRemoteUrl.mockResolvedValue(null);const result = await reconcile('/repo');expect(result).toBeNull();});@@ -209,6 +215,7 @@ describe('reconcile', () => {// A parseable non-forge remote (e.g. bitbucket) — has a fullName but no// gh/glab gatherer, so the scan skips without parking.getOriginInfo.mockResolvedValue({ isGithub: false, host: 'bitbucket.org', fullName: 'team/proj' });+ readOriginRemoteUrl.mockResolvedValue('[email protected]:team/proj.git');const result = await reconcile('/repo');expect(result).toBeNull();expect(execGh).not.toHaveBeenCalled();@@ -332,6 +339,26 @@ describe('reconcile (GitLab forge)', () => {expect(result.forge).toBe('gitlab');expect(result.zombies).toHaveLength(0);});++ it('scans a nested subgroup remote whose owner/repo does NOT parse (getOriginInfo.fullName=null)', async () => {+ // Common GitLab layout `group/subgroup/project` — getOriginInfo's strict+ // owner/repo parse returns null, but the host still classifies as GitLab and+ // `glab` is cwd-based, so the scan must NOT be skipped. Host is classified off+ // the origin URL via the real hostFromOriginUrl.+ getOriginInfo.mockResolvedValue({ isGithub: false, host: null, fullName: null });+ readOriginRemoteUrl.mockResolvedValue('[email protected]:group/subgroup/project.git');+ mockGlab({+ issues: [{ iid: 42, title: 't', labels: ['in-progress'], assignees: [], web_url: 'u' }],+ merged: [{ iid: 7, source_branch: 'claim/issue-42', description: 'Refs #42' }],+ open: [],+ });+ const result = await reconcile('/repo');+ expect(result).not.toBeNull();+ expect(result.forge).toBe('gitlab');+ // Best-effort display name is the full subgroup project path from the URL.+ expect(result.fullName).toBe('group/subgroup/project');+ expect(result.zombies.map((z) => z.number)).toEqual([42]);+ });});describe('gatherIssueState carries labels/assignees for the follow-up', () => {