Repository navigation
fix(kiloclaw): adopt an existing volume when the DO loses flyVolumeId - #6271
Merged
Merged
Conversation
An unexpected-stop recovery can leave the Instance DO without a usable volume reference. Start then created a brand-new empty volume and mounted it over data that still existed on Fly (Pylon 28311, a recurrence of 28216). ensureVolume now lists the app's volumes, keeps the ones that match the instance's volume name, skips volumes Fly is reaping, and adopts the newest usable one. Recovery forks and stranded-volume replacements keep the same name and are created last, so the newest volume holds the latest data. If the lookup fails on an instance that has started before, start fails closed instead of creating an empty volume. Fresh instances that never started keep the previous create behavior.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (4 files)
Previous Review Summary (commit 94ef580)Current summary above is authoritative. Previous snapshots are kept for context only. Previous review (commit 94ef580)Status: 2 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Files Reviewed (2 files)
Reviewed by deepseek-v4.1-flash · Input: 0 · Output: 0 · Cached: 0 Review guidance: REVIEW.md from base branch |
Address review remarks on volume adoption: - Skip matching volumes that another machine still holds. A Fly volume attaches to one machine, so adopting an attached volume made the follow-up createNewMachine fail with an opaque 400. Adopt only unattached volumes or ones the DO's known machine already holds, and warn when the only candidates are held elsewhere. - Return whether ensureVolume adopted a volume, and set replace_lost_volume.data_loss from it. A repaired pointer that adopted a surviving fork no longer reports data loss.
iscekic
enabled auto-merge (squash)
September 17, 2026 11:47
eshurakov
approved these changes
Sep 17, 2026
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
An unexpected-stop recovery can leave the Instance DO with no usable volume reference.
Startthen created a brand-new empty volume and mounted it over data that still existed on Fly. This is Pylon 28311, and a recurrence of 28216.ensureVolume(services/kiloclaw/src/durable-objects/kiloclaw-instance/fly-machines.ts:131) now adopts an existing volume before creating one:volumeNameFromSandboxId), skipspending_destroy/destroying/destroyed, and adopts the newest usable volume.adopt_volumewith the adopted id, state andcreated_at, and warns when several usable volumes match.Verification
Automated checks in
services/kiloclaw:pnpm test(108 files, 2348 tests),pnpm typecheck(tsgo), andpnpm lint(oxlint) all pass.services/kiloclaw/src/durable-objects/kiloclaw-instance.test.tscover adoption of the newest usable volume, skipping non-adoptable states, the start path after a lostflyVolumeId, and fail-closed on a failed lookup.Visual Changes
N/A
Reviewer Notes
tryDeleteOrphanVolumes), so a name match is unambiguous for ownership; multiple matches only come from retained recovery artifacts. The newest usable volume is the recovery fork that holds the latest data.lastStartedAt !== null. A never-started instance has no data to protect, so a transientlistVolumesfailure keeps the old create path.