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([issue-2651]): short-circuit GitLab's group-owner filter trap like GitHub's owner-is-org
[._.]/ Adam Eivy91320c49a96f
diff --git a/client/src/hooks/useOnDemandTaskToast.js b/client/src/hooks/useOnDemandTaskToast.jsindex da4512e30f..61f49eab58 100644--- a/client/src/hooks/useOnDemandTaskToast.js+++ b/client/src/hooks/useOnDemandTaskToast.js@@ -13,6 +13,7 @@ const PARK_REASON_LABELS = {'no-open-issues': 'no open issues','no-authored-issues': 'open issues exist, but none match the author filter — set it to "any"','owner-is-org': 'the "owner" filter matches an org, which can\'t author issues — set it to "self" or "any"',+ 'owner-is-group': 'the "owner" filter matches a group, which can\'t author issues — set it to "self" or "any"','no-in-flight-branches': 'no branches in flight','no-zombie-issues': 'no stale issues to reconcile','no-actionable-plan-items': 'no unblocked PLAN items',diff --git a/client/src/hooks/useOnDemandTaskToast.test.jsx b/client/src/hooks/useOnDemandTaskToast.test.jsxindex 55ac08a375..32c5017412 100644--- a/client/src/hooks/useOnDemandTaskToast.test.jsx+++ b/client/src/hooks/useOnDemandTaskToast.test.jsx@@ -97,4 +97,19 @@ describe('useOnDemandTaskToast — parked outcome', () => {expect(msg).toMatch(/0 of 10 open/);expect(msg).not.toMatch(/re-checked now — no open issues/);});++ it('uses group-flavored copy for the GitLab owner-filter trap (a group is not an "org")', () => {+ renderHook(() => useOnDemandTaskToast());+ fire({+ taskType: 'claim-issue-gitlab', appName: 'App One', outcome: 'parked',+ parkReason: 'owner-is-group', counts: { open: 10, inFlight: 0, filtered: 0 },+ parkedUntil: new Date(Date.now() + 23 * 3600 * 1000).toISOString()+ });+ const [msg] = toastSpy.mock.calls[0];+ // GitLab-appropriate wording — "group", never "org".+ expect(msg).toMatch(/matches a group/);+ expect(msg).not.toMatch(/matches an org/);+ expect(msg).toMatch(/set it to "self" or "any"/);+ expect(msg).toMatch(/0 of 10 open/);+ });});diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.jsindex 6566e9b1b9..42676668d8 100644--- a/server/services/perpetualWork.js+++ b/server/services/perpetualWork.js@@ -176,6 +176,9 @@ const FORGE_ISSUE_CONFIG = {listArgs: ['issue', 'list', '--state', 'open', '--search', 'sort:created-asc', '--json', 'number,assignees,labels,title', '--limit', '100'],listFail: 'gh-list-failed',parseFail: 'gh-parse-failed',+ // Park reason when the owner filter resolves to a non-authoring owner. On+ // GitHub that owner is an ORG; the toast copy is org-flavored to match.+ ownerIsOrgReason: 'owner-is-org',// Authoritative repo owner (org or user) + whether that owner is an org, via// gh; transient if gh is unauthenticated / not a GitHub remote. `isOrg` lets// detectForgeIssues short-circuit the owner-filter org trap — an org login is@@ -204,14 +207,24 @@ const FORGE_ISSUE_CONFIG = {listArgs: ['issue', 'list', '--per-page', '100', '-F', 'json'],listFail: 'glab-list-failed',parseFail: 'glab-parse-failed',+ // Park reason when the owner filter resolves to a non-authoring owner. On+ // GitLab that owner is a GROUP, not an "org"; the toast copy is group-flavored+ // to match (a GitLab user would never call their namespace an org).+ ownerIsOrgReason: 'owner-is-group',// GitLab has no authoritative `gh repo view` equivalent here; resolve the// author filter from the project namespace (git remote owner), matching the- // claim-issue-gitlab prompt. For a GROUP-owned project the namespace is the- // group (not an issue author), so owner-mode finds nothing and parks —- // switch the task to 'any' author mode for group projects.+ // claim-issue-gitlab prompt. GitLab can't tell a user namespace from a GROUP+ // namespace from the remote URL alone, so probe: `glab api groups/<namespace>`+ // returns 200 for a group and 404 for a user namespace. A group is never an+ // issue author, so populate `isOrg: true` for groups and let detectForgeIssues+ // fire the same owner-filter short-circuit GitHub uses — no new branch logic.+ // A probe failure (network/unauth/non-200) degrades to isOrg:false → the+ // pre-existing `--author <owner>` behavior, so no new transient park appears.resolveOwner: async (repoPath) => {const owner = await resolveRemoteOwner(repoPath);- return owner ? { owner } : { error: 'glab-owner-unresolved' };+ if (!owner) return { error: 'glab-owner-unresolved' };+ const probe = await runCli('glab', ['api', `groups/${owner}`], repoPath);+ return { owner, isOrg: probe.code === 0 };},// `--self` mode: glab's `--author` expects a username (no `@me` token), so// resolve the authenticated account via the API; transient if glab is@@ -283,13 +296,14 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self' } =const { owner, isOrg, error } = await cfg.resolveOwner(repoPath);if (error) return { actionable: false, count: 0, reason: error, transient: true };if (isOrg) {- // The owner filter resolved to an ORG login, which can never be an issue- // author — `--author <org>` is guaranteed to match zero. Skip that empty- // query and report the real open count with a distinct `owner-is-org`- // reason, so the toast steers the user to 'self'/'any' instead of implying- // a personal-username mismatch (the failure that motivated this branch).+ // The owner filter resolved to a non-authoring owner (a GitHub ORG or a+ // GitLab GROUP), which can never be an issue author — `--author <owner>` is+ // guaranteed to match zero. Skip that empty query and report the real open+ // count with the forge-flavored short-circuit reason (`owner-is-org` /+ // `owner-is-group`), so the toast steers the user to 'self'/'any' instead of+ // implying a personal-username mismatch (the failure that motivated this).const openCount = await countOpenIssuesUnfiltered(cfg, repoPath);- return parked('owner-is-org', openCount);+ return parked(cfg.ownerIsOrgReason, openCount);}args.push('--author', owner);authorApplied = true;@@ -313,8 +327,9 @@ async function detectForgeIssues(forgeKey, app, { issueAuthorFilter = 'self' } =// An empty *filtered* list is ambiguous: the repo may truly have no open// issues, OR it has open issues that just don't match the author filter —// e.g. `self`/@me resolving to a different identity than whoever filed the- // issues, or a non-org `owner` who simply filed none. (The org-owner trap is- // caught earlier with the distinct `owner-is-org` reason.)+ // issues, or a non-org `owner` who simply filed none. (The org/group-owner+ // trap is caught earlier with the distinct `owner-is-org`/`owner-is-group`+ // reason.)// Reporting a flat "no open issues" there hid a claimable queue behind a// full recheck park (the "open issues exist but the task still parked"// failure this fixes). Re-probe WITHOUT the author filter; if issues exist,diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.jsindex 56b103d839..099c1a1cb5 100644--- a/server/services/perpetualWork.test.js+++ b/server/services/perpetualWork.test.js@@ -442,5 +442,41 @@ describe('perpetualWork', () => {const out = await detectGitlabIssues(app, { issueAuthorFilter: 'self' });expect(out).toMatchObject({ actionable: false, reason: 'no-authored-issues', total: 1, filteredCount: 0 });});++ it('owner filter on a GROUP-owned project reports owner-is-group (probe 200) with the real open count', async () => {+ // The GitLab twin of the GitHub org trap: the namespace is a group, which+ // never authors issues. `glab api groups/<namespace>` returning 200 (code 0)+ // marks it a group → the shared owner-filter short-circuit parks with the+ // GitLab-flavored `owner-is-group` reason and never runs `--author <group>`.+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'git' && args[0] === 'remote') return fakeChild('[email protected]:acme-group/widget.git\n');+ if (cmd === 'glab' && args[0] === 'api' && String(args[1]).startsWith('groups/')) return fakeChild('{"kind":"group"}');+ if (cmd === 'glab' && args[0] === 'issue') return fakeChild(JSON.stringify([{ iid: 7, title: 'x', assignees: [], labels: [] }]));+ return fakeChild('');+ });+ const out = await detectGitlabIssues(app, { issueAuthorFilter: 'owner' });+ expect(out).toMatchObject({ reason: 'owner-is-group', total: 1, count: 0, filteredCount: 0 });+ // The guaranteed-empty `--author <group>` query is never issued.+ const issueCalls = spawn.mock.calls.filter(([cmd, a]) => cmd === 'glab' && a[0] === 'issue');+ expect(issueCalls.every(([, a]) => !a.includes('--author'))).toBe(true);+ });++ it('owner filter on a USER-owned project passes --author <namespace> (groups probe 404)', async () => {+ // A user namespace: `glab api groups/<namespace>` 404s (non-zero exit) → not+ // a group, so owner-mode filters by the namespace login as before.+ spawn.mockImplementation((cmd, args = []) => {+ if (cmd === 'git' && args[0] === 'remote') return fakeChild('[email protected]:alice/widget.git\n');+ if (cmd === 'git' && args[0] === 'branch') return fakeChild('main\n');+ if (cmd === 'glab' && args[0] === 'api' && String(args[1]).startsWith('groups/')) return fakeChild('', 22); // glab 404 → non-zero+ if (cmd === 'glab' && args[0] === 'issue') return fakeChild(JSON.stringify([{ iid: 7, title: 'x', assignees: [], labels: [] }]));+ if (cmd === 'glab' && args[0] === 'mr') return fakeChild('[]');+ return fakeChild('');+ });+ const out = await detectGitlabIssues(app, { issueAuthorFilter: 'owner' });+ expect(out.actionable).toBe(true);+ const listCall = spawn.mock.calls.find(([cmd, a]) => cmd === 'glab' && a[0] === 'issue');+ expect(listCall[1]).toContain('--author');+ expect(listCall[1]).toContain('alice');+ });});});