fix: persist workspace repos across container restarts#123
Merged
khaliqgant merged 4 commits intomainfrom Jan 9, 2026
Merged
Conversation
Problem: When checkActiveAgents() couldn't reach a workspace (network error, timeout), it returned hasActiveAgents: false, causing gracefulUpdateImage() to proceed with restarts even when agents might actually be running. Changes: - Add `verified: boolean` field to checkActiveAgents() return type - Return verified: false on HTTP errors and catch block (network failures) - Add SKIPPED_VERIFICATION_FAILED to UpdateResult enum - Update gracefulUpdateImage() to skip update when verified=false (unless force) - Add diagnostic logging to capture raw agent status values for debugging - Update summary to include skippedVerificationFailed count This prevents unsafe restarts of workspaces where we cannot verify agent status. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root Cause: - Persistent volume is mounted at /data - Default WORKSPACE_DIR is /workspace (ephemeral container filesystem) - Repos cloned to /workspace are lost on every container restart - This causes branch reset to main and loss of local changes Fix: - Set WORKSPACE_DIR=/data/repos in all provisioners (Fly, Railway, Docker) - Repos are now stored on the persistent volume - entrypoint.sh will use git pull (preserving branch) instead of fresh clone Behavior Change: - Before: Container restart → fresh clone → main branch - After: Container restart → repo exists → git pull → branch preserved 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Tests were failing because mocking the async provisioning flow was unreliable. New approach: read the source file directly and verify WORKSPACE_DIR is set correctly in all three provisioners (Fly, Railway, Docker). This is more reliable and clearly documents the expected configuration. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pass CLOUD_API_URL, WORKSPACE_TOKEN, and WORKSPACE_ID environment variables to spawned agent processes via PtyWrapperConfig.env. This enables agents to use git credential helpers without needing token-in-URL workarounds. Applied to both spawn() and restartAgent() methods. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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
/workspace(ephemeral) instead of/data(persistent volume)WORKSPACE_DIR=/data/reposin all provisionersRoot Cause Analysis
Volume Mount Configuration:
/data/workspace(container ephemeral filesystem)Code References:
deploy/workspace/entrypoint.sh:117- UsesWORKSPACE_DIRfor repo locationsrc/cloud/provisioner/index.ts:781-785- Volume mounted at/dataChanges
Updated all three provisioners to set
WORKSPACE_DIR=/data/repos:Behavior Change
/workspaceempty/data/repospersistedTest Plan
workspace-persistence.test.ts/data/repos🤖 Generated with Claude Code