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): strip remote credentials from host parse + merge GitLab MR by IID

[._.]/ Adam Eivy38ce1b8ecb55
diff --git a/server/lib/workTracker.js b/server/lib/workTracker.js
index 6887c6b5f2..4bfac4d83c 100644
--- a/server/lib/workTracker.js
+++ b/server/lib/workTracker.js
@@ -109,10 +109,16 @@ export function resolveWorkTracker({ configured, host } = {}) {
* the GitLab-subgroup-tolerant parser (`group/subgroup/repo`) — otherwise a
* subgroup remote yields no host and `'auto'` wrongly falls back to PLAN.md
* instead of GitLab. Returns null for unparseable input.
+ *
+ * URL-form credentials (`https://user:token@host/…`) are stripped FIRST: the
+ * subgroup fallback parser would otherwise capture `user:token@host` as the
+ * host and leak the PAT through `GET /api/apps/:id/work-tracker`. SCP-style
+ * `git@host:…` carries only an ssh username (no secret), so it's left intact.
*/
export function hostFromOriginUrl(url) {
if (!url) return null;
- return parseGitRemoteUrl(url)?.host || parseGitRemote(url)?.host || null;
+ const cleaned = url.replace(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)[^/@]+@/, '$1');
+ return parseGitRemoteUrl(cleaned)?.host || parseGitRemote(cleaned)?.host || null;
}
/**
diff --git a/server/lib/workTracker.test.js b/server/lib/workTracker.test.js
index 9ace5ad753..c28a3e7167 100644
--- a/server/lib/workTracker.test.js
+++ b/server/lib/workTracker.test.js
@@ -109,6 +109,16 @@ describe('hostFromOriginUrl', () => {
expect(hostFromOriginUrl('not a url')).toBeNull();
});
+ it('strips embedded credentials so a PAT never surfaces as the host', () => {
+ // A token in an https remote must not leak through the host field — even on
+ // the subgroup fallback path where the strict parser bails. The host must be
+ // clean AND correct (so auto still resolves to GitLab).
+ expect(hostFromOriginUrl('https://oauth2:[email protected]/group/sub/repo.git')).toBe('gitlab.com');
+ expect(hostFromOriginUrl('https://user:[email protected]/owner/repo.git')).toBe('github.com');
+ // SCP-style git@host carries only an ssh user (no secret) — host unaffected.
+ expect(hostFromOriginUrl('[email protected]:group/sub/repo.git')).toBe('gitlab.com');
+ });
+
it('a subgroup GitLab remote resolves to the gitlab tracker end-to-end', () => {
const host = hostFromOriginUrl('[email protected]:group/subgroup/repo.git');
expect(resolveWorkTracker({ configured: 'auto', host }).resolved).toBe('gitlab');
diff --git a/server/services/taskPromptDefaults/integrity.snapshot.json b/server/services/taskPromptDefaults/integrity.snapshot.json
index 07f85bc48a..8e153ca4b1 100644
--- a/server/services/taskPromptDefaults/integrity.snapshot.json
+++ b/server/services/taskPromptDefaults/integrity.snapshot.json
@@ -13,7 +13,7 @@
"feature-ideas": "0741418bd275b8953131155f8bc89460",
"plan-task": "5425306bf082b15b6a17f972557d4dd9",
"claim-issue": "28f09436566c281a6915d6ad4c1b80f8",
- "claim-issue-gitlab": "6163ee84f97c88df0339a09fee6994e0",
+ "claim-issue-gitlab": "880dd7820ac90c689065e28cdca032fb",
"code-reviewer-review": "1cd13ee5142d130f95cc390098d0f278",
"code-reviewer-implement": "ab2c3e16d54e195bdf856574b7702042",
"error-handling": "9afba2e99b90a8d5771c75e7f0615d96",
diff --git a/server/services/taskPromptDefaults/prompts.js b/server/services/taskPromptDefaults/prompts.js
index b9dd9e6814..9b01633fd8 100644
--- a/server/services/taskPromptDefaults/prompts.js
+++ b/server/services/taskPromptDefaults/prompts.js
@@ -709,12 +709,12 @@ The configured reviewers for this task, in order, are \`{reviewers}\`. \`claude\
2. **Wait for each configured CLI reviewer's findings BEFORE merging.** For \`claude\` / \`codex\` / \`antigravity\`, invoke that CLI headless against the MR diff, apply fixes, run tests, re-push — capped at 3 rounds — then advance to the next reviewer.
**Review-stuck cleanup** (after 3 unresolved rounds): post one summarizing MR note (\`glab mr note\`), then run the worktree-only cleanup (\`cd {repoPath} && git worktree remove "\${WORKTREE}"\`). Leave the local branch, the open MR, the assignee, and the \`in-progress\` label in place so the human picks up cold. Do NOT run Phase 7.
-3. **Merge via \`glab mr merge\`** — NEVER a local \`git merge\`:
+3. **Merge via \`glab mr merge\`** — NEVER a local \`git merge\`. \`glab mr merge\` takes the **MR IID**, which is NOT the issue number — resolve it from the source branch first, then merge by that IID:
\`\`\`bash
- glab mr merge "\${NUM}" --yes --remove-source-branch \\
- || glab mr merge "\${NUM}" --yes --squash --remove-source-branch
+ MR_IID="$(glab mr list --source-branch "claim/issue-\${NUM}" -F json | sed -n 's/.*"iid":\\([0-9]\\{1,\\}\\).*/\\1/p' | head -1)"
+ glab mr merge "\${MR_IID}" --yes --remove-source-branch \\
+ || glab mr merge "\${MR_IID}" --yes --squash --remove-source-branch
\`\`\`
- (\`glab mr merge\` takes the MR IID; if it differs from the issue number, resolve it with \`glab mr list --source-branch "claim/issue-\${NUM}" -F json\` first.)
## Phase 7 — Clean up (post-merge ONLY)