Skip to content

[Bug]: graceful shutdown during checkpoint restore leaves files staged #36686

Closed

Description

@StiensWout

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Capture a checkpoint with edits to a tracked file, then edit that file again.
  2. Restore the checkpoint files through a rollback.
  3. Gracefully shut down the worker after Git restore stages checkpoint contents but before clean/reset finishes.
  4. Inspect git diff --cached after shutdown.

The fix PR contains a deterministic real-Git test: gate clean, interrupt the scope-owned restore fiber, then inspect HEAD, index and file bytes. Run pnpm exec vp test run apps/server/src/vcs/GitVcsDriver.test.ts -t 'checkpoint restore'.

Expected behavior

Temporary checkpoint staging is cleared on interruption, as on successful restore. Pre-mutation cancellation preserves user staging.

Actual behavior

Checkpoint contents stay staged. HEAD and restored file bytes remain correct. Ordinary Stop does not cancel rollback. No file loss, unwanted commit or SIGKILL recovery is claimed.

Impact

Minor bug or occasional failure

Version or commit

Reproduced on main @ 0a8aaa3. Independently confirmed by Claude Opus 5.5 on main @ 5ba3a84.

Environment

Linux, server checkpoint restore, real Git, provider independent.

Logs or stack traces

Cancelled restore: index tree b1fa7380 instead of HEAD tree 5af1a687. Normal restore control passes. HEAD unchanged; checkpoint bytes correct.

Screenshots, recordings, or supporting files

Found by the maintainer bughunt and independently verified. A worker-daemon transcript with real Git also reproduces staging after daemon interruption. Its executor/outbox are stand-ins; restart manually reclaims the same job rather than exercising startup recovery. No actual server SIGTERM was used.

Workaround

A subsequent successful restore clears staging, as demonstrated by the restart control. Related #21809 defers cancellation recovery; closed #16863 excludes interruption recovery.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    vouch:trustedAuthor is trusted by repo permissions or the VOUCHED list.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions