Skip to content

fix: re-add repo_name() for bare repo layout (regression #1279) - #1544

Closed
worktrunk-bot wants to merge 1 commit into
mainfrom
fix/repo-name-bare-regression-1279
Closed

worktrunk-bot wants to merge 1 commit into
mainfrom
fix/repo-name-bare-regression-1279

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

The original fix (5b67d38) was working, but #1280 refactored repo_path() to return Result and in doing so reverted all call sites back to repo_path()?.file_name(), removing the repo_name() method entirely.

Test plan

  • test_nested_bare_repo_repo_name_not_dot_git — verifies {{ repo }} resolves to project name
  • All 19 bare repository integration tests pass
  • All 463 unit tests pass

🤖 Generated with Claude Code

The fix in 5b67d38 added Repository::repo_name() to resolve the
project name correctly for nested bare repos (project/.git → "project").
Commit 79361c6 (#1280) inadvertently removed repo_name() while
refactoring repo_path() to return Result, reverting all call sites
back to repo_path().file_name() which returns ".git" for bare repos.

Re-add repo_name() adapted for the Result-returning repo_path() API,
and restore the regression test.

Closes #1279

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Closing — this uses the same path-name heuristic approach that was discussed and set aside on #1281. The direction is moving toward a user-facing warning/prompt instead. See the latest discussion on #1281.

worktrunk-bot added a commit that referenced this pull request Mar 16, 2026
Previously, claude-mention triggered on `issues: [opened, edited]` while
claude-issue-triage skipped issues mentioning @worktrunk-bot. This caused
races when a user both commented on an existing issue and filed a new one
— two workflows independently created fix PRs for the same bug (#1544/#1545).

Now triage handles all new issues (including @worktrunk-bot mentions),
and mention only triggers on issue edits. This eliminates the race for
new issues while preserving the ability to summon the bot by editing an
existing issue.

Ref: #1548 (comment)

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty pushed a commit that referenced this pull request Mar 21, 2026
…ixes (#1548)

## Problem

When a user both comments on an existing issue AND files a new issue
within seconds (as happened with #1279/#1543), two independent workflows
(`claude-mention` and `claude-issue-triage`) race to create fix PRs.
This produced duplicate PRs #1544 and #1545, which modify the exact same
6 files with nearly identical changes.

The review bot then reviewed both PRs independently and even posted
misleading feedback on #1545 — flagging "missing" call site migrations
in `src/llm.rs` and `src/commands/step_commands.rs` that PR #1544
already handles.

**Evidence:** Run 23121388888 (review of #1545) posted a COMMENT
suggesting files that the sibling PR #1544 already covers. Run
23121179226 (review of #1544) found no issues but didn't detect the
duplication either.

This is a variant of #1428 but affects user-triggered events (not
bot-authored), so the existing bot-author filter from #1429 doesn't
help.

## Fix

Add a new **Step 2: Check for overlapping PRs** to the review-pr skill.
Before reading the diff, the reviewer checks whether other open
bot-authored PRs touch the same files. If overlap is found, it's flagged
in the review so one can be closed as a duplicate.

Also renumbers subsequent steps (3→4, 4→5, etc.) and updates internal
cross-references.

## Why this approach

- **Catches duplicates at review time** — the cheapest point to detect,
since both PRs exist by then
- **Doesn't require workflow coordination** — no locking or
inter-workflow communication needed
- **Low false-positive risk** — overlapping files on bot PRs with
similar fixes is a strong signal

The underlying race between triage and mention workflows remains (fixing
that would require cross-workflow locking), but this ensures the
reviewer surfaces the duplication for human action.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: worktrunk-bot <[email protected]>
Co-authored-by: Claude <[email protected]>
@max-sixty
max-sixty deleted the fix/repo-name-bare-regression-1279 branch June 18, 2026 06:00
max-sixty pushed a commit that referenced this pull request Nov 28, 2026
…#4908)

`{{ repo }}` in commit and squash prompt templates now renders the
repository's name in every worktree. Before, it rendered the current
worktree's folder name, so a custom template run from a linked worktree
at `~/code/myrepo.feature` got `myrepo.feature`. A hook in the same
worktree gets `myrepo`, and [the LLM commits
docs](https://worktrunk.dev/llm-commits/) describe the variable as
"Repository name".

The three prompt sites (`build_commit_prompt`, the squash preview, the
squash run) each derived the name from `wt.root()`. They now share
`llm::prompt_repo_name`, which reads `Repository::repo_path()`, the same
source `build_hook_context` and the worktree-path template use. The
default templates don't reference `{{ repo }}`, so only custom templates
are affected.

One effect to know about: in a nested bare layout (`project/.git` with
worktrees beside it), the prompt's `repo` changes from the worktree's
folder name (e.g. `main`) to `.git`. That's the value hooks already get
there. Naming bare repos better was discussed in #1281, #1544 and #1545,
and this PR doesn't change that.

The new test
`test_prompt_repo_names_the_repository_from_a_linked_worktree` covers
`commit --show-prompt`, `squash --show-prompt`, `squash --dry-run`, and
a real squash, all from a linked worktree. On `main` it fails with
`repo=repo.feature`; with the fix it passes. The `merge::` and
`bare_repository::` integration tests also pass locally, except
`test_merge_no_ff_signs_merge_commit`, which fails the same way on
`main` in this sandbox (ssh refuses the test's signing key because its
file permissions are too open).

Co-authored-by: worktrunk-bot <[email protected]>
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