feat(compose): AdoptExisting — reattach existing containers on resume - #120
Conversation
…unconditionally On resume, a restored workspace's containers must be reattached exactly as left. The primary service's feature-layered image is rebuilt every boot with a fresh digest, so the config-hash always drifts and ensureService recreates it — abandoning the container's writable upperdir and binding a new empty anonymous volume (the postgres data, the in-container $HOME). New UpOptions.AdoptExisting (threaded to compose.Plan) makes ensureService reuse any existing (project,service) container unconditionally: start if stopped, attach if running, never recreate. Gated to non-recreate Ups. Default path (hash-based reuse/recreate) unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour. 📝 WalkthroughWalkthroughThe compose flow adds ChangesExisting Container Adoption
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change adds opt-in reuse of existing containers during resume, preserving their state instead of recreating them. No actionable merge-blocking risk remains based on the supplied evidence. Sequence Diagram(s)sequenceDiagram
participant UpOptions
participant ComposePlan
participant ensureService
participant Container
UpOptions->>ComposePlan: Pass AdoptExisting when Recreate is false
ComposePlan->>ensureService: Provide adoption setting
ensureService->>Container: Reuse existing container
alt Container is stopped
ensureService->>Container: Start container
else Container is running
ensureService->>Container: Reattach to container
end
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Adds
UpOptions.AdoptExisting: onUp, reuse any existing (project, service) container unconditionally — start it if stopped, attach if running, and never recreate on config-hash drift.Why: recreation abandons the containers' writable upperdirs and binds fresh anonymous volumes, which is where a workspace's real state lives (postgres/rabbitmq/minio data). The primary's feature-layered image gets a fresh digest every boot, so hash-based reuse can never match on resume; adoption ignores the hash when the caller says the on-disk state is authoritative.
Consumer:
crunchloop/dapfeat/runtime-state-topology(crunchloop/dap#4865) sets it on session resume. Validated end to end there (2026-08-24, three-leg round trip on kata + NVMe): the same primary container id survived cold boot → cross-node block-level restore → in-place pod restart, with$HOMEupperdir state and anonymous-volume postgres rows intact across all three.dap currently pins this branch's pseudo-version; merging this and tagging v0.4.3 unblocks that PR.
🤖 Generated with Claude Code
Summary by CodeRabbit