[PR #199] Recover snapshot cache after canceled restores #247

Open
opened 2026-10-29 14:21:26 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/199
Author: @nikhilsimha
Created: 8/20/2026
Status: 🔄 Open

Base: main ← Head: nikhil/recover-canceled-artifact-cache


📝 Commits (1)

  • e588f7e Recover snapshot cache after canceled restores

📊 Changes

1 file changed (+71 additions, -11 deletions)

View changed files

📝 src/snapshot/artifact_cache.rs (+71 -11)

📄 Description

What changed

When the task leading a snapshot artifact materialization is canceled, the next waiter now removes that abandoned in-flight entry and retries. The cleanup compares the watch channel before removal so a concurrent waiter cannot remove a newer fetch.

A regression test cancels the materialization leader, then verifies a second caller materializes and reads the artifact.

Why

A client disconnect can cancel the leader after the cache records the fetch but before it publishes a result. The sender is dropped, while the receiver remains in the in-flight map. Every later restore of that snapshot then fails with ended without a result until the AgentENV server restarts.

This change makes canceled restores self-healing and prevents a transient disconnect from permanently blocking sandbox recovery on that node.

Validation

  • cargo test snapshot::artifact_cache::tests — 7 passed
  • cargo clippy --locked --all-targets -- -D warnings — passed
  • cargo test --locked — 741 passed, 4 ignored; 5 unrelated ublk tests could not connect to the local ublk daemon (channel closed)

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/199 **Author:** [@nikhilsimha](https://github.com/nikhilsimha) **Created:** 8/20/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `nikhil/recover-canceled-artifact-cache` --- ### 📝 Commits (1) - [`e588f7e`](https://github.com/kvcache-ai/AgentENV/commit/e588f7e3d904a8894b50e70a1c7dae0bf5ac118b) Recover snapshot cache after canceled restores ### 📊 Changes **1 file changed** (+71 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `src/snapshot/artifact_cache.rs` (+71 -11) </details> ### 📄 Description ## What changed When the task leading a snapshot artifact materialization is canceled, the next waiter now removes that abandoned in-flight entry and retries. The cleanup compares the watch channel before removal so a concurrent waiter cannot remove a newer fetch. A regression test cancels the materialization leader, then verifies a second caller materializes and reads the artifact. ## Why A client disconnect can cancel the leader after the cache records the fetch but before it publishes a result. The sender is dropped, while the receiver remains in the in-flight map. Every later restore of that snapshot then fails with `ended without a result` until the AgentENV server restarts. This change makes canceled restores self-healing and prevents a transient disconnect from permanently blocking sandbox recovery on that node. ## Validation - `cargo test snapshot::artifact_cache::tests` — 7 passed - `cargo clippy --locked --all-targets -- -D warnings` — passed - `cargo test --locked` — 741 passed, 4 ignored; 5 unrelated ublk tests could not connect to the local ublk daemon (`channel closed`) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#247
No description provided.