You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "nchammas (via GitHub)" <gi...@apache.org> on 2026/08/21 15:53:04 UTC

[PR] When agents create worktrees, point to origin, not upstream! [spark]

nchammas opened a new pull request, #58207:
URL: https://github.com/apache/spark/pull/58207

   ### What changes were proposed in this pull request?
   
   Specify to agents that new worktrees should be based on `origin`, not `upstream`.
   
   ### Why are the changes needed?
   
   I just pushed https://github.com/apache/spark/commit/3731453175d31125a8765f61d5df2e5936ffb28d directly to `master` from a new worktree. It was a mistake and I was surprised by it. The worktree was somehow configured to push directly to `upstream/master`. I believe this happened because I let an agent (for the first time) create the worktree for me and it followed some potentially misleading instructions in our AGENTS file.
   
   I will personally avoid using agents to create worktrees going forward, but to help prevent this from happening to others, I've tweaked the wording of the worktree instructions.
   
   More background here: https://github.com/apache/spark/pull/58136#issuecomment-5371893133
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   I will try creating a new worktree (without committing or pushing anywhere, of course) and inspect the setup. I will report back here.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] When agents create worktrees, point to origin, not upstream! [spark]

Posted by "nchammas (via GitHub)" <gi...@apache.org>.
nchammas commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5373133542

   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. I've used them before without issue; the first time I let an agent do it for me it created this situation!
   
   cc @dongjoon-hyun 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] When agents create worktrees, point to origin, not upstream! [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5372276434

   I think the existing behavior is correct, cutting from `<upstream>/master` so you won't start from a stale state, but usually, your main repo stays with the master branch and the newly created worktree with a different branch (worktrees can not use the same branch at the same time by design)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [MINOR][INFRA] Instruct agents to use `--no-track` when creating worktrees or branches [spark]

Posted by "nchammas (via GitHub)" <gi...@apache.org>.
nchammas closed pull request #58207: [MINOR][INFRA] Instruct agents to use `--no-track` when creating worktrees or branches
URL: https://github.com/apache/spark/pull/58207


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] [MINOR][INFRA] Instruct agents to use `--no-track` when creating worktrees or branches [spark]

Posted by "nchammas (via GitHub)" <gi...@apache.org>.
nchammas commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5383876742

   **Merge Summary:**
   - merged into master https://github.com/apache/spark/commit/941110af237f25e90a28e37675d866edda91602f
   
   *Posted by `merge_spark_pr.py`*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] When agents create worktrees, point to origin, not upstream! [spark]

Posted by "nchammas (via GitHub)" <gi...@apache.org>.
nchammas commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5373090654

   I use VS Code with Copilot and a mix of models. When I made [this mistake][1], I was using Grok 4.5.
   
   [1]: https://github.com/apache/spark/pull/58136#issuecomment-5371893133
   
   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):
   
   ```sh
   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 list
   ```
   
   If I then `cd` to the new worktree folder and inspect the push target, I see this:
   
   ```sh
   $ git status -sb
   ## docs-spelling-grammar...upstream/master
   ```
   
   I believe this is the problem. Normally, if you `git push` with this setup it will fail:
   
   ```
   fatal: The upstream branch of your current branch does not match
   the name of your current branch.
   ```
   
   However, I sometimes use VS Code's command palette to push. And this unfortunately has [different behavior][2].
   
   [2]: https://github.com/microsoft/vscode/blob/1.134.0/extensions/git/src/repository.ts#L2356-L2365
   
   `Git: Push` from the VS Code command palette constructs the equivalent of this command:
   
   ```
   git push upstream docs-spelling-grammar:master
   ```
   
   And this is exactly how I ended up pushing https://github.com/apache/spark/commit/3731453175d31125a8765f61d5df2e5936ffb28d directly to `master`.
   
   I believe this is a footgun that will eventually bite someone else, especially if they use VS Code and `Git: Push`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] Refactor AGENTS pre-flight checks and add worktree-specific guidance [spark]

Posted by "pan3793 (via GitHub)" <gi...@apache.org>.
pan3793 commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5377966073

   @nchammas, I understand what happened, but I would only touch this
   
   ```
   ... create a new git worktree from `<upstream>/master` and work from there (recommended) ...
                                                        /|\
                add some words to indicate to the agent that the new branch should NOT track the remote `<upstream>/master`
   ```
   
   I usually perform `git push` by either:
   
   1. ask the agent to push with the words "push to my forked repo", or
   2. type and run the `git push ...` command manually, or
   3. push via a GUI tool but set the target remote branch clearly


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] Refactor AGENTS pre-flight checks and add worktree-specific guidance [spark]

Posted by "nchammas (via GitHub)" <gi...@apache.org>.
nchammas commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5381276226

   OK, I've cut things back to just add the `--no-track` instruction.
   
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Re: [PR] Refactor AGENTS pre-flight checks and add worktree-specific guidance [spark]

Posted by "nchammas (via GitHub)" <gi...@apache.org>.
nchammas commented on PR #58207:
URL: https://github.com/apache/spark/pull/58207#issuecomment-5375654708

   @pan3793 - I've refactored the pre-flight checks section. What do you think? Does my [post mortem][1] make sense?
   
   [1]: https://github.com/apache/spark/pull/58207#issuecomment-5373090654


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org