Git Sync Settings - Credential Prompt Control#1761
Git Sync Settings - Credential Prompt Control#1761mrinc wants to merge 2 commits intopingdotgg:mainfrom
Conversation
…prompts Background git fetches every 15s trigger repeated 1Password/SSH agent popups when credentials aren't cached (fixes pingdotgg#1467). Adds a new "Git Sync" settings section with a polling mode selector (All sessions / Active session only / Disabled) and a quiet background fetches toggle that suppresses credential prompts via GIT_TERMINAL_PROMPT=0, SSH_ASKPASS="", etc. All defaults preserve existing behaviour. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Needs human review This PR adds a new user-facing feature with two git sync settings that control background polling behavior and credential prompt suppression. The changes affect runtime behavior across multiple server and client components, modifying how and whether git fetches occur. New feature introduction with runtime behavior changes warrants human review. You can customize Macroscope's approvability policy. Learn more. |
Closes #1467
Problem
t3code performs a background
git fetchevery ~15 seconds to compute ahead/behind counts.When a repository uses SSH remotes and the user's SSH agent (e.g. 1Password) requires
interactive confirmation, this causes repeated authentication dialogs that steal focus
and get killed by the 5-second fetch timeout before the user can respond.
Solution
Add server settings under a new "Git Sync" section in Settings.
All defaults preserve the current behaviour so existing users are unaffected.
"all"All sessions— all sessions poll (current behaviour).Active session only— only the focused session polls; sidebar background-thread queries pause.Disabled— no automatic git sync at all.GIT_TERMINAL_PROMPT=0,SSH_ASKPASS="",GIT_ASKPASS="",GCM_INTERACTIVE=neveron the fetch subprocess. Useful with SSH agents like 1Password.How It Works
Polling Mode (
gitPollingMode)"all"(default) — Every session and the sidebar poll for git status on their normal intervals (15s for active, 60s for sidebar threads). Server-side upstream fetch runs every 15s. No change from current behaviour."active-session"— The active/focused session polls normally. Sidebar thread status queries stop polling (refetchInterval: false). Server-side upstream fetch still runs when triggered by the active session's status query."disabled"— All client-side polling intervals are disabled (refetchInterval: false,refetchOnWindowFocus: false). Server-siderefreshStatusUpstreamIfStaleearly-returns without executinggit fetch. Manual operations (push, pull, checkout) still work.Quiet Background Fetches (
gitQuietBackgroundChecks)When enabled, the
fetchUpstreamRefForStatusfunction passes environment variables to thegit fetchsubprocess that suppress all interactive credential prompts:GIT_TERMINAL_PROMPT=0SSH_ASKPASS=""GIT_ASKPASS=""GCM_INTERACTIVE=neverIf credentials are already cached/loaded in the agent, the fetch succeeds silently. If not, it fails silently (the fetch already has
allowNonZeroExit: trueand the caller wraps it inEffect.ignoreCause).This toggle is visually disabled when polling mode is
"disabled"since there are no background fetches to quiet.Architecture
Data Flow
Server-Side (Effect layers)
GitCoreLivenow depends onServerSettingsService(yielded inmakeGitCore). Settings are read viaserverSettings.getSettingswithEffect.catch(() => Effect.succeed(null))fallback so settings errors don't break git operations.Client-Side (React Query)
gitStatusQueryOptionsandgitBranchSearchInfiniteQueryOptionsaccept an optional{ pollingEnabled }parameter that controlsrefetchInterval,refetchOnWindowFocus, andrefetchOnReconnect. Each consumer component derivespollingEnabledfromsettings.gitPollingMode.Files Changed (15 files, +184 / -29)
Schema & Contracts
packages/contracts/src/settings.ts— AddGitPollingModeliteral type ("all" | "active-session" | "disabled"),gitPollingModefield (default"all"), andgitQuietBackgroundChecksboolean (defaultfalse) toServerSettings+ServerSettingsPatchServer — Git Fetch Control
apps/server/src/git/Layers/GitCore.ts(+52 / -14)envfield toExecuteGitOptionsinterface and forward it throughexecuteGit→execute→ subprocess spawnServerSettingsService, yield it inmakeGitCorerefreshStatusUpstreamIfStale: early-return whengitPollingMode === "disabled"fetchUpstreamRefForStatus: readgitQuietBackgroundChecks, conditionally set quiet env vars on the fetch subprocessClient — Polling Interval Control
apps/web/src/lib/gitReactQuery.ts— Add optionalpollingEnabledparam togitStatusQueryOptionsandgitBranchSearchInfiniteQueryOptions; controlsrefetchInterval,refetchOnWindowFocus,refetchOnReconnectapps/web/src/components/Sidebar.tsx— Sidebar thread polling enabled only whengitPollingMode === "all"apps/web/src/components/ChatView.tsx— DerivepollingEnabledfromgitPollingMode !== "disabled"apps/web/src/components/DiffPanel.tsx— Same patternapps/web/src/components/GitActionsControl.tsx— Same pattern (addeduseSettingsimport)apps/web/src/components/BranchToolbarBranchSelector.tsx— Same pattern for both status and branch search queries (addeduseSettingsimport)Settings UI
apps/web/src/components/settings/SettingsPanels.tsx(+80)GIT_POLLING_MODE_LABELSconstantSettingsSectionbetween Providers and Advanced with:Selectwith three options (All sessions / Active session only / Disabled)Switchtoggle, disabled when polling mode is "Disabled"Test Files — New Layer Dependency
Adding
ServerSettingsServiceas a dependency ofGitCoreLiverequires providingServerSettingsService.layerTest()in test layer stacks:apps/server/src/git/Layers/GitCore.test.tsapps/server/src/git/Layers/GitManager.test.tsapps/server/src/checkpointing/Layers/CheckpointStore.test.tsapps/server/src/orchestration/Layers/CheckpointReactor.test.tsapps/server/src/workspace/Layers/WorkspaceEntries.test.tsapps/server/src/workspace/Layers/WorkspaceFileSystem.test.tsVerification
npx turbo run build— all 5 tasks passnode dist/bin.mjs— starts cleanly on:3773, no errorsEffect.catch(notEffect.catchAll) is the correct API for Effect 4.0 betaNote
Add Git Sync settings to control background polling mode and credential prompts
gitPollingMode(all|active-session|disabled) andgitQuietBackgroundChecks(boolean), configurable via a new Git Sync section in the General Settings panel.gitPollingModeisdisabled, background upstream status refresh is skipped server-side inGitCore, and all client-side git status/branch polling (Sidebar, ChatView, DiffPanel, GitActionsControl, BranchToolbarBranchSelector) is suspended.gitQuietBackgroundChecksis enabled, background git fetches suppress interactive credential prompts by settingGIT_TERMINAL_PROMPT=0,GIT_ASKPASS,SSH_ASKPASSempty, andGCM_INTERACTIVE=never.gitPollingModedefaults toallandgitQuietBackgroundChecksdefaults tofalse, preserving existing behavior for users who have not changed settings.Macroscope summarized a789d30.