Fix autoscaler warm runners by aligning DB + runner dirs#18
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a multi-instance race condition where the reconciler could delete in-progress runner directories because the database and runner storage were using different default locations. The fix aligns both under a common ACTION_PACKER_HOME directory (~/.action-packer) and includes a one-time migration for existing databases.
Changes:
- Moved default database location from
backend/datato~/.action-packer/datato match runner storage - Implemented one-time migration to copy legacy database to new location
- Updated test setup to use isolated temporary directories for both database and runners
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| backend/src/db/schema.ts | Introduces ACTION_PACKER_HOME constant, updates DB default path to use it, adds legacy database migration logic |
| backend/src/services/runnerManager.ts | Adds ACTION_PACKER_HOME constant, derives RUNNERS_DIR from it instead of hardcoding the path |
| backend/tests/setup.ts | Sets isolated ACTION_PACKER_HOME and DATA_DIR environment variables for test isolation, adds cleanup logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…and migration support
6057665 to
a78268f
Compare
- Add back os import in runnerManager.ts (needed for os.homedir() in cleanupGlobalBuildCaches) - Add getRunnerDownloads mock to test setup (required by runner creation tests)
Fixes a multi-instance race where the reconciler could delete in-progress runner directories because RUNNERS_DIR defaulted to ~/.action-packer while the DB defaulted to repo-local backend/data.
Changes:
Result: pools maintain warm runners reliably even when multiple Action Packer instances exist.