fix(dashboard): remove duplicate integration-advances UI; Sync working tree skips origin

Two cleanups in Git Manager → Status:

- Removed the duplicate "Sync local tip" button (gm-integration-actions)
  and the second "Recent integration advances" list (gm-recent-advances)
  that rendered above the highlighted block. Also dropped the dead
  mergeAdvanceEvents state, fetcher, and SSE subscription that only
  fed the deleted UI.

- Sync working tree is now pure-local. Added skipOriginFetch to
  PullGitBranchOptions.integration (and the matching POST /api/git/pull
  body field). When set, pullGitBranch skips tryFastForwardFromOrigin
  entirely — the sequence is just auto-stash → git reset --hard
  refs/heads/<integration> → restore stash. The Sync button passes
  skipOriginFetch: true because the "N need action" recovery is for
  catching the worktree up to a *local* merger ref-advance; touching
  origin could silently pull in unrelated remote commits.

Help disclosure rewritten to reflect the pure-local behavior.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-23 19:24:35 -07:00
parent 6e7f1e570e
commit 5d35b64bd1
3 changed files with 45 additions and 109 deletions

View File

@@ -1237,6 +1237,14 @@ export interface PullGitBranchOptions {
store: TaskStore;
settings: Settings;
runId: string;
/**
* When true, skip the `tryFastForwardFromOrigin` step entirely. Use this
* for "the merger advanced local `refs/heads/<branch>` and my worktree is
* stale relative to it" recovery — there's no need to fetch or merge from
* origin, just hard-reset the worktree to the local ref. Avoids silently
* pulling in unrelated remote work the operator didn't ask for.
*/
skipOriginFetch?: boolean;
};
}
@@ -1299,7 +1307,9 @@ export async function pullGitBranch(cwd?: string, options?: PullGitBranchOptions
}
const pullStart = performance.now();
await tryFastForwardFromOrigin(rootDir, taskId, integration.integrationBranch, integration.integrationRemote ?? "origin");
if (!integration.skipOriginFetch) {
await tryFastForwardFromOrigin(rootDir, taskId, integration.integrationBranch, integration.integrationRemote ?? "origin");
}
// Sync working tree + index to the local integration tip. The merger
// advances `refs/heads/<integrationBranch>` via `git update-ref` without
@@ -2966,13 +2976,16 @@ export function registerGitGitHubRoutes(ctx: ApiRoutesContext): void {
throw badRequest("Not a git repository");
}
const requestCache = new Map<string, string[]>();
const { rebase, worktreePath, integrationBranch, taskId } = req.body ?? {};
const { rebase, worktreePath, integrationBranch, taskId, skipOriginFetch } = req.body ?? {};
if (rebase !== undefined && typeof rebase !== "boolean") {
throw badRequest("rebase must be a boolean");
}
if (taskId !== undefined && typeof taskId !== "string") {
throw badRequest("taskId must be a string");
}
if (skipOriginFetch !== undefined && typeof skipOriginFetch !== "boolean") {
throw badRequest("skipOriginFetch must be a boolean");
}
if (worktreePath !== undefined) {
if (rebase === true) {
@@ -2999,6 +3012,7 @@ export function registerGitGitHubRoutes(ctx: ApiRoutesContext): void {
store: scopedStore,
settings,
runId,
skipOriginFetch: skipOriginFetch === true,
},
});
res.json(result);