Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Problem

When git status checks fail (timeout, parse error, network issues), the store was clearing the cached status and setting it to null. This caused the git indicators in the UI to disappear during transient failures, creating visual flicker and losing useful information.

Before:

timeout → status cleared → indicator disappears → next poll → indicator reappears

After:

timeout → old status preserved → indicator remains stable

Solution

Only update statusCache when the new status check succeeds (non-null). On failure:

  • Keep the old cached status
  • Don't bump the version (no re-render)
  • Silent degradation - stale data is better than no data
if (!this.areStatusesEqual(oldStatus, newStatus)) {
  if (newStatus !== null) {  // ✅ Only update on success
    this.statusCache.set(workspaceId, newStatus);
    this.statuses.bump(workspaceId);
  }
  // On failure: keep old status, don't bump
}

Scenarios This Helps

  1. Slow network/disk - 5 second timeout may be too aggressive for large repos with remote on slow connection
  2. Transient failures - Network hiccup, disk busy (antivirus, backup), workspace temporarily unmounted
  3. Repository issues - Corruption, remote unreachable (better to show last known state than hide indicator)

Testing

Added unit tests to verify:

  • Old status is preserved when checkWorkspaceStatus returns null
  • Status updates normally when checks succeed after previous failures
  • No re-renders occur when status check fails (listeners not called)

All 489 tests pass.

Generated with cmux

When git status checks fail (timeout, parse error, etc.), preserve the
last known status instead of clearing it. This prevents UI flicker and
maintains visibility of repository state during transient failures.

Before: timeout → status cleared → indicator disappears
After: timeout → old status preserved → indicator remains stable

The fix is simple: only update statusCache when newStatus is non-null.
On failure, we skip both the cache update and the bump, preventing
unnecessary re-renders while keeping stale (but useful) data visible.

Scenarios this helps:
- Slow network/disk (5s timeout may be too aggressive)
- Transient failures (network hiccup, disk busy)
- Repository temporarily unavailable

Added tests to verify:
- Old status is preserved when checks fail
- Status updates normally when checks succeed
@ammario ammario added this pull request to the merge queue Oct 14, 2025
Merged via the queue into main with commit d29d26d Oct 14, 2025
11 of 12 checks passed
@ammario ammario deleted the preserve-git-status-on-timeout branch October 14, 2025 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants