Skip to content
Source
Sign inSign up
pingdotgg/t3code

Back off checkpoint capture after repeated failures #4517

Closedyashranaway(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/4517/headopened View on GitHub

What Changed

CheckpointStore.captureCheckpoint tracks consecutive failures per workspace. After three, capture is skipped for a growing cooldown (5 minutes, doubling, capped at an hour) instead of being retried on every turn. Any success clears the record.

Why

Checkpoint capture runs a full-tree git add -A under a temporary index after every completed turn. On a repository large enough that this cannot finish inside the 30s VCS process timeout, the process is killed every single time, so the retry buys nothing and costs a great deal: one CPU core pegged for as long as any thread is in use, plus an orphaned tmp_pack_* in .git/objects/pack for every kill that lands mid-pack-write.

A skipped capture replays the failure recorded when the cooldown opened, so callers see the same error and the same missing turn-diff status they see today, and the error channel is unchanged. Three failures of tolerance keeps a transient failure (an index lock held by a concurrent git command) from disabling capture, and the hour cap means a workspace that becomes healthy is picked up again on its own.

This is the "skip-with-backoff after N consecutive capture failures" option from the issue. The other suggestions there (a disable setting, an adaptive timeout, tmp_pack_* cleanup) are deliberately left out to keep this focused.

Fixes #3646

Testing

  • vp test run apps/server/src/checkpointing/ passes (23/23). New coverage: the backoff policy itself (threshold, doubling, cap, per-workspace isolation, reset on success) and an end-to-end test driving CheckpointStore against a driver that always times out, asserting the driver is invoked exactly 3 times across 10 turns and exactly once more after the cooldown lapses
  • vp test run apps/server/src/orchestration/ passes, 214 tests total across both directories
  • pnpm typecheck in apps/server clean
  • vp lint on changed files clean

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Medium Risk Changes when checkpoints are captured for unhealthy workspaces (skipped turns still error the same way) but reduces runaway CPU/git load; logic is well-tested and scoped to capture only.

Overview Adds per-workspace capture backoff so repeatedly failing checkpoint captures stop spawning expensive git add work on every turn.

New CaptureBackoff tracks consecutive failures per cwd (tolerates 2, then exponential cooldown from 5 minutes up to 1 hour, LRU cap of 256 workspaces, 60s single-flight reservation after cooldown). CheckpointStore.captureCheckpoint consults beginAttempt first; during cooldown it fails immediately with the same stored error instead of calling the VCS driver. Success clears state; failures (including driver resolve errors) update backoff and log warnings.

Unit tests cover the policy; integration tests assert only three real capture attempts across many turns when capture always times out, plus recovery and registry-failure behavior.

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

Note

Back off checkpoint capture in CheckpointStore after repeated failures

  • Introduces CaptureBackoff, a per-workspace LRU-bounded tracker that computes exponential cooldown durations once a failure threshold is crossed, capping at an absolute maximum.
  • Integrates backoff into CheckpointStore.captureCheckpoint: during cooldown, the method short-circuits and replays the last error without invoking the VCS driver; a single caller is reserved for the first post-cooldown retry.
  • On success, backoff state is cleared; on failure, the consecutive failure count increments, cooldown extends, and a warning log emits the backoff details.
  • Risk: captureCheckpoint callers in cooldown now receive a replayed error immediately rather than triggering a new capture attempt, which is a behavioral change for any caller that retries on every error.
Macroscope summarized 5a76e35.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 15b00203-5b08-41fe-9987-cfe2de42dcb7

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

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

      Approvability

      Verdict: Needs human review

      This PR introduces a new backoff mechanism that gates when checkpoint capture operations run, deciding to skip captures after repeated failures. Changes that control whether significant work executes warrant human review, regardless of how clean the implementation appears.

      You can customize Macroscope's approvability policy. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. 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 b2c9ddbfa0716510dde26ca7d0d4c487601a9777. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. t3dotgg(GitHub profile, opens in a new tab) added labelsvouch:trusted

    6. t3dotgg(GitHub profile, opens in a new tab) removed labelsvouch:unvouched

    7. closing this version as part of a pr cleanup at the request of @StiensWout.

      this version suppresses checkpoint capture for a growing cooldown of up to an hour and has no explicit retry/reset path when the underlying problem is repaired. avoiding repeated expensive failures is worthwhile, but recovery needs to be more immediate and controllable before adopting this behavior.

      thanks for the contribution. if you disagree with this decision, you are welcome to open a new pr, link back to this one, and explain how your proposal addresses these concerns or why a different approach is warranted.

Sign in to join this conversation.