Skip to content

fix(cache): fail the run when a cache hit's outputs can't be restored - #770

Draft
wan9chi wants to merge 1 commit into
mainfrom
fix-cache-hit-restore-failure
Draft

wan9chi wants to merge 1 commit into
mainfrom
fix-cache-hit-restore-failure

Conversation

@wan9chi

@wan9chi wan9chi commented Sep 27, 2026

Copy link
Copy Markdown
Member

Motivation

When a cache hit's output archive can't be restored, for example because it was deleted or is corrupt, vp run prints an error but exits 0, and both the summary and --last-details report the task as a cache hit. CI passes without the task's outputs. The broken entry also stays in the cache, so every later run fails the same way until vp cache clean. Remote hits reach the same state, because they're recorded locally before they're restored.

Changes

  • A failed restore is saved in the summary as a new TaskResult::RestoreFailed. It counts as failed rather than as a hit, sets a non-zero exit code, and --last-details shows it as → Cache hit, but the outputs couldn't be restored (or Remote cache hit) followed by the error and its causes.
  • The error is now Cache restore failed: failed to extract the output archive: … instead of Cache lookup failed: …. It no longer suggests vp cache clean or names the archive path, because the entry and its archive are removed automatically. That drops the program_name parameter that only fed the hint.
  • On a failed restore, the local entry and its archive are removed, so the next run misses. The execution key can still map to the removed entry's key, which is now a plain NotFound miss rather than a key mismatch. After a remote hit, the next run fetches the remote entry again.
  • Tests: output_cache_test deletes the archive of a cached task and checks the failed hit, --last-details, and the next run executing again. This runs on all platforms. remote_cache::restore_failure (ignored and not on Windows, like the other remote backend cases) makes a remote hit's restore fail and checks that the downloaded archive is removed and the next run fetches and restores the entry again. vtt rm --ext <suffix> <dir> removes the archive without hardcoding its name or the cache schema directory.

Closes #767

A cache hit whose output archive can't be extracted now fails the run
with a non-zero exit code and is reported as failed, with its error, in
the run summary and `--last-details`. The entry and its archive are
removed from the local cache, so the next run misses instead of failing
the same way. Remote hits are recorded locally before they're restored,
so this covers them too; the next run fetches the remote entry again.

Closes #767

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@wan9chi
wan9chi force-pushed the fix-cache-hit-restore-failure branch from 8282c74 to 7a0993c Compare September 27, 2026 16:40
@github-actions

Copy link
Copy Markdown

fspy benchmark

linux

dynamic/launch             change  +0.35%  [ -7.22% ..  +9.02%]  overhead  +271.19%
dynamic/access             change  +0.00%  [ -1.67% ..  +1.54%]  overhead   +11.37%
dynamic/access-relative    change  -0.23%  [ -1.64% ..  +1.01%]  overhead   +58.95%
dynamic/access-contended   change  +0.27%  [ -2.00% ..  +2.64%]  overhead   +14.17%
static/launch              change  +0.83%  [ -4.19% ..  +6.90%]  overhead  +743.85%
static/access              change  +0.09%  [ -1.55% ..  +1.26%]  overhead  +809.88%
static/access-relative     change  -0.01%  [ -0.86% ..  +0.79%]  overhead +1378.52%
static/access-contended    change  +0.48%  [ -0.57% ..  +1.76%]  overhead +3182.70%

macos

dynamic/launch             change  +0.57%  [ -2.88% ..  +2.82%]  overhead  +218.80%
dynamic/access             change  +0.00%  [ -3.09% ..  +3.39%]  overhead    +7.06%
dynamic/access-relative    change  -0.31%  [ -2.99% ..  +2.10%]  overhead  +290.40%
dynamic/access-contended   change  -0.29%  [ -3.45% ..  +4.56%]  overhead    +2.66%

windows

dynamic/launch             change  +0.37%  [ -8.45% ..  +5.76%]  overhead   +25.62%
dynamic/access             change  +0.18%  [ -1.97% ..  +2.04%]  overhead    +1.68%
dynamic/access-relative    change  +0.35%  [ -1.25% ..  +1.45%]  overhead    +1.60%
dynamic/access-contended   change  -0.70%  [ -5.60% ..  +2.98%]  overhead    +1.61%

This branch has not been deployed

No deployments
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.

A cache hit whose outputs can't be restored exits 0 and is reported as a hit

1 participant