Skip to content

docs: update BRANCH LOCK hint to include HEAD -- path form [doc-updater] - #2258

Merged
jwbron merged 1 commit into
mainfrom
egg/doc-update-checkout-head-restore
Apr 29, 2026
Merged

docs: update BRANCH LOCK hint to include HEAD -- path form [doc-updater]#2258
jwbron merged 1 commit into
mainfrom
egg/doc-update-checkout-head-restore

Conversation

@james-in-a-box

Copy link
Copy Markdown
Contributor

docs: Update BRANCH LOCK agent hint for git checkout HEAD -- <file>

Update sandbox/agent-config/rules/mission.md to reflect the fix from
#2252, which corrected the gateway's is_branch_switch heuristic to
allow git checkout [<tree-ish>] -- <path> (any form with --) as a
file restore rather than a branch switch.

The old hint only mentioned git checkout -- <file>, implying that
git checkout HEAD -- <file> and similar commit-ish forms were not
supported in pipeline sessions. They are now correctly allowed. The
updated hint shows all three forms so agents discover the most useful
one (HEAD or a SHA) rather than only the bare form.

Triggered by: 2fa7dc6 (Fix #2247: allow git checkout HEAD -- <path> in pipeline sessions (#2252))

Test Plan

  • Automated: no test changes required (gateway tests in the triggering commit cover the behavior)
  • Manual: review that the updated hint text is accurate per the gateway fix

Authored-by: egg

The gateway's is_branch_switch heuristic now correctly allows
git checkout [<tree-ish>] -- <path> (any form with --) as file
restores rather than branch switches (#2247/#2252). Update the
BRANCH LOCK guidance to surface the HEAD -- and commit-ish -- forms
alongside the bare -- form.

@egg-reviewer egg-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No agent-mode design concerns. This is a one-line documentation update that improves the accuracy of an existing agent hint, helping the agent discover useful command forms (HEAD -- <path>, <sha> -- <path>) that the gateway already permits. That's orientation, not constraint.

— Authored by egg

@egg-reviewer egg-reviewer Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve.

Verified the change is accurate against the gateway implementation:

  • gateway/git_client.py:1816-1872 (is_branch_switch) explicitly returns False whenever -- is present, regardless of any tree-ish before it. The docstring lists the same three examples the updated hint mentions: git checkout -- file.txt, git checkout HEAD -- file, git checkout main -- file.
  • PR #2252 (the cited triggering fix) is merged on main, so the behavior is in production.
  • The new hint enumerates HEAD --, HEAD~1 --, and bare --, which is the most useful subset for agents recovering from a wrong-branch commit (the surrounding "Wrong branch fix" line) and for restoring tracked files mid-pipeline.

No issues — wording is accurate, scope is minimal, and the change is self-contained to sandbox/agent-config/rules/mission.md.

— Authored by egg

@james-in-a-box

This comment has been minimized.

@james-in-a-box

Copy link
Copy Markdown
Contributor Author

egg review completed. View run logs

1 previous review(s) hidden.

@jwbron
jwbron merged commit e8756a4 into main Apr 29, 2026
29 checks passed
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.

Gateway is_branch_switch false-positive blocks 'git checkout HEAD -- <path>' in pipeline sessions

1 participant