Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(projects): automatically pull clean default branches #9277

Mergedmaria-rcksmerged 4 commits intomain fromrefs/pull/9277/headmerged by maria-rcks View on GitHub

maria-rckscommented

Note

Written by gpt-5.6-sol on behalf of Maria

Adds an opt-in Automatically pull setting to each project so clean default-branch checkouts stay current without manual pull prompts. When enabled, T3 Code checks at server startup and during existing background remote-status refreshes, then performs only a fast-forward pull when the checkout has no local changes or commits. Verified with server, web, and contracts typechecks, targeted lint, diff checks, a fresh-database server boot, and direct runtime checks for startup and background safety gates. Built with gpt-5.6-sol in T3 Code through the Codex harness.


Note

Medium Risk Opt-in background and startup git pull can change checkout state and hit the network, but only when gates pass and failures are non-blocking for startup and status refresh.

Overview Adds an opt-in Automatically pull project setting so enabled checkouts can stay current without manual pulls.

Project model and persistence: New optional autoPull on orchestration project types and project.meta.update; new projects default to false. Migration 0045 adds auto_pull on projection_projects, wired through the decider, in-memory projector, SQL projection pipeline, and snapshot queries.

When pulls run: On server startup (projects.auto-pull after provider-session reconciliation), autoPullProjects loads the shell snapshot and fast-forwards only workspaces where autoPull is true, the repo is on the default branch with upstream, the tree is clean, there are no local commits, and the branch is behind (concurrency 4; failures are warnings). During VCS status refresh, VcsAutoPullPolicy resolves eligibility from the active project by workspace root; maybeAutoPull applies the same gates and refreshes cached status after a successful pull (pull errors do not fail the refresh).

UI and docs: A switch in project settings fans out to all group members; user docs describe behavior and skip conditions. Tests cover meta-update propagation, startup gating, and broadcaster auto-pull.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 9ba089e187eee9599738a92162ceed26e779c83f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add autoPull project setting that pulls clean default branches on startup and status refresh

  • Adds an optional autoPull boolean to project commands, events, projection rows, and the SQLite-backed projection repository; migration 045 adds a non-null projection_projects.auto_pull INTEGER column defaulting to 0
  • Server startup runs a projects.auto-pull phase that loads project shells and concurrently pulls enabled repositories that are on the default branch, have an upstream, a clean working tree, no local commits ahead, and a positive behind count; failures are logged as warnings and do not abort startup
  • VcsStatusBroadcaster evaluates an auto-pull policy on full and remote-only status refreshes, pulling qualifying clean default-branch checkouts and publishing the refreshed status
  • The project settings UI renders an "Automatically pull" switch that writes the boolean to all member project records
  • Risk: ProjectionProjectDbRowSchema now requires the auto_pull column during decoding; any out-of-tree snapshot readers that do not expect the optional autoPull field on OrchestrationProject or OrchestrationProjectShell must handle its absence
Macroscope summarized 9ba089e.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      🟡 Medium

      https://github.com/pingdotgg/t3code/blob/0c42b1db2127be6c08a238d50384c7510fa7af4b/apps/web/src/components/settings/ProjectSettingsPanel.tsx#L462

      For grouped projects, setAutoPull can leave autoPull enabled on earlier checkouts while later checkouts retain their previous value when updateAllMembers fails mid-fan-out. This makes the setting inconsistent despite being presented as applying to every checkout; use an atomic update or roll back earlier writes on failure.

      🤖 Copy this AI Prompt to have your agent fix this:
      In file @apps/web/src/components/settings/ProjectSettingsPanel.tsx around line 462:
      
      For grouped projects, `setAutoPull` can leave `autoPull` enabled on earlier checkouts while later checkouts retain their previous value when `updateAllMembers` fails mid-fan-out. This makes the setting inconsistent despite being presented as applying to every checkout; use an atomic update or roll back earlier writes on failure.
    3. Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

      Fix All in Cursor ❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the [Cursor dashboard](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f5895cf42fe7b02fead24d0b3ded2e9550f38ce7. Configure [here](https://www.cursor.com/dashboard/bugbot).
    4. Note

      Written by gpt-5.6-sol on behalf of Maria

      This uses the existing updateAllMembers path shared by grouped title, model, environment-mode, favicon, and scripts settings. Those project metadata commands are intentionally independent and dispatched concurrently; adding cross-project transactions or rollback only for this setting would widen this PR and still could not guarantee rollback after a connection failure, so I am keeping the established grouped-setting behavior.

    5. Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — This PR adds a cross-cutting automatic Git-pull capability that performs network I/O and can mutate user checkouts during startup and background status refreshes. It also introduces a new product setting and default, so the change requires human review.

      Notes:

      • No code objects were reviewed. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. maria-rcks merged thisba3cb07

    7. maria-rcks closed this

Sign in to join this conversation.