Repository navigation
fix: add timeout to the cached git runner - #585
Merged
Merged
Conversation
runGitArgs called execFileSync without a timeout, unlike every other external CLI call site (all use a 5s cap). On slow or blocking mounts (network filesystems, hung credential helpers) a cache miss could freeze the statusline process indefinitely. A timeout now surfaces as an error, which the existing catch already handles by caching null. Fixes sirmalloc#557
tahodev
force-pushed
the
fix/git-exec-timeout
branch
from
September 10, 2026 23:14
cde7e8d to
88c8717
Compare
sirmalloc
added a commit
to SR0725/ccstatusline
that referenced
this pull request
Sep 17, 2026
Resolve the overlapping Git timeout fixes from PRs sirmalloc#559 and sirmalloc#585 by keeping SR0725's GIT_COMMAND_TIMEOUT_MS constant with the module settings and retaining the timeout rationale from sirmalloc#585. Both PRs implement the same five-second timeout and shared test assertion. The resolution preserves the existing runtime behavior and SR0725's original contribution in this branch's history. Co-authored-by: SR0725 <[email protected]>
This was referenced Sep 18, 2026
Closed
pcvelz
added a commit
to pcvelz/ccstatusline-usage
that referenced
this pull request
Sep 25, 2026
Upstream: TUI kept off the render path (sirmalloc#575), flex mode default full (sirmalloc#590), usage cache fingerprinted by refresh token (sirmalloc#536), CLAUDE_CONFIG_DIR keychain credential first (sirmalloc#573), llms.txt (sirmalloc#527), faster terminal width probing (sirmalloc#501), git/jj symbol slots (sirmalloc#574), model-scoped 0% quota as real zero (sirmalloc#534), custom-command output cache + timeout (sirmalloc#539), usage-percent widgets on a shared module (sirmalloc#545), hideable reset-timer placeholders (sirmalloc#542), git command timeouts (sirmalloc#559, sirmalloc#585) Hand edits outside conflicts: - src/widgets/shared/usage-percent-widget.ts: compat fix - pass RenderContext to getUsageProgressBarWidth (fork narrow/medium bar widths) and add fork short labels WS:/WO: that the extracted Sonnet/Opus widgets used to render; point the fable-weekly kind at the fork field weeklyFableUsage / resolveWeeklyFableUsageWindow (upstream's fableUsage / resolveFableUsageWindow do not exist in the fork and crashed the render) - .fork-keep-deleted: drop llms.txt (points agents at the upstream package and at docs the fork deletes) Conflict resolutions that deviate from upstream on purpose: - src/types/Settings.ts: keep fork default flexMode full-minus-40 (upstream sirmalloc#590 switched to full) - src/utils/terminal.ts: keep fork tmux $TMUX_PANE width probe, ported to execFileSync; upstream's CCSTATUSLINE_WIDTH override in getTerminalWidth replaces the fork copy - src/ccstatusline.ts: keep getTerminalWidth() without the per-session width cache options (fork invariant); add upstream customCommandCacheTtlSeconds - src/widgets/WeeklyFableUsage.ts (+ test): keep fork widget (Fable:/F: labels, 0% for accounts without Fable, weeklyFableUsage field) instead of upstream's shared-module FableWeeklyUsage - src/utils/__tests__/usage-fetch.test.ts: adopt upstream sirmalloc#534 real-zero semantics on the fork field weeklyFableUsage - docs/test-retirements.md: ledger entries for four tests upstream renamed or replaced (sirmalloc#542, sirmalloc#534) and one duplicate upstream test dropped - src/utils/__tests__/usage-fetch.test.ts: compat - upstream's model-scoped real-zero test expects the fork field weeklyFableUsage - src/widgets/__tests__/WeeklyFableUsage.test.ts: compat - set the shared suite's new required expectedWholePercentTime - src/tui/components/__tests__/ImportPreviewDialog.test.ts: fork deviation - default flexMode is full-minus-40, so the non-default side is full - src/utils/__tests__/usage-fetch.test.ts: drop upstream's duplicate "missing fable window" test that used the upstream-only fableUsage field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
runGitArgsinsrc/utils/git.tscalledexecFileSync('git', args, ...)without atimeout, while every other external CLI call site in the bundle passes a 5-second cap (CLI_TIMEOUT). This is the path every git widget takes on a cache miss, so on repositories wheregitis slow or blocks (network mounts, hung credential helpers) the statusline process could hang indefinitely with nothing to reap it.Fix
Pass
timeout: GIT_EXEC_TIMEOUT(5,000 ms, matching the other call sites) to the cached runner. On timeoutexecFileSyncthrows, and the existingcatchalready handles that path by cachingnull- the widget renders empty instead of freezing the statusline. Also asserted the timeout in the sharedexpectGitExecOptionstest helper so all call sites using it now verify the cap.Verification
tsc --noEmitclean.vitest run src/utils/__tests__/git-remote.test.ts(exercisesrunGitArgsthrough the updated shared helper) - all pass.git.test.tsshows the same 8 failures before and after this change; they are a pre-existing environment issue (vi.spyOn(os, 'homedir')not configurable under this vitest/ESM setup) and unrelated to the change.Fixes #557