fix(provisioner): stop rogue config-missing restart loop (#17) - #48
Merged
Conversation
Resolves #17. Part A: scripts/cleanup-rogue-workspaces.sh deletes workspaces whose id or name starts with known test placeholder prefixes (aaaaaaaa-, etc.) and force-removes the paired Docker container. Documented in tests/README.md. Part B: add a pre-flight check in provisionWorkspace() — when neither a template path nor in-memory configFiles supplies config.yaml, probe the existing named volume via a throwaway alpine container. If the volume lacks config.yaml, mark the workspace status='failed' with a clear last_sample_error instead of handing it to Docker's unless-stopped restart policy (which otherwise loops forever on FileNotFoundError). New pure helper provisioner.ValidateConfigSource + unit tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
Author
|
7-gate verification passed; merged. Resolves #17 — rogue config-missing restart loop is now caught by the pre-flight ValidateConfigSource + VolumeHasFile probe, and any such workspace is flipped to status='failed' with a WORKSPACE_PROVISION_FAILED broadcast instead of being handed to Docker's unless-stopped loop. All 6 new TestValidateConfigSource_* tests pass under -race. |
4 tasks
molecule-ai Bot
pushed a commit
that referenced
this pull request
Apr 21, 2026
fix(provisioner): stop rogue config-missing restart loop (#17)
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.
Resolves #17.
Part A — E2E cleanup
scripts/cleanup-rogue-workspaces.sh: deletes workspaces whose id or name starts with known test placeholder prefixes (aaaaaaaa-,bbbbbbbb-,cccccccc-,test-ws-) via the API and force-removes thews-<id[:12]>container as a belt-and-suspenders fallback.tests/README.md.aaaaaaaa-pattern (grep found zero hits intests/**), so the rogue was from a manual/adhoc run. Nothing to patch in the test scripts.localhost:8080— no rogue workspace currently present on the platform (already cleaned up between issue filing and PR).Part B — provisioner pre-flight
provisioner.ValidateConfigSource(templatePath, configFiles)— returnsErrNoConfigSourcewhen neither source suppliesconfig.yaml.Provisioner.VolumeHasFile(ctx, id, relPath)— probes the workspace's Docker named volume via a throwawayalpine test -fcontainer.provisionWorkspacenow calls both: when a restart path passes emptytemplatePath+configFiles(auto-restart flow inworkspace_restart.go:215,335) AND the named volume has noconfig.yaml, the handler marks the workspacestatus='failed'with a clearlast_sample_errorand broadcastsWORKSPACE_PROVISION_FAILEDinstead of handing the doomed container to Docker'sunless-stoppedrestart policy.Test plan
go build ./... && go vet ./...cleango test -race ./...all packages pass (provisioner + handlers)TestValidateConfigSource_*x6 (configFiles present / empty bytes / template has config / template missing / both empty / config.yaml-as-dir)tests/e2e/test_api.sh62/62 pass🤖 Generated with Claude Code