Skip to content

Keep local/base checkouts stable by forbidding in-place agent branch switches#85

Merged
NagyVikt merged 1 commit intomainfrom
agent/codex/pia-edix-hu-dup-2-enforce-never-switch-local-branch
Apr 13, 2026
Merged

Keep local/base checkouts stable by forbidding in-place agent branch switches#85
NagyVikt merged 1 commit intomainfrom
agent/codex/pia-edix-hu-dup-2-enforce-never-switch-local-branch

Conversation

@NagyVikt
Copy link
Copy Markdown
Collaborator

Automated by scripts/agent-branch-finish.sh (PR flow).

…switches

Some repositories still carry legacy branch-starter behavior that can switch the visible checkout to an agent branch. This change enforces worktree-only agent branch creation, updates AGENTS policy text, and hardens template codex-agent startup to detect unsafe starter output, restore the original branch, and create a safe fallback sandbox worktree automatically.

Constraint: Must preserve branch/worktree-first workflow without breaking existing codex-agent entrypoints

Rejected: Keep optional --in-place mode behind --allow-in-place | still allows accidental visible-checkout branch switches

Confidence: high

Scope-risk: moderate

Reversibility: clean

Directive: Do not reintroduce in-place starter paths; active local/base checkout must remain unchanged during agent startup

Tested: bash -n scripts/agent-branch-start.sh scripts/codex-agent.sh templates/scripts/agent-branch-start.sh templates/scripts/codex-agent.sh; node --test test/install.test.js; npm test
@NagyVikt NagyVikt merged commit f9c5141 into main Apr 13, 2026
7 checks passed
@NagyVikt NagyVikt deleted the agent/codex/pia-edix-hu-dup-2-enforce-never-switch-local-branch branch April 13, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant