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 (claude): drop unused param, label/assignee filter parity, drain glab stderr, real hostToWorkTracker in test

Adam Eivyf482f4f6d927
diff --git a/server/services/gitlab.js b/server/services/gitlab.js
index 3bfffd5701..907a72904d 100644
--- a/server/services/gitlab.js
+++ b/server/services/gitlab.js
@@ -19,8 +19,10 @@ export function execGlab(args, cwd) {
const child = spawn('glab', args, { cwd, shell: false, windowsHide: true });
let stdout = '';
child.stdout.on('data', (d) => { stdout += d.toString(); });
- // stderr is intentionally ignored — a failed glab call resolves to null via
- // the exit code, and we never surface glab's stderr to the caller.
+ // We never surface glab's stderr to the caller (a failed call resolves to null
+ // via the exit code), but stderr MUST still be drained — an unread pipe can
+ // fill its buffer and block the child on a chatty warning.
+ child.stderr.on('data', () => {});
child.on('close', (code) => resolve(code === 0 ? stdout.trim() : null));
child.on('error', () => resolve(null));
});
diff --git a/server/services/issueReconcile.js b/server/services/issueReconcile.js
index 468f222f75..a57fda7940 100644
--- a/server/services/issueReconcile.js
+++ b/server/services/issueReconcile.js
@@ -147,8 +147,8 @@ function normalizeGithubIssue(issue) {
number: issue.number,
title: issue.title || '',
url: issue.url || '',
- labels: Array.isArray(issue.labels) ? issue.labels.map((l) => l.name) : [],
- assignees: Array.isArray(issue.assignees) ? issue.assignees.map((a) => a.login) : [],
+ labels: Array.isArray(issue.labels) ? issue.labels.map((l) => l.name).filter(Boolean) : [],
+ assignees: Array.isArray(issue.assignees) ? issue.assignees.map((a) => a.login).filter(Boolean) : [],
};
}
@@ -156,11 +156,12 @@ function normalizeGithubIssue(issue) {
* Fetch issue/PR facts from GitHub, normalized to the common shape. Returns null
* on any gh failure (degrade: the caller treats null as "nothing to reconcile /
* transient"). `fullName` is resolved by the dispatcher, not re-queried here.
- * @param {string} repoPath
+ * Unlike `getGitlabState`, this needs no `repoPath` — `gh` targets the repo via
+ * `--repo <fullName>` rather than resolving from the working directory.
* @param {string} fullName
* @returns {Promise<{forge:'github', fullName:string, inProgress:object[], mergedPrs:object[], openPrs:object[]}|null>}
*/
-async function getGithubState(repoPath, fullName) {
+async function getGithubState(fullName) {
const [issuesRaw, mergedRaw, openRaw] = await Promise.all([
execGh(['issue', 'list', '--repo', fullName, '--state', 'open',
'--label', IN_PROGRESS_LABEL, '--limit', String(GH_LIST_LIMIT),
@@ -265,7 +266,7 @@ async function getForgeState(repoPath) {
// 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(repoPath, origin.fullName);
+ if (origin.isGithub) return getGithubState(origin.fullName);
if (hostToWorkTracker(origin.host) === 'gitlab') return getGitlabState(repoPath, origin.fullName);
return null;
}
diff --git a/server/services/issueReconcile.test.js b/server/services/issueReconcile.test.js
index 57f2d15b85..30f2e27162 100644
--- a/server/services/issueReconcile.test.js
+++ b/server/services/issueReconcile.test.js
@@ -22,16 +22,13 @@ 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' })),
}));
-// hostToWorkTracker is the canonical host→forge classifier; use the real logic
-// so the GitLab branch is exercised through the same mapping production uses.
-vi.mock('../lib/workTracker.js', () => ({
- hostToWorkTracker: (host) => {
- if (!host) return null;
- if (/(^|\.)gitlab\./.test(host) || host === 'gitlab.com') return 'gitlab';
- if (/(^|\.)github\./.test(host) || host === 'github.com') return 'github';
- return null;
- },
-}));
+// 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 };
+});
vi.mock('../lib/fileUtils.js', () => ({
PATHS: { root: '/repo' },
safeJSONParse: (raw, fallback) => { try { return JSON.parse(raw); } catch { return fallback; } },