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: managed-app Issues tab now supports a custom-hostname enterprise forge
Adam Eivy5742f3192e89
diff --git a/.changelog/NEXT.md b/.changelog/NEXT.mdindex 692e1a2584..4781339243 100644--- a/.changelog/NEXT.md+++ b/.changelog/NEXT.md@@ -70,7 +70,7 @@- Video Gen now offers Apple-local Wan 2.2 TI2V-5B plus validated 4-step A14B Lightning text- and image-to-video profiles through a pinned MLX-Gen runtime. Runtime tools/packages, immutable base snapshots, and exact Lightning adapters install only after an explicit UI action; existing installs receive an in-app repair/upgrade path, saved Hugging Face credentials are applied automatically, gated-source errors link back to the settings/access UI, and render/queue actions stay blocked until every required file is cached. The catalog identifies the A14B profiles as roughly 40 GiB downloads intended for 64+ GB Apple Silicon rather than understating their footprint. Wan-specific 4n+1 frame choices, FPS options, mode compatibility, process-tree cancellation, and locked Lightning sampler settings keep the UI aligned with the actual model contract.-- **Every managed app now has an Issues tab.** It queries the forge the app's work actually lives on (GitHub via `gh`, GitLab via `glab` — enterprise and nested-subgroup remotes included) and lists every open issue with its labels in the forge's own colors, assignees, author, milestone, and an expandable description, plus a filter box over all of it. Each row has a **Claim** button that queues the same `/do:next` CoS agent the Agent Operations panel does, pinned to that issue — so the run honors the app's configured Work Tracker, worktree, and PR settings. The list is gated on the app's *resolved* Work Tracker rather than its git remote alone, which is what keeps that promise: `workTracker` is user-settable and wins over the origin host, so an app with a GitHub remote but its tracker pinned to JIRA would otherwise have listed GitHub issues behind a Claim button that queued a JIRA-ticket run against a key that doesn't exist. Such an app now says so and points at the setting. An unreachable CLI says so and names the remedy; it is never reported as "no open issues".+- **Every managed app now has an Issues tab.** It queries the forge the app's work actually lives on (GitHub via `gh`, GitLab via `glab` — enterprise and nested-subgroup remotes included) and lists every open issue with its labels in the forge's own colors, assignees, author, milestone, and an expandable description, plus a filter box over all of it. Each row has a **Claim** button that queues the same `/do:next` CoS agent the Agent Operations panel does, pinned to that issue — so the run honors the app's configured Work Tracker, worktree, and PR settings. The list is gated on the app's *resolved* Work Tracker rather than its git remote alone, which is what keeps that promise: `workTracker` is user-settable and wins over the origin host, so an app with a GitHub remote but its tracker pinned to JIRA would otherwise have listed GitHub issues behind a Claim button that queued a JIRA-ticket run against a key that doesn't exist. Such an app now says so and points at the setting. An unreachable CLI says so and names the remedy; it is never reported as "no open issues". A self-hosted GitHub Enterprise or GitLab instance on a custom domain (no "github."/"gitlab." in the hostname, e.g. `git.mycompany.com`) is also supported now, as long as the app's Work Tracker is explicitly set to GitHub or GitLab under Edit App → Workflow — auto-detection still needs a recognizable hostname, but an explicit pin is honored regardless of what the domain is named.- **JIRA config and the sprint Kanban board moved onto the app's own JIRA tab.** They were split across two surfaces that neither of them fit: the config was a cramped tab inside the 720px Edit App drawer, and the board was buried below the fold of the Overview tab. They now sit together at `/apps/:id/jira` with the full page width, and the config saves only its own slice, so a save there and a save from the Edit App drawer can no longer overwrite each other.diff --git a/server/lib/workTracker.js b/server/lib/workTracker.jsindex e494291f6d..5c996e1832 100644--- a/server/lib/workTracker.js+++ b/server/lib/workTracker.js@@ -419,7 +419,8 @@ function gitlabProjectPath(originUrl) {* Resolve which forge a repo checkout's `origin` points at, together with* everything a `gh`/`glab` caller needs to target it — or null when the origin* isn't a forge PortOS can query (no remote, or a host that is neither- * GitHub- nor GitLab-family).+ * GitHub- nor GitLab-family AND no `preferredForge` override applies — see+ * below).** The two branches deliberately differ, mirroring how the CLIs address a repo:* - GitHub (incl. Enterprise) resolves through `githubRepoSpec`, whose@@ -433,11 +434,25 @@ function gitlabProjectPath(originUrl) {* `repoSpec` is therefore null for GitLab — the caller must run `glab` in* `repoPath`.*+ * `preferredForge` ('github' | 'gitlab' | null) is the app's EXPLICITLY+ * configured work tracker (never 'auto' — that already flows through the same+ * `hostToWorkTracker` classification above, so it would already have matched+ * here if it could). It's a fallback, tried only once both host-pattern checks+ * above have failed: a self-hosted GitHub Enterprise Server or GitLab instance+ * can run on ANY domain the operator picked (`git.mycompany.com`,+ * `scm.mycompany.com`, …) — there is no hostname heuristic that can tell such a+ * host apart from a non-forge remote, so the user's own pin is the only signal+ * left. A genuinely wrong pin (e.g. a bitbucket.org origin pinned to 'github')+ * still degrades gracefully: the resulting `gh`/`glab` call fails and the+ * caller reports a transient "couldn't reach" error rather than PortOS lying+ * upfront that the origin "isn't GitHub or GitLab".+ ** Never throws: a missing repo / unreadable origin degrades to null.* @param {string} repoPath+ * @param {{preferredForge?: 'github'|'gitlab'|null}} [options]* @returns {Promise<{forge:'github'|'gitlab', fullName:string, repoSpec:string|null, apiHost:string|null}|null>}*/-export async function resolveRepoForgeTarget(repoPath) {+export async function resolveRepoForgeTarget(repoPath, { preferredForge = null } = {}) {if (!repoPath) return null;const origin = await getOriginInfo(repoPath).catch(() => null);const githubSpec = githubRepoSpec(origin);@@ -455,7 +470,7 @@ export async function resolveRepoForgeTarget(repoPath) {// segment and discards it before reading the host / path.const originUrl = origin?.originUrl || null;const host = origin?.host || hostFromOriginUrl(originUrl);- if (hostToWorkTracker(host) === 'gitlab') {+ if (hostToWorkTracker(host) === 'gitlab' || (preferredForge === 'gitlab' && host)) {return {forge: 'gitlab',fullName: origin?.fullName || gitlabProjectPath(originUrl) || host,@@ -463,5 +478,13 @@ export async function resolveRepoForgeTarget(repoPath) {apiHost: null,};}+ if (preferredForge === 'github' && origin?.fullName && host) {+ return {+ forge: 'github',+ fullName: origin.fullName,+ repoSpec: `${host}/${origin.fullName}`,+ apiHost: githubApiHost(host),+ };+ }return null;}diff --git a/server/services/appIssues.js b/server/services/appIssues.jsindex 9fac645a71..8fc7001b94 100644--- a/server/services/appIssues.js+++ b/server/services/appIssues.js@@ -152,8 +152,11 @@ async function fetchGitlabIssues(repoPath) {* against a ticket key that doesn't exist. Same resolver as* `buildClaimWorkTask`, so the list and the claim agree by construction.*- * The tracker probe and the forge-target probe are independent git reads, so- * they overlap.+ * The forge-target probe needs the RESOLVED tracker first (see+ * `resolveRepoForgeTarget`'s `preferredForge`, which lets an explicitly-pinned+ * github/gitlab tracker reach a self-hosted forge whose hostname doesn't spell+ * out "github."/"gitlab."), so the two reads run sequentially rather than+ * overlapping — and are skipped entirely for a plan/jira-tracked app.** @param {object} app - managed app record (needs `repoPath`, `workTracker`)* @returns {Promise<{forge:'github'|'gitlab'|null, tracker:string|null, fullName:string|null, issues:object[], reason:string, transient:boolean, remedy:string|null}>}@@ -162,15 +165,14 @@ export async function listAppIssues(app) {const base = { forge: null, tracker: null, fullName: null, issues: [], transient: false, remedy: null };if (!app?.repoPath) return { ...base, reason: 'no-repo-path' };- const [wt, target] = await Promise.all([- resolveAppWorkTracker(app),- resolveRepoForgeTarget(app.repoPath),- ]);+ const wt = await resolveAppWorkTracker(app);const tracker = wt.resolved;// PLAN.md / JIRA apps have no forge issue list — and, more importantly, no// claim this tab could honestly offer.if (tracker !== 'github' && tracker !== 'gitlab') return { ...base, tracker, reason: 'tracker-not-a-forge' };++ const target = await resolveRepoForgeTarget(app.repoPath, { preferredForge: tracker });if (!target) return { ...base, tracker, reason: 'unsupported-forge' };// Explicitly tracking one forge from the other's remote: we can't query the// configured tracker (no selector for it) and must not silently list thediff --git a/server/services/appIssues.test.js b/server/services/appIssues.test.jsindex 134872447b..51287c4830 100644--- a/server/services/appIssues.test.js+++ b/server/services/appIssues.test.js@@ -187,11 +187,44 @@ describe('listAppIssues — non-forge apps', () => {expect(result).toMatchObject({ forge: null, tracker: 'plan', reason: 'tracker-not-a-forge', transient: false });});- it('reports unsupported-forge when a forge tracker is pinned but the origin can serve none', async () => {+ it('reports unsupported-forge when a forge tracker is pinned but the origin has no owner/repo to build a spec from', async () => {+ getOriginInfo.mockResolvedValue({ isGithub: false, host: null, fullName: null });+ readOriginRemoteUrl.mockResolvedValue(null);+ const result = await listAppIssues({ ...APP, workTracker: 'github' });+ expect(result).toMatchObject({ forge: null, tracker: 'github', reason: 'unsupported-forge', transient: false });+ expect(execGh).not.toHaveBeenCalled();+ });++ it('attempts the pinned forge on a non-matching-hostname origin instead of refusing outright, since a self-hosted forge can live on any domain', async () => {+ // `bitbucket.org` matches neither the github.* nor gitlab.* hostname+ // pattern — same as a real self-hosted GHE/GitLab instance on a custom+ // domain would. The hostname alone can't tell them apart, so an explicit+ // pin is trusted and the CLI is actually asked, rather than PortOS+ // pre-emptively claiming "isn't GitHub or GitLab".getOriginInfo.mockResolvedValue({ isGithub: false, host: 'bitbucket.org', fullName: 'acme/widget' });readOriginRemoteUrl.mockResolvedValue('[email protected]:acme/widget.git');+ execGh.mockResolvedValue(JSON.stringify([{ number: 1, title: 't', labels: [], assignees: [] }]));const result = await listAppIssues({ ...APP, workTracker: 'github' });- expect(result).toMatchObject({ forge: null, tracker: 'github', reason: 'unsupported-forge', transient: false });+ expect(result).toMatchObject({ forge: 'github', tracker: 'github', reason: 'ok' });+ expect(execGh.mock.calls[0][0][execGh.mock.calls[0][0].indexOf('--repo') + 1]).toBe('bitbucket.org/acme/widget');+ });++ it('lists issues for a github tracker explicitly pinned on a custom-hostname enterprise origin', async () => {+ getOriginInfo.mockResolvedValue({ isGithub: false, host: 'git.example-corp.com', fullName: 'acme/widget' });+ readOriginRemoteUrl.mockResolvedValue('[email protected]:acme/widget.git');+ execGh.mockResolvedValue(JSON.stringify([{ number: 9, title: 'Custom host works', labels: [], assignees: [] }]));+ const result = await listAppIssues({ ...APP, workTracker: 'github' });+ expect(result).toMatchObject({ forge: 'github', tracker: 'github', fullName: 'acme/widget', reason: 'ok' });+ expect(ensureForgeReachableMock).toHaveBeenCalledWith('app-issues', { hostname: 'git.example-corp.com' });+ });++ it('lists issues for a gitlab tracker explicitly pinned on a custom-hostname self-hosted origin', async () => {+ getOriginInfo.mockResolvedValue({ isGithub: false, host: 'git.example-corp.com', fullName: 'acme/widget' });+ readOriginRemoteUrl.mockResolvedValue('[email protected]:acme/widget.git');+ execGlab.mockResolvedValue(JSON.stringify([{ iid: 3, title: 'Custom host works', labels: [], assignees: [] }]));+ const result = await listAppIssues({ ...APP, workTracker: 'gitlab' });+ expect(result).toMatchObject({ forge: 'gitlab', tracker: 'gitlab', reason: 'ok' });+ expect(execGlab.mock.calls[0][1]).toBe('/repo');});});