Skip to content

fix(ci): add setup-uv to workflows and derive repo owner from $GITHUB_REPOSITORY - #100

Merged
max-sixty merged 3 commits into
mainfrom
hourly/review-23716701452
Mar 29, 2026
Merged

max-sixty merged 3 commits into
mainfrom
hourly/review-23716701452

Conversation

@tend-agent

@tend-agent tend-agent commented Mar 29, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Two CI behavior fixes identified by review-reviewers analysis:

  • Add setup-uv to CI workflows: The bot wastes 3-5 tool calls per session trying to locate uv — CLAUDE.md says cd generator && uv run pytest but uv isn't installed in CI runners. Observed 5 times across review, mention, and nightly runs (runs 23608757804, 23682034006, 23703363227, 23703434151, 23716607858). Adding astral-sh/setup-uv@v6 as a setup step ensures uv is on PATH before Claude runs.
  • Derive repo owner from $GITHUB_REPOSITORY: The list-recent-runs.sh script had a hardcoded owner assumption.

Gate assessment

uv PATH discovery waste

  • Evidence level: Medium
  • Occurrences: 5 (4 historical from tracking issue review-reviewers tracking: 2026-03 #12 + 1 this run)
  • Change type: Targeted fix (config change + workflow regeneration)
  • Passes both gates: Yes — Medium/5 meets threshold, targeted fix is proportionate

Test plan

  • All 109 generator tests pass
  • CI workflows regenerated successfully
  • Verify uv is available in next CI run

🤖 Generated with Claude Code

The triage bot on max-sixty/worktrunk posted a comment on issue #1790
with permalink URLs pointing to `github.com/anthropics/worktrunk`
instead of `github.com/max-sixty/worktrunk`. All links in the comment
are broken because the organization was hallucinated.

Add explicit guidance to derive owner/repo from $GITHUB_REPOSITORY
rather than guessing.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label Mar 29, 2026
The bot wastes multiple tool calls per session trying to locate `uv` —
CLAUDE.md says `cd generator && uv run pytest` but `uv` isn't installed
in CI runners. Observed 5 times across review, mention, and nightly runs.

Adding `astral-sh/setup-uv@v6` as a setup step ensures `uv` is on PATH
before Claude runs.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@tend-agent tend-agent changed the title fix(ci): derive repo owner from $GITHUB_REPOSITORY for URLs fix(ci): add setup-uv to workflows and derive repo owner from $GITHUB_REPOSITORY Mar 29, 2026

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Overlaps significantly with #99 — 4 shared workflow files. The two PRs take conflicting approaches to ref: in checkout steps: #99 adds ref: {cfg.default_branch} to the generator (explicit checkout of the default branch), while this PR removes the existing ref: main lines (relying on the implicit default). Whichever merges second will hit conflicts. Worth coordinating — if both changes are wanted, one should be rebased onto the other.

Comment thread .github/workflows/tend-mention.yaml Resolved
Co-authored-by: Maximilian Roos <[email protected]>
@max-sixty
max-sixty merged commit b339ecb into main Mar 29, 2026
3 checks passed
@max-sixty
max-sixty deleted the hourly/review-23716701452 branch March 29, 2026 20:19
max-sixty pushed a commit that referenced this pull request Apr 10, 2026
## Summary

Strengthen the running-in-ci skill's guidance on constructing GitHub
URLs, after a second occurrence of the bot shipping a user-visible
comment with the wrong repository owner in a `github.com` link.

## Evidence

Two recent tend-triage comments on `max-sixty/worktrunk` have shipped
broken links because the model hardcoded a wrong owner:

1. **2026-04-02** — Run
[23889208419](https://github.com/max-sixty/worktrunk/actions/runs/23889208419),
triage on issue max-sixty/worktrunk#1888, session
`d544ecc6-8bb7-4bfe-85a6-82bef8bec237.jsonl`. Comment linked
`https://github.com/anthropics/worktrunk/blob/f6e89009/src/git/mod.rs#L222-L261`
— the bot reached for the canonical "anthropics" org from training data.
Recorded in [review-reviewers-tracking:
2026-04](#133) under "Hardcoded
organization in URL".
2. **2026-04-10** — Run
[24254699778](https://github.com/max-sixty/worktrunk/actions/runs/24254699778),
triage on issue max-sixty/worktrunk#2055, session
`225e9f4d-8007-4b63-9a5a-f8f899e16891.jsonl`.
[Comment](max-sixty/worktrunk#2055 (comment))
linked
`https://github.com/worktrunk/worktrunk/blob/main/src/commands/hook_commands.rs#L214-L226`
— this time the bot inferred the owner from the repo name. Both links
404.

A third, related URL-grounding failure (inferred docs path
`https://worktrunk.dev/claude-code/` on issue max-sixty/worktrunk#1903)
is recorded in the same tracking issue — the overall pattern is "model
composes URLs from context rather than verifying the source."

The running-in-ci skill has had a one-sentence "derive the owner from
`$GITHUB_REPOSITORY` — never guess or hardcode the organization in URLs"
directive since [#100](#100)
(2026-03-29). Both failures above happened *after* that guidance landed,
so a passive sentence is not enough.

## Root cause

When composing a `github.com/…` URL in a comment, the model picks a
plausible owner from context: training-data canonical org (`anthropics`)
or the repo name itself (`worktrunk/worktrunk`). It does not consult
`$GITHUB_REPOSITORY`.

## Fix

Replace the passive sentence with an imperative block:
- Bold heading so it survives skimming.
- Concrete construction template
`https://github.com/${GITHUB_REPOSITORY}/...`.
- The two real wrong-answers as examples, so the model pattern-matches
away from them.
- An explicit pre-post check step (grep for `github.com/`, verify
owners).

## Gate assessment

- **Evidence level**: High — consistent pattern of user-visible comments
with broken links, 2 occurrences of hardcoded-wrong-owner (specifically)
+ 1 related URL-grounding lapse. Failures are in public-facing bot
output.
- **Classification**: Structural-ish stochastic — the lapse happens when
the skill guidance is too weak to counter the model's default
URL-composition habit. Strengthening the guidance is a predictable
mitigation.
- **Change type**: Targeted fix — replaces one sentence with a slightly
longer paragraph. Not a new section, not a structural reorg.
- **Passes both gates**: Yes — High/2–3 meets the threshold for targeted
fixes.

## Test plan

- [ ] Running-in-ci skill still reads cleanly from the Comment
Formatting section.
- [ ] Next triage run that emits a `github.com/…` URL uses
`max-sixty/...` (observable in tracking issue #133).

Co-authored-by: continuous-bot <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
max-sixty added a commit that referenced this pull request Aug 13, 2026
`gh pr view --json commits` issues `commits(first: 100)` unpaginated and
oldest-first, so past 100 commits `.commits[-1]` is commit #100 rather than
the head. Every head-keyed field then matches nothing and goes quiet rather
than wrong-loud: the pre-post guard stops firing, so a fold-in re-run posts a
second review on a commit it already reviewed; the 422 recovery finds no
orphan and duplicates instead of editing; and in review's moved-head check the
truncation inverts the guard, so a push that did move the head reads as
"HEAD hasn't moved" and the review posts against the stale commit. weekly's
redundant-approval guard fails the same way, collecting an approval per run
on one commit.

Four sites: the resolver plus three in the skills. `headRefOid` is the head by
definition and can't truncate.

The fixture now serves a deliberately wrong-last `commits` list alongside
`headRefOid`, so going back to the old read fails nine tests rather than
passing on a short PR.
max-sixty added a commit that referenced this pull request Aug 13, 2026
…ces (#971)

Two rounds of cutting, both aimed at the same shape: logic that mattered
enough to be right, living in prose that nothing checked.

## One resolver for "which review anchors this head"

A review's `.commit_id` can't be read on its own. Replying to a review
thread makes GitHub wrap the reply in a synthetic zero-body review
anchored at the then-current head, so the newest record routinely points
at a commit nothing reviewed. And a force-push doesn't just move the
head — it re-points earlier reviews' `.commit_id` at the new one, so a
review of code that no longer exists reports the current head.

Every caller that reads an anchor has to discount both, and five did:
three sites in `review` (step 1's anchor resolution, step 5's pre-post
guard, step 6's orphan probe) and two in `weekly` (the
redundant-approval guard and the stale-approval dismissal). All five
were untested shell, each carrying its own paragraph of rationale — and
they had already drifted, to the point that `weekly` documents its
filter ordering as *deliberately* different from `review`'s.

`plugins/tend-ci-runner/scripts/bot-review-state.sh` answers the
question once and emits it as JSON — the newest substantive review and
whether a rewrite postdates it, whether anything genuinely anchors the
current head, the orphan body a partially-failed review POST left
behind, and the fresh and stale approvals. Each call site now reads one
field.

The consequences of getting any of this wrong are outward, which is what
earns the mechanism its place: a reply container counted as a review
discards a real one after the work is done; a missing rewrite filter
leaves a rebased PR carrying an approval it never earned, or makes the
recovery `PUT` overwrite a published review with this run's findings.

## A head-resolution bug the extraction surfaced

Centralizing the anchor logic made a pre-existing bug visible, so it's
fixed here too. `gh pr view --json commits` issues `commits(first: 100)`
— unpaginated, oldest-first — so past 100 commits `.commits[-1]` is
commit #100 rather than the head. Every head-keyed field then matches
nothing and goes quiet rather than wrong-loud: the pre-post guard stops
firing, so a fold-in re-run posts a second review on a commit it already
reviewed; the 422 recovery finds no orphan and duplicates instead of
editing it; `review`'s moved-head check inverts, so a push that *did*
move the head reads as "HEAD hasn't moved" and the review posts against
a stale commit; and `weekly`'s redundant-approval guard never matches,
collecting an approval per weekly run on one commit.

Four sites now read `headRefOid`, which is the head by definition and
can't truncate. The test fixture serves a deliberately wrong-last
`commits` list alongside it, so reverting fails nine tests rather than
passing on a short PR.

## Skill depth into `references/`

`running-in-ci` was 677 lines against the 500-line cap
`authoring-skills` sets, and that skill's own remedy is splitting into
`references/`, which costs nothing until read. Grounded-analysis depth,
the other-repos rules, and the bar for proposing a skill PR move there;
SKILL.md keeps each rule and a pointer. Every bundled skill is now under
the cap.

| skill | before | after |
|---|---|---|
| `running-in-ci` | 677 | 462 |
| `review` | 533 | 474 |
| `weekly` | 98 | 78 |

## Testing

20 tests in `generator/tests/test_bot_review_state.py` run the script
against a fake `gh`: reply containers vs. real reviews, rewrite timing
on both sides of a review, fresh vs. stale approvals, a dismissed one
that must not be re-dismissed, orphan bodies, and the repo being named
on every call. Five mutations confirm they bite — counting reply
containers as substantive, counting a DISMISSED review as an approval,
dropping the rewrite filter from `at_head` or from `orphan_id`, and the
ordering flip below each fail 1–2 tests.

The ordering subtlety is the one `weekly` had split two ways, and the
single implementation settles it: take the newest approval, *then* test
whether it predates the rewrite. Filtering first names a pre-rewrite
approval that a later one already superseded — dismissing a review that
no longer decides anything while the one that does stands untouched.

<details><summary>What this trades away</summary>

The brief was to accept modest reductions in feature precision. Only one
materialized: "rewriting is authoring" is now a sentence inside
`grounded-analysis.md` rather than a section with a worked example.
Everything else here is behaviour-preserving — the duplication turned
out to be a better trade than cutting precision.

Reading the anchor state is now up to three script calls in a review run
rather than the same work inlined three times, each fetching one
endpoint more than the site strictly needs. That's compute, not
correctness, and the repo's own rule puts it a distant third.

</details>

> _This was written by Claude Code on behalf of max-sixty_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Behavioral issues found by review-reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants