GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Guard git quick actions for diverged or stale branch status by juliusmarminge · Pull Request #47 · pingdotgg/t3code

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Feb 15, 2026 •
edited by coderabbitai Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Summary

  • Prevent quick pull/sync actions when the branch has diverged (ahead and behind), and show a disabled hint to rebase/merge first.
  • Add logic to detect when gitStatus.branch is out of sync with the current branch list and temporarily gate actions until queries refresh.
  • Route action/menu/dialog rendering through synchronized status data to avoid acting on stale branch context.
  • Update UI hints so “Behind upstream” messaging only appears for non-diverged behind state.
  • Add unit test coverage for diverged branch quick-action behavior.

Testing

  • apps/web/src/components/GitActionsControl.logic.test.ts: added test asserting diverged status resolves to disabled Sync branch hint.
  • Lint: Not run
  • Full test suite: Not run

Open with Devin

Summary by CodeRabbit

  • New Features

    • Detects when a local branch has diverged and shows a disabled "Sync branch" action with guidance to rebase/merge first
    • Shows a "Refreshing git status..." indicator while status resynchronizes
  • Bug Fixes

    • Runs upstream refresh in the background to keep checkout responsive and improves git status synchronization to avoid UI inconsistencies
  • Tests

    • Adds tests for divergence, background refresh timing, fetch recording during checkout, and async stability checks

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@coderabbitai

coderabbitai Bot commented Feb 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Walkthrough

Adds branch divergence detection that disables the "Sync branch" quick action when a branch is both ahead and behind upstream. Introduces a null-safe git status proxy in the UI while resynchronizing and starts upstream refresh in the background on checkout; tests updated to handle asynchronous refresh/fetch behavior.

Changes

Cohort / File(s) Summary
Divergence Detection
apps/web/src/components/GitActionsControl.logic.ts, apps/web/src/components/GitActionsControl.logic.test.ts
Adds detection for diverged branches (aheadCount > 0 && behindCount > 0). Returns a disabled "Sync branch" quick action with hint to rebase/merge; adds a unit test for the diverged scenario.
Status Synchronization (UI)
apps/web/src/components/GitActionsControl.tsx
Introduces gitStatusForActions (null while out-of-sync), invalidates queries when gitStatus is out-of-sync, replaces direct gitStatus usage with gitStatusForActions, displays "Refreshing git status..." during resync, and guards UI logic for null status.
Checkout Background Refresh (server & tests)
apps/server/src/git.ts, apps/server/src/git.test.ts
Makes refreshCheckedOutBranchUpstream run asynchronously (background) after checkout instead of awaiting; updates tests to wait for asynchronous refresh/fetch activity, record fetch args, and add a slow-refresh scenario to validate background fetch behavior.

Sequence Diagram(s)

sequenceDiagram
    participant UI as Web UI (GitActionsControl)
    participant API as Server API (checkout)
    participant Core as GitCoreService

    UI->>API: request checkoutBranch
    API->>Core: perform checkout
    Core-->>API: checkout result
    API-->>UI: return checkout result (immediate)
    API->>Core: start refreshCheckedOutBranchUpstream (async)
    Note right of Core: background fetch may be delayed/long-running
    Core-->>API: (background) fetch complete
    API->>UI: subsequent status invalidation/notification
    UI->>UI: set gitStatusForActions = null while resyncing
    UI-->>UI: show "Refreshing git status..."
    UI->>API: refetch git status
    API->>Core: query status
    Core-->>API: latest status
    API->>UI: deliver updated git status (gitStatusForActions populated)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Guard git quick actions for diverged or stale branch status' accurately summarizes the main changes in this PR.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/too-aggresive-pull-action

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
apps/server/src/git.test.ts (1)

402-441: Test validates non-blocking checkout behavior well, but consider awaiting the released fetch.

The SlowRefreshGitCoreService pattern effectively proves checkout resolves before the background fetch completes. However, calling releaseFetch() at the end without awaiting the released promise may leave it dangling. While this doesn't affect test correctness, it could cause flaky warnings or resource cleanup issues in some test runners.

♻️ Optional: Await the background operation to ensure clean teardown
       const core = new SlowRefreshGitCoreService();
+      // Capture the background refresh promise before checkout triggers it
+      let backgroundRefreshPromise: Promise<void> | undefined;
+      const originalCheckout = core.checkoutBranch.bind(core);
+      core.checkoutBranch = async (input) => {
+        const result = originalCheckout(input);
+        // The background refresh is already started; we'll release and await it later
+        return result;
+      };
       await expect(core.checkoutBranch({ cwd: source.path, branch: featureBranch })).resolves.toBe(
         undefined,
       );
       await vi.waitFor(() => {
         expect(core.fetchStarted).toBe(true);
       });
       expect(await git(source.path, "branch --show-current")).toBe(featureBranch);
       core.releaseFetch();
+      // Allow the background promise to settle to avoid dangling promises
+      await vi.waitFor(() => Promise.resolve());
     });

Alternatively, simply adding a small await Promise.resolve() after releaseFetch() ensures the microtask queue flushes.


Comment @coderabbitai help to get the list of available commands and usage tips.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@macroscopeapp

macroscopeapp Bot commented Feb 15, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Guard GitActionsControl quick actions for diverged or stale git status and run GitCoreService.checkoutBranch upstream refresh asynchronously in git.ts and GitActionsControl.tsx

Make GitCoreService.checkoutBranch fire refreshCheckedOutBranchUpstream in the background, gate quick actions when gitStatus is out of sync with the current branch, and return a disabled Sync action when both ahead and behind are positive. Tests add async waits and a diverged-branch case.

📍Where to Start

Start with GitCoreService.checkoutBranch in git.ts, then review resolveQuickAction in GitActionsControl.logic.ts and the GitActionsControl flow in GitActionsControl.tsx.


Macroscope summarized 724ecbe.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@greptile-apps

greptile-apps Bot commented Feb 15, 2026

Copy link
Copy Markdown

Greptile Summary

Improved git status synchronization and diverged branch handling by preventing quick actions when branches have both ahead and behind commits. The PR adds stale status detection that triggers automatic query refresh when gitStatus.branch differs from the current branch in branchList, and gates all action/menu/dialog rendering through gitStatusForActions to avoid acting on outdated context.

Key changes:

  • Added isDiverged check in resolveQuickAction to return disabled "Sync branch" hint when both aheadCount > 0 and behindCount > 0
  • Introduced isGitStatusOutOfSync detection in component to compare gitStatus.branch with current branch from branch list
  • Added useEffect hook that invalidates git queries when status is out of sync
  • Replaced all references from gitStatus to gitStatusForActions (which is null when out of sync) throughout action logic and UI
  • Updated "Behind upstream" warning to only show when aheadCount === 0 to avoid confusion with diverged state
  • Added "Refreshing git status..." message in dropdown menu when status is out of sync
  • Includes unit test coverage for diverged branch behavior

Critical Issue: The buildMenuItems function doesn't properly disable push/create PR for diverged branches - it only checks isBehind but doesn't account for simultaneous ahead+behind state.

Confidence Score: 3/5

  • This PR improves reliability but has a critical logic gap in menu item handling for diverged branches
  • buildMenuItems function doesn't properly handle diverged branch state - it only checks isBehind for disabling push/PR but will allow these actions when branch is both ahead AND behind, which contradicts the quick action logic that correctly disables actions for diverged branches
  • apps/web/src/components/GitActionsControl.logic.ts - the buildMenuItems function needs diverged branch handling similar to resolveQuickAction

Important Files Changed

Filename Overview
apps/web/src/components/GitActionsControl.logic.ts Added diverged branch detection logic to prevent quick actions when branch has both ahead and behind commits
apps/web/src/components/GitActionsControl.logic.test.ts Added test coverage for diverged branch state returning disabled sync hint
apps/web/src/components/GitActionsControl.tsx Added stale status detection, automatic query refresh, and conditional UI rendering based on synchronized git status

Flowchart

flowchart TD
    A[Git Status Query] --> B{isGitStatusOutOfSync?}
    B -->|Yes| C[Invalidate Git Queries]
    B -->|No| D[Use gitStatus]
    B -->|Yes| E[Set gitStatusForActions = null]
    
    D --> F{resolveQuickAction}
    E --> F
    
    F --> G{gitStatus null?}
    G -->|Yes| H[Show unavailable hint]
    G -->|No| I{isBusy?}
    
    I -->|Yes| J[Show busy hint]
    I -->|No| K{hasBranch?}
    
    K -->|No| L[Show branch hint]
    K -->|Yes| M{hasChanges?}
    
    M -->|Yes| N[Return commit action]
    M -->|No| O{isDiverged?}
    
    O -->|Yes| P[Show sync disabled hint]
    O -->|No| Q{isBehind?}
    
    Q -->|Yes| R[Return pull action]
    Q -->|No| S{isAhead?}
    
    S -->|Yes| T[Return push/PR action]
    S -->|No| U[Show up-to-date hint]
Loading

Last reviewed commit: 92b0dca

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

greptile-apps[bot]
greptile-apps Bot reviewed Feb 15, 2026
View reviewed changes

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread apps/web/src/components/GitActionsControl.tsx
Comment on lines +550 to +554
{gitStatusForActions &&
gitStatusForActions.branch !== null &&
!gitStatusForActions.hasWorkingTreeChanges &&
gitStatusForActions.behindCount > 0 &&
gitStatusForActions.aheadCount === 0 && (

@greptile-apps greptile-apps Bot Feb 15, 2026

Copy link
Copy Markdown

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a clearer message for diverged branches here instead of only showing "Behind upstream" for non-diverged cases. Users might be confused why the warning disappears when they make local commits on an already-behind branch.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@greptile-apps

greptile-apps Bot commented Feb 15, 2026

Copy link
Copy Markdown
Additional Comments (1)

apps/web/src/components/GitActionsControl.logic.ts
canPush logic doesn't account for diverged branches - it only checks isBehind but when aheadCount > 0 and behindCount > 0, push should also be disabled

  const canPush = !isBusy && hasBranch && !hasChanges && gitStatus.behindCount === 0 && gitStatus.aheadCount > 0;
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

coderabbitai[bot]
coderabbitai Bot reviewed Feb 15, 2026
View reviewed changes

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/src/components/GitActionsControl.tsx (1)

188-346: ⚠️ Potential issue | 🟠 Major

Block actions while git status is out-of-sync.
If gitStatusForActions is null (out-of-sync), an already-open dialog can still execute actions, which bypasses the new gating and can skip default-branch confirmation. Add a guard to prevent running actions until the status is synchronized.

🛡️ Suggested guard to enforce out-of-sync gating
     }) => {
+      if (isGitStatusOutOfSync || !gitStatusForActions) {
+        toastManager.add({
+          type: "info",
+          title: "Refreshing git status...",
+          description: "Please retry once the status is synchronized.",
+        });
+        return;
+      }
       const confirmed = await maybeConfirmPushToDefaultBranch(action);
       if (!confirmed) return;
       onConfirmed?.();
@@
     [
       api,
+      isGitStatusOutOfSync,
       gitStatusForActions?.branch,
       gitStatusForActions?.hasWorkingTreeChanges,
       gitStatusForActions?.openPr?.url,

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
juliusmarminge and others added 2 commits February 15, 2026 01:17
@juliusmarminge @codex
Guard git quick actions for diverged and stale branch status
067c5c7
- Disable the quick sync action when local and upstream branches have diverged
- Treat mismatched branch/status data as out-of-sync and refresh before enabling actions
- Update GitActionsControl logic tests for diverged branch behavior

Co-authored-by: codex <[email protected]>
@juliusmarminge @codex
fetch in background
724ecbe
Co-authored-by: codex <[email protected]>
@juliusmarminge
juliusmarminge force-pushed the fix/too-aggresive-pull-action branch from 26c2e84 to 724ecbe Compare February 15, 2026 09:17
macroscopeapp[bot]
macroscopeapp Bot reviewed Feb 15, 2026
View reviewed changes
Comment thread apps/web/src/components/GitActionsControl.tsx
!requiresDefaultBranchConfirmation(action, isDefaultBranch) ||
!gitStatusForActions?.branch
) {
return true;

@macroscopeapp macroscopeapp Bot Feb 15, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Low

components/GitActionsControl.tsx:202 When gitStatusForActions is null (during sync), maybeConfirmPushToDefaultBranch returns true immediately, bypassing the confirmation prompt. Consider returning false when gitStatusForActions?.branch is falsy to block the action until status is available.

Suggested change
return true;
return false;

🚀 Want me to fix this? Reply ex: "fix it for me".

🤖 Prompt for AI
In file apps/web/src/components/GitActionsControl.tsx around line 202:

When `gitStatusForActions` is `null` (during sync), `maybeConfirmPushToDefaultBranch` returns `true` immediately, bypassing the confirmation prompt. Consider returning `false` when `gitStatusForActions?.branch` is falsy to block the action until status is available.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@juliusmarminge
juliusmarminge merged commit 98c4b7c into main Feb 15, 2026
2 checks passed

Uh oh!

There was an error while loading. Please reload this page.

DavidIlie added a commit to DavidIlie/t3code that referenced this pull request Mar 13, 2026
@DavidIlie
upstream: inline branch filtering, fix fork PR upstream tracking
bbe966f
Port upstream commits ac3f22c..268016d:
- Inline branch picker filtering and drop PR-only shortcut (pingdotgg#46)
- Fix PR thread upstream tracking for fork branches (pingdotgg#47)

Removes filterBranchPickerItems shared function in favor of inline filtering,
adds URL-derived fork identity resolution, ensures upstream tracking is
restored on local checkouts and reused worktrees, and simulates real
git checkout in fake GH CLI for integration tests.
piero-dev25 added a commit to piero-dev25/devgame that referenced this pull request Aug 4, 2026
@piero-dev25
docs: freeze the Editor Presence command protocol before anyone imple…
dbd0b8d
…ments it

Design for task pingdotgg#47, written now so the implementing lane gets a contract
rather than a paragraph.

The one decision worth recording: a command frame is FLAT, not nested. The
protocol already documents an inbound-flat / outbound-nested asymmetry, and the
stated reason is that an inbound frame describes one editor's own state while an
outbound frame carries a set of editors each needing a key. A command is
addressed to exactly one editor, so the same rule makes it flat. That asymmetry
has already caused one wrong implementation that failed SILENTLY -- the parser
just dropped the frame while the connection looked healthy -- so getting it
right up front is worth a spec.

Capability advertisement is required rather than optional, because the engines
genuinely differ: frame-step exists only on Unity through supported APIs. The
toolbar must not offer what an engine cannot do, and a hello without
capabilities defaults to play+stop so older plugins keep working.

Two rules that are easy to get backwards, both written down:
- A failed command is an in-band result, NOT a close code. The close-code set is
  a named set (4400/4401 = stop retrying), not a threshold, so closing a socket
  because Play failed would disconnect an engine over a recoverable error.
- Presence is a level; commands are edges. A Play queued while an editor was
  disconnected must not fire on reconnect -- the user's intent is stale by then.

Also records that pingdotgg#46 (authorization) gates this: the route authenticates but
does not authorize, and sits outside the compile-time net that would catch that.
No-scope-check on a read-only feed is a low-stakes bug; on a channel that makes
an editor execute code it is not.
maria-rcks pushed a commit to maria-rcks/t3libre that referenced this pull request Sep 21, 2026
@yordis
chore: sync with upstream pingdotgg/t3code main (pingdotgg#47)
4b5ff06
i2cjak referenced this pull request in BackplaneWorks/Backplane Sep 29, 2026
i2cjak
Merge pull request #47 from i2cjak/backplane/bot-list-unique
95f46df
Each bot listed once, as a law
@Andrey170170 Andrey170170 mentioned this pull request Oct 3, 2026
feat(trellis): profile instructions through the provider's primer Andrey170170/t3code#24
Merged
@joeljanson joeljanson mentioned this pull request Oct 7, 2026
Mistake #16707
Closed
gmackie pushed a commit to gmackie/t3code that referenced this pull request Oct 20, 2026
gmackie
Merge pull request 'fix(server): T3CODE-34 retire early GMACKO lane m…
c1e353a
…igrations and re-run their index slots' (pingdotgg#47) from T3CODE-34-retire-rerun-migrations into custom-local
nofunstudio added a commit to nofunstudio/nofunos-fork-archive that referenced this pull request Oct 20, 2026
@nofunstudio @claude
A4-T3BUNDLE-nos-fix1: one runtime root for pin and compile; context-a…
0d40a71
…ware URL escaping

- emitToolBundle passes the selected root's manifest.json to compileLinked, so import
  validation and runtime-CSS dedupe use the runtime that readRuntimePin pinned.
- stripNetworkUrls escapes http(s):// by context: / only in <script> bodies, \/ in
  <style> bodies, &pingdotgg#47; in HTML text and attributes (was: / everywhere, which
  corrupted <title> text).
- Tests for both (fail on the previous code, pass now).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
yasinuslu added a commit to yasinuslu/t3code that referenced this pull request Oct 21, 2026
@yasinuslu
Merge pull request 'feat(web): keyboard navigation (Ctrl+E manager, C…
db9882a
…trl+S sidebar, Ctrl+H/L panes) and left-hand Grow keys' (pingdotgg#47) from feat/grow-keys-left-hand into yu-v2
@only21mil only21mil mentioned this pull request Oct 23, 2026
fix(clients): offer Commit when the branch is behind upstream #24117
Merged
@jagadhis jagadhis mentioned this pull request Nov 3, 2026
feat(server): continue a delegated child its provider cut off before failing the task jagadhis/t3code#1
Open
bigx333 added a commit to bigx333/t3code that referenced this pull request Nov 24, 2026
@bigx333 @claude
feat(connection): port direct mDNS LAN discovery and SSH link improve…
5563c55
…ments

Port the LAN and SSH connection work from scriptedalchemy/main (pingdotgg#21, pingdotgg#44,
pingdotgg#47, pingdotgg#59, pingdotgg#60, pingdotgg#79, pingdotgg#88, plus later fixes to those files):

- Servers advertise `_t3code._tcp` over mDNS and answer a LAN discovery
  proof; desktop (bonjour-service) and mobile (new t3-lan-discovery Expo
  module) rediscover paired machines whose address changed.
- A device paired over HTTPS or Tailscale mints a DPoP-bound LAN
  credential that cannot outlive or outrank its paired session.
- The server reports its mDNS `.local` name as a LAN endpoint.
- Peer links accept ssh://user@host and run over a managed SSH tunnel
  that leaves the remote server running on disconnect.
- SSH remote setup reuses an exact-release installed CLI behind bounded
  probes, binds the forward to loopback, only reuses a live tunnel, and
  refuses to replace an installed-but-stopped background service.

Adaptations for upstream: PeerLinks exposes one shared `layerWithSsh`,
also used by the orchestration runtime layer; upstream's release-mirror
download path and its download error text are kept; inference-host
address resolution and other fork-only features are left out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Luzivog Luzivog mentioned this pull request Nov 24, 2026
[Bug]: Antigravity native schedule pins turns in running indefinitely, starving queued runs and scheduled automations #41467
Open
2 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@coderabbitai coderabbitai[bot] coderabbitai[bot] left review comments
@greptile-apps greptile-apps[bot] greptile-apps[bot] left review comments
@macroscopeapp macroscopeapp[bot] macroscopeapp[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@juliusmarminge
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.