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: GitLab forge skip + conditional push instruction

Adam Eivye068925f8ad7
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index a1662a183d..361cda36bd 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -1194,7 +1194,10 @@ export async function cleanupAgentWorktree(agentId, success, { openPR = false, r
if (shouldRequestCopilot) {
const reviewResult = await git.requestCopilotReview(worktreePath, prResult.url).catch(err => ({ success: false, error: err.message }));
- if (reviewResult.success) {
+ if (reviewResult.success && reviewResult.skipped) {
+ // Non-GitHub forge (e.g. GitLab MR) — Copilot reviewer doesn't exist there. Log info, no warning.
+ emitLog('info', `🤖 Skipping Copilot review request for ${prResult.url} (non-GitHub forge)`, { agentId, prUrl: prResult.url });
+ } else if (reviewResult.success) {
emitLog('success', `🤖 Requested Copilot review on ${prResult.url}`, { agentId, prUrl: prResult.url });
} else {
emitLog('warn', `🤖 Failed to request Copilot review on ${prResult.url}: ${reviewResult.error}`, { agentId, prUrl: prResult.url });
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index 6f55622dfd..42eea87039 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -310,7 +310,9 @@ ${skillSection ? `## Task-Type Skill Guidelines\n\n${skillSection}\n` : ''}${too
1. Analyze the task requirements carefully
2. Make necessary changes to complete the task
3. Test your changes when possible
-4. Commit and push your changes (see Git Hygiene below)
+4. ${worktreeInfo && willOpenPR
+ ? 'Commit your changes (see Git Hygiene below) — do NOT push, the system handles that on exit'
+ : 'Commit and push your changes (see Git Hygiene below)'}
5. Provide a summary of what was done
## Guidelines
diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.js
index 5b9ec94be7..2fe5f89358 100644
--- a/server/services/cleanupAgentWorktree.test.js
+++ b/server/services/cleanupAgentWorktree.test.js
@@ -429,6 +429,20 @@ describe('cleanupAgentWorktree - openPR path', () => {
expect(warnings.some(w => w.includes('Copilot review request failed'))).toBe(true);
expect(removeWorktree).toHaveBeenCalled();
});
+
+ it('should NOT record a warning when Copilot review is skipped on a non-GitHub forge', async () => {
+ // Regression: GitLab MRs would previously emit a Copilot review request failure
+ // warning since the helper returned { success: false, error: '...GitHub-only' }.
+ // The new contract: { success: true, skipped: true } → no warning, info-level log.
+ git.push.mockResolvedValue(undefined);
+ git.createPR.mockResolvedValue({ success: true, url: 'https://gitlab.com/group/proj/-/merge_requests/11' });
+ git.requestCopilotReview.mockResolvedValue({ success: true, skipped: true });
+
+ const warnings = await cleanupAgentWorktree('agent-1', true, { openPR: true, requestCopilotReview: true, description: 'Test' });
+
+ expect(warnings.some(w => w.includes('Copilot review'))).toBe(false);
+ expect(removeWorktree).toHaveBeenCalled();
+ });
});
describe('spawnMergeRecoveryTask', () => {
diff --git a/server/services/git.js b/server/services/git.js
index 659ac1ef40..5ff6c63336 100644
--- a/server/services/git.js
+++ b/server/services/git.js
@@ -539,18 +539,23 @@ export function parsePullRequestUrl(url) {
/**
* Request a Copilot code review on a GitHub PR. The reviewer login MUST include
* the `[bot]` suffix or GitHub returns 422 "must be a collaborator". GitLab has
- * no equivalent — this is a GitHub-only no-op there.
+ * no equivalent — this is a GitHub-only no-op there, signaled with
+ * `{ success: true, skipped: true }` so callers can treat it as a successful
+ * non-event rather than a real failure (avoiding spurious warnings/notifications
+ * on GitLab MRs).
*
* @param {string} dir - Working directory used to resolve gh auth
* @param {string} prUrl - PR URL returned by createPR
- * @returns {Promise<{success: boolean, error?: string}>}
+ * @returns {Promise<{success: boolean, skipped?: boolean, error?: string}>}
*/
export async function requestCopilotReview(dir, prUrl) {
const parsed = parsePullRequestUrl(prUrl);
if (!parsed) return { success: false, error: `unparseable PR URL: ${prUrl}` };
const { cli, env } = await resolveForgeForRepo(dir);
- if (cli !== 'gh') return { success: false, error: `Copilot reviewer is GitHub-only (got ${cli})` };
+ // Non-GitHub forges have no Copilot reviewer to request — treat as a successful skip
+ // so cleanupAgentWorktree doesn't emit a warning for every GitLab MR.
+ if (cli !== 'gh') return { success: true, skipped: true };
const args = [
'api',
diff --git a/server/services/git.test.js b/server/services/git.test.js
index dc3bc71848..6506bcbda1 100644
--- a/server/services/git.test.js
+++ b/server/services/git.test.js
@@ -179,6 +179,19 @@ describe('requestCopilotReview', () => {
expect(result).toHaveProperty('success');
if (!result.success) expect(typeof result.error).toBe('string');
});
+
+ it('non-GitHub forge result shape: success=true with skipped=true (callers treat as successful non-event)', async () => {
+ // resolveForgeForRepo is internal to git.js so we cannot mock it directly.
+ // Instead, verify the result-shape contract: when success is true, callers
+ // (cleanupAgentWorktree) only need to distinguish a real review request from
+ // a no-op via the `skipped` flag. Here we just assert the function never
+ // throws on a GitLab URL and returns a structured result the caller can
+ // branch on. The behavior assertion (info-not-warning logging) is covered
+ // in cleanupAgentWorktree.test.js once we plumb the skipped flag through.
+ const result = await requestCopilotReview('/nonexistent-path-for-test', 'https://gitlab.com/group/proj/-/merge_requests/1');
+ expect(result).toHaveProperty('success');
+ expect(typeof result.success).toBe('boolean');
+ });
});
describe('extractAgentSummary', () => {