Delegated worktree creation does not apply the selected local environment setup
Summary
Creating a worktree through a programmatic or delegated task path can skip the local environment selected for the project. The worktree is created successfully, but its configured setup script never runs.
The normal UI worktree flow lets the user select a local environment. The delegated/programmatic creation interface exposes no corresponding environment-selection parameter, and it also fails to inherit the project's saved selection.
This leaves the new worktree without generated environment files and with its environment manager blocked, even when the same local environment is selected and works through the normal UI worktree flow.
Steps to reproduce
- Open a project with a checked-in local environment definition that has a setup script.
- Select that environment for the project.
- Create a worktree through a delegated or programmatic task-creation flow.
- In the new worktree, check for an expected artifact from the setup script.
- Run a command through the environment manager.
Expected behavior
The delegated/programmatic creation interface should either:
- accept an explicit choice of the project's local environment; or
- inherit the project's saved selected environment when no explicit choice is supplied.
In either case, the new worktree should run the configured setup script automatically.
Actual behavior
The worktree is created without the selected environment attached. Its setup script does not run, expected setup artifacts are missing, and environment-managed commands report that the environment is blocked or unapproved.
Impact
Delegated worktrees require manual repair before normal development commands and verification can run. This is easy to miss and causes tasks to begin in a partially initialized state.
Suggested direction
Add a reviewed environment-selection option to delegated/programmatic worktree creation, and fall back to the project’s saved selection when omitted. This should match the normal UI worktree path.
Privacy note
This report intentionally omits local repository details, paths, logs, and project-specific configuration.
1 Comment
(filed by codex but identified and verified by human me, @asonawalla)