Delegated worktree creation does not apply the selected local environment setup

Open
#36,028 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust

Research direction

No files or tests are named. Start by locating the normal UI worktree creation path and the delegated/programmatic task-creation entry point, then compare how the selected local environment is passed or loaded. Add a regression test covering explicit and saved environment selection, and verify that the new worktree runs its setup script and permits environment-managed commands.

Written by the indexing model from the issue text.

Description

app bug subagent

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

  1. Open a project with a checked-in local environment definition that has a setup script.
  2. Select that environment for the project.
  3. Create a worktree through a delegated or programmatic task-creation flow.
  4. In the new worktree, check for an expected artifact from the setup script.
  5. 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.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.