Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

@ammar-agent ammar-agent commented Dec 22, 2025

Consolidates refresh orchestration logic into RefreshController:

Changes:

  • useReviewRefreshController now delegates debouncing, visibility/focus handling, and in-flight guards to RefreshController (−153 LoC)
  • Added isPaused callback and schedulePriority() to RefreshController (+43 LoC)
  • GitStatusStore uses schedulePriority() instead of a separate timer for active workspace (−11 LoC)
  • Fix: ReviewPanel no longer flashes when refresh returns identical diff — preserves hunk object references to prevent unnecessary HunkViewer re-renders
  • Fix: Manual refresh now worksrequestImmediate() bypasses isPaused check (regression from rewrite)

Net result: −121 LoC (before ReviewPanel fix) with unified refresh behavior across git status and review panel.

Active workspace priority: Still gets 1s debounce (vs 3s for background workspaces).


Generated with mux • Model: anthropic:claude-opus-4-5 • Thinking: high

@ammar-agent ammar-agent changed the title 🤖 perf: 1s debounce for active workspace git status 🤖 refactor: consolidate refresh logic into RefreshController Dec 23, 2025
Active workspace now uses 1s debounce for git status refresh after
file-modifying tools complete, while background workspaces keep 3s.

This makes the visible git indicators feel more responsive without
adding load from background workspace refreshes.
@ammar-agent ammar-agent force-pushed the git-debounce-5w4e branch 10 times, most recently from f464017 to 167e1ce Compare December 23, 2025 02:46
Adds debugging visibility to ReviewPanel's refresh button tooltip:
- Shows how long ago the last refresh occurred (e.g., '5s ago', '2m ago')
- Shows what triggered the refresh (manual click, tool completion, focus, etc.)
- Persisted per-workspace so it survives workspace switches

RefreshController now uses rate-limiting instead of debouncing:
- First event starts timer; subsequent events don't reset it
- Guarantees refresh fires within N seconds of first trigger
- Events during in-flight refresh queue a follow-up after completion
- Better UX during rapid tool calls (refreshes periodically vs never)

Fixes controller recreation bug: onRefresh callback was causing useMemo to
recreate the controller on every render, disposing active timers. Now uses
refs for callbacks to maintain stable dependencies.

Debug logging improvements:
- RefreshController accepts debugLabel for human-readable logs
- WorkspaceStore.getWorkspaceName() helper for log-friendly workspace names
- Logs now show workspace names instead of opaque IDs

Adds tests for file-modifying tool subscription mechanism.
Prevents refresh loops by construction - even if other guards fail,
executeRefresh() refuses to run if less than 500ms since last start.
- Enforce a 500ms minimum interval between refresh starts without dropping requests
- Manual refresh always bypasses pause/hidden by construction
- Remove always-on debug log spam from review refresh hook
- Update RefreshController tests for new behavior
- Manual refresh now bumps refreshTrigger immediately (no blocking fetch)
- Move origin/* git fetch into diff/tree load with GIT_TERMINAL_PROMPT=0
- Share origin fetch across file tree + diff via a keyed promise ref
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.

1 participant