Skip to content

[codex] Copy user Bazel settings into Codex worktrees#25925

Merged
anp-oai merged 3 commits into
mainfrom
codex/copy-user-bazelrc-to-worktrees
Jun 3, 2026
Merged

[codex] Copy user Bazel settings into Codex worktrees#25925
anp-oai merged 3 commits into
mainfrom
codex/copy-user-bazelrc-to-worktrees

Conversation

@anp-oai

@anp-oai anp-oai commented Jun 2, 2026

Copy link
Copy Markdown
Collaborator

Why

Codex-created linked worktrees do not include ignored files from the main worktree. Bazel users who keep local overrides in user.bazelrc therefore lose those settings in every new worktree.

The setup must also work on Windows and must not overwrite a file that already exists in the worktree.

What changed

The checked-in Codex environment now invokes .codex/environments/setup.py. The script resolves the main worktree and current worktree, then uses copy_from_main_worktree_to_worktree(repo_relative_path) to copy ignored files into new worktrees without overwriting existing destinations.

main() currently copies user.bazelrc. Additional repository-relative paths can be added as further calls to the same helper.

Validation

  • Ran the setup script in a linked worktree and confirmed it handles a missing main-worktree user.bazelrc.
  • Verified the helper copies a main-worktree file, preserves an existing worktree file, and creates parent directories for a nested path.

@anp-oai anp-oai marked this pull request as ready for review June 2, 2026 23:38
@anp-oai anp-oai force-pushed the codex/copy-user-bazelrc-to-worktrees branch from 9abebe0 to 0bb909b Compare June 3, 2026 04:17
@anp-oai anp-oai marked this pull request as draft June 3, 2026 04:17
@anp-oai anp-oai force-pushed the codex/copy-user-bazelrc-to-worktrees branch from 0bb909b to bee40eb Compare June 3, 2026 16:03
@anp-oai anp-oai marked this pull request as ready for review June 3, 2026 16:09

@bolinfest bolinfest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user runs this in some other context, should it not copy if the target already exists so it doesn't overwrite it?

@anp-oai anp-oai force-pushed the codex/copy-user-bazelrc-to-worktrees branch from bee40eb to 48b202e Compare June 3, 2026 18:15
@anp-oai

anp-oai commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

If the user runs this in some other context, should it not copy if the target already exists so it doesn't overwrite it?

Yes, made that change. Also converted the script to Python re: slack thread.

@anp-oai anp-oai enabled auto-merge (squash) June 3, 2026 18:25
@anp-oai anp-oai merged commit 2d5c264 into main Jun 3, 2026
31 checks passed
@anp-oai anp-oai deleted the codex/copy-user-bazelrc-to-worktrees branch June 3, 2026 18:29
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants