[MINOR][INFRA] Instruct agents to use --no-track when creating worktrees or branches - #58207
[MINOR][INFRA] Instruct agents to use --no-track when creating worktrees or branches#58207nchammas wants to merge 6 commits into
--no-track when creating worktrees or branches#58207Conversation
|
I think the existing behavior is correct, cutting from |
|
I use VS Code with Copilot and a mix of models. When I made this mistake, I was using Grok 4.5. This is what Grok 4.5 does when I ask it to create a new worktree so I can develop some doc fixes (formatted for clarity): git fetch upstream master
git worktree add -b docs-spelling-grammar ../spark.worktrees/docs-spelling-grammar upstream/master
git -C ../spark.worktrees/docs-spelling-grammar status -sb
git -C ../spark.worktrees/docs-spelling-grammar log -1 --oneline
git worktree listIf I then $ git status -sb
## docs-spelling-grammar...upstream/masterI believe this is the problem. Normally, if you However, I sometimes use VS Code's command palette to push. And this unfortunately has different behavior.
And this is exactly how I ended up pushing 3731453 directly to I believe this is a footgun that will eventually bite someone else, especially if they use VS Code and |
|
I think instead of having freeform instructions on how to create a worktree, we should perhaps have a small shell script to do it and instruct agents to use the script. It's too easy for something to be misconfigured otherwise. If we like that idea, I can work on it. If not, I think we should try at least tweaking the wording of the AGENT instructions. In any case, for the time being I will not let agents create worktrees anymore. I've used them before without issue; the first time I let an agent do it for me it created this situation! |
|
@pan3793 - I've refactored the pre-flight checks section. What do you think? Does my post mortem make sense? |
|
@nchammas, I understand what happened, but I would only touch this I usually perform
|
|
OK, I've cut things back to just add the I'm honestly not happy with the current set of agent instructions and think we need a major refactor. There are too many things in there that a) touch personal workflows or b) belong in the user docs. But I will raise this separately. |
--no-track when creating worktrees or branches
What changes were proposed in this pull request?
Specify that when creating a new worktree or branch, agents should use
--no-trackso they don't accidentally targetupstream/master.Why are the changes needed?
I just pushed 3731453 directly to
masterfrom a new worktree. It was a mistake and I was surprised by it. The worktree was configured to push directly toupstream/master. I believe this happened because I let an agent (for the first time) create the worktree for me and it followed the instructions in our AGENTS file:More background here: #58136 (comment)
To be clear, I made the commit and push myself, not the agent. What the agent did is create the worktree.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
TODO:
Was this patch authored or co-authored using generative AI tooling?
No.