task-observer: new-session updates from 2026-05-29#39
Conversation
Before creating a new worktree, inspect existing ones for a clean candidate. If a clean worktree exists with no branch-only commits, prefer fast-forwarding it to the target branch over adding sprawl.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1a8f027cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ```bash | ||
| git worktree list | ||
| ``` | ||
| If a clean worktree with no branch-only commits exists and could serve as the target, prefer reusing it (fast-forward its branch to the target and update `launch.json`) over adding new workspace sprawl. |
There was a problem hiding this comment.
Enter the reused worktree before setup
When this reuse path is taken, the agent has only run git worktree list from the main repo, so its CWD is still the main checkout. Step 3 then runs the setup script from the wrong directory; the script explicitly expects a non-main worktree and exits when WORKTREE equals MAIN_REPO. In any session with a suitable existing worktree, this makes the new-session flow fail instead of reusing it, so the instructions should include an explicit cd <worktree> or equivalent before continuing.
Useful? React with 👍 / 👎.
Target
skill: .agents/skills/new-session/SKILL.md
Observations addressed
git worktree listfirst and prefers fast-forwarding a clean existing worktree to the target branch over creating a new one, to minimize workspace sprawlGenerated by Claude Code