Skip to content

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

address review (codex): skip the group probe for an all-numeric GitLab namespace

[._.]/ Adam Eivy6df58926cc20
diff --git a/server/services/perpetualWork.js b/server/services/perpetualWork.js
index 2ba3b0b99b..62b76793e1 100644
--- a/server/services/perpetualWork.js
+++ b/server/services/perpetualWork.js
@@ -250,10 +250,21 @@ const FORGE_ISSUE_CONFIG = {
// `groups/parent%2Fsubgroup`. A probe failure (network/unauth/non-200) degrades
// to isOrg:false → the pre-existing `--author <owner>` behavior, so no new
// transient park appears.
+ //
+ // Numeric-namespace guard: `groups/:id` treats an ALL-NUMERIC `:id` as a
+ // database group ID, not a path — so probing `groups/1234` could match an
+ // unrelated group by ID and falsely park a user's `/1234/widget` as
+ // owner-is-group. GitLab forbids all-numeric namespace *paths* precisely to
+ // avoid this id/path ambiguity, so such a namespace shouldn't occur; if one
+ // somehow does, skip the ambiguous probe and take the safe `--author <ns>`
+ // path (isOrg:false). Nested subgroups are URL-encoded (`parent%2Fsub`) and so
+ // are never all-numeric — they still probe normally.
resolveOwner: async (repoPath) => {
const namespace = await resolveGitlabNamespace(repoPath);
if (!namespace) return { error: 'glab-owner-unresolved' };
- const probe = await runCli('glab', ['api', `groups/${encodeURIComponent(namespace)}`], repoPath);
+ const probe = /^\d+$/.test(namespace)
+ ? { code: 1 }
+ : await runCli('glab', ['api', `groups/${encodeURIComponent(namespace)}`], repoPath);
return { owner: namespace, isOrg: probe.code === 0 };
},
// `--self` mode: glab's `--author` expects a username (no `@me` token), so
diff --git a/server/services/perpetualWork.test.js b/server/services/perpetualWork.test.js
index 80d9f5c8fc..80cabf38b4 100644
--- a/server/services/perpetualWork.test.js
+++ b/server/services/perpetualWork.test.js
@@ -480,20 +480,28 @@ describe('perpetualWork', () => {
expect(issueCalls.every(([, a]) => !a.includes('--author'))).toBe(true);
});
- it('preserves a numeric namespace in an HTTPS remote (does not strip it as a port hop)', async () => {
- // Regression: an all-numeric top-level namespace (`/1234/widget`) must NOT be
- // mistaken for an SSH `:443/` port hop and dropped — GitLab numeric group/user
- // paths are valid, so the probe must target groups/1234.
+ it('preserves an all-numeric namespace but skips the ambiguous group-ID probe (uses --author)', async () => {
+ // Regression + guard: an all-numeric top-level namespace (`/1234/widget`) must
+ // NOT be stripped as if it were an SSH `:443/` port hop (it is preserved as
+ // `1234`), AND it must NOT be probed as `groups/1234` — GitLab reads a numeric
+ // groups/:id as a database group ID, not a path, which could falsely match an
+ // unrelated group. So the guard skips the probe and takes the safe --author path.
spawn.mockImplementation((cmd, args = []) => {
if (cmd === 'git' && args[0] === 'remote') return fakeChild('https://gitlab.example/1234/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: 3, title: 'x', assignees: [], labels: [] }]));
+ if (cmd === 'git' && args[0] === 'branch') return fakeChild('main\n');
+ if (cmd === 'glab' && args[0] === 'mr') return fakeChild('[]');
return fakeChild('');
});
const out = await detectGitlabIssues(app, { issueAuthorFilter: 'owner' });
- expect(out).toMatchObject({ reason: 'owner-is-group', total: 1 });
+ expect(out.actionable).toBe(true);
+ // No ambiguous groups/ probe was issued for the numeric namespace.
const probeCall = spawn.mock.calls.find(([cmd, a]) => cmd === 'glab' && a[0] === 'api' && String(a[1]).startsWith('groups/'));
- expect(probeCall[1][1]).toBe('groups/1234');
+ expect(probeCall).toBeUndefined();
+ // The preserved `1234` namespace is used as the author filter (not stripped).
+ const listCall = spawn.mock.calls.find(([cmd, a]) => cmd === 'glab' && a[0] === 'issue');
+ expect(listCall[1]).toContain('--author');
+ expect(listCall[1]).toContain('1234');
});
it('parses a bracketed IPv6 host without leaking the address into the namespace', async () => {