-
Notifications
You must be signed in to change notification settings - Fork 85
Description
Problem
When using multiple startup modules in a Coder workspace template (e.g., git-clone and claude-code), there's a race condition where both modules' startup scripts execute in parallel. This causes issues when one module depends on another.
Specific Case: git-clone → claude-code
The claude-code module initializes with a workdir that should be populated by the git-clone module. However:
- All workspace agent startup scripts execute in parallel via Go's errgroup.Group
- The git-clone module's post_clone_script (which creates the workdir) runs sequentially AFTER the clone completes
- The claude-code module's startup scripts run concurrently and may fail if they try to access the workdir before git-clone completes
Root Cause
The Coder agent executes all startup scripts with concurrently. There's no built-in mechanism to enforce sequential execution between different coder_script resources or modules.
Solution
Add a variable to the claude-code module that allows users to run custom shell commands before the Claude Code startup script executes. This enables dependency management:
- claude-code's pre_start_script can wait for markers/conditions from other modules
- Once preconditions are met, the main start script proceeds
- This provides a clean way to handle module dependencies without architectural changes
Use Case
This pattern is already used in other parts of the Coder registry (pre_install_script, post_install_script) and would provide consistency.