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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: add force option to getRemoteBranches and wire Remote Branches Refresh button (#4563)
[._.]/ Adam Eivy3e8f0ed08ccb
diff --git a/client/src/components/apps/tabs/GitTab.jsx b/client/src/components/apps/tabs/GitTab.jsxindex bee050986e..9c42f29921 100644--- a/client/src/components/apps/tabs/GitTab.jsx+++ b/client/src/components/apps/tabs/GitTab.jsx@@ -145,10 +145,10 @@ export default function GitTab({ appId: _appId, appName, repoPath }) {const loadGitInfo = useCallback(() => loadGitData({ includeRemote: false }), [loadGitData]);- const loadRemoteBranches = useCallback(async () => {+ const loadRemoteBranches = useCallback(async (opts = {}) => {if (!repoPath) return;setLoadingRemote(true);- const result = await api.getRemoteBranches(repoPath).catch(() => null);+ const result = await api.getRemoteBranches(repoPath, opts).catch(() => null);if (result) {setRemoteBranches(result.branches || []);setDefaultBranch(result.defaultBranch || 'main');@@ -769,7 +769,7 @@ export default function GitTab({ appId: _appId, appName, repoPath }) {</div>)}<button- onClick={loadRemoteBranches}+ onClick={() => loadRemoteBranches({ force: true })}disabled={loadingRemote}className={`text-xs ${touchBtnCls} text-port-accent hover:underline disabled:opacity-50`}>diff --git a/client/src/services/apiGit.js b/client/src/services/apiGit.jsindex c6517dab6e..2b2c9bd90b 100644--- a/client/src/services/apiGit.js+++ b/client/src/services/apiGit.js@@ -61,9 +61,9 @@ export const syncBranch = (path, branch) => request('/git/sync', {method: 'POST',body: JSON.stringify({ path, branch })});-export const getRemoteBranches = (path) => request('/git/remote-branches', {+export const getRemoteBranches = (path, { force = false } = {}) => request('/git/remote-branches', {method: 'POST',- body: JSON.stringify({ path })+ body: JSON.stringify({ path, force })});// `options` lets a caller suppress request()'s auto-toast with `{ silent: true }`// when it already renders its own error UI.diff --git a/server/routes/git.js b/server/routes/git.jsindex 1f262139b7..f8b228b997 100644--- a/server/routes/git.js+++ b/server/routes/git.js@@ -221,9 +221,9 @@ router.post('/sync', asyncHandler(async (req, res) => {// POST /api/git/remote-branches - Get remote branches with merge statusrouter.post('/remote-branches', asyncHandler(async (req, res) => {- const { path } = req.body;+ const { path, force } = req.body;assertAllowedWorkspace(path);- const result = await git.getRemoteBranches(path);+ const result = await git.getRemoteBranches(path, { force });res.json(result);}));diff --git a/server/services/git.fetchOrigin.test.js b/server/services/git.fetchOrigin.test.jsindex 94fe33175a..4639f86a06 100644--- a/server/services/git.fetchOrigin.test.js+++ b/server/services/git.fetchOrigin.test.js@@ -121,4 +121,17 @@ describe('getRemoteBranches fetch freshness window & deduplication', () => {expect(fetchCalls).toHaveLength(1);expect(fetchCalls[0][0]).toEqual(['fetch', 'origin']);});++ it('bypasses freshness window when getRemoteBranches is called with force option', async () => {+ execGitMock.mockResolvedValue({ stdout: 'origin/main|2026-08-19|author\n', stderr: '', exitCode: 0 });++ await getRemoteBranches('/repo-forced');+ const callsFirst = execGitMock.mock.calls.filter(c => c[0][0] === 'fetch');+ expect(callsFirst).toHaveLength(1);++ // Second call with force = true+ await getRemoteBranches('/repo-forced', { force: true });+ const callsSecond = execGitMock.mock.calls.filter(c => c[0][0] === 'fetch');+ expect(callsSecond).toHaveLength(2);+ });});diff --git a/server/services/git.js b/server/services/git.jsindex 007536c090..37bc68031a 100644--- a/server/services/git.js+++ b/server/services/git.js@@ -916,9 +916,9 @@ export async function ensureLatest(dir) {* Returns branches that exist on origin, indicating whether each has been* fully merged into the default branch and whether a local copy exists.*/-export async function getRemoteBranches(dir) {- // Fetch latest refs if not fresh within window- if (!isFetchFresh(dir)) {+export async function getRemoteBranches(dir, { force = false } = {}) {+ // Fetch latest refs if forced or not fresh within window+ if (force || !isFetchFresh(dir)) {if (activeFetches.has(dir)) {await activeFetches.get(dir);} else {