Skip to content

Commit 627f99a

Browse files
committed
fix(ship-skill,babysit): fix reversed commit-list order, tail-1 grabbing wrong line, stale step reference
- git log --oneline is newest-first, gh pr view commits is oldest-first — the two content-verify commands now use --reverse so a positional comparison doesn't spuriously fail on any multi-commit branch - 'select(...) | .body | tail -1' pipes every matching comment's full body through the pipeline and keeps only the last LINE of the combined output (the review-count footer), not the last COMMENT — demonstrated this myself this session reading the footer instead of the actual score. Now uses '[.comments[]] | last | .body' - Cursor's babysit.md pointed at '/ship step 9', but Cursor's ship.md only has 7 steps (no cleanup/migration steps) — now points at step 7 and cross-references the 9-step Claude Code skill copy
1 parent 1379443 commit 627f99a

4 files changed

Lines changed: 33 additions & 14 deletions

File tree

.agents/skills/babysit/SKILL.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ round. Always check both conditions freshly after every push.
3535

3636
1. **Check current state** before doing anything:
3737
```bash
38-
gh pr view <n> --json comments -q '.comments[] | select(.author.login=="greptile-apps") | .body' | tail -1
38+
gh pr view <n> --json comments -q '[.comments[] | select(.author.login=="greptile-apps")] | last | .body'
3939
gh api graphql -f query='
4040
query { repository(owner: "<owner>", name: "<repo>") { pullRequest(number: <n>) {
4141
reviewThreads(first: 50) { pageInfo { hasNextPage endCursor } nodes { id isResolved path line
4242
comments(first: 5) { nodes { id databaseId author { login } body } } } } } } }'
4343
```
44+
`[.comments[]] | last | .body`, not `... | .body | tail -1` — the latter pipes every matching
45+
comment's full multi-line body through the pipeline and keeps only the final *line* of that
46+
combined output (usually the "Reviews (n): Last reviewed commit..." footer), not the last
47+
*comment*, so it silently misses the actual "Confidence Score: X/5" line.
4448
`reviewThreads(first: 50)` is a single page — check `pageInfo.hasNextPage`. If `true`, don't
4549
stop yet: re-run the same query with `after: "<endCursor>"` and keep paging until
4650
`hasNextPage` is `false` before evaluating "clean." A PR with more than 50 threads is rare but
@@ -88,9 +92,11 @@ round. Always check both conditions freshly after every push.
8892
sync check required a rebuild), then run `/ship` step 9's post-push verify — not just before
8993
the first push, every push in the loop:
9094
```bash
91-
git fetch origin staging && git log --oneline origin/staging..HEAD
95+
git fetch origin staging && git log --oneline --reverse origin/staging..HEAD
9296
gh pr view <n> --json commits -q '.commits[].messageHeadline'
9397
```
98+
`--reverse` matches `git log`'s newest-first default to the PR commit list's oldest-first
99+
order — without it a positional comparison can spuriously fail on any multi-commit branch.
94100
These two lists must describe the same commits. A review loop runs many pushes across many
95101
rounds; checking sync only before the push (step 5) and never after is how a bad push or a
96102
PR whose commit history quietly went stale between rounds goes unnoticed.

.agents/skills/ship/SKILL.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,16 @@ When the user runs `/ship`:
3535
8. **Push to origin** using the current branch name
3636
9. **Create a PR** to staging with a description in the user's voice, then do a final content check — not a count check — comparing what actually landed:
3737
```bash
38-
git fetch origin staging && git log --oneline origin/staging..HEAD
38+
git fetch origin staging && git log --oneline --reverse origin/staging..HEAD
3939
gh pr view <n> --json commits -q '.commits[].messageHeadline'
4040
```
4141
Re-fetch first — comparing against a stale local `origin/staging` ref can mask real drift or
42-
flag a false mismatch even when the branch and push are correct. These two lists must
43-
describe the same commits (same subjects, one of which is the commit from step 7). If they
44-
don't match, the branch still has a problem — redo step 2's fix and `git push --force-with-lease`.
42+
flag a false mismatch even when the branch and push are correct. `--reverse` makes the git log
43+
oldest-first, matching the PR commit list's order — plain `git log` is newest-first, and a
44+
positional/line-by-line comparison against the PR's oldest-first list can spuriously fail on
45+
any multi-commit branch. These two lists must describe the same commits in the same order
46+
(same subjects, the last one being the commit from step 7). If they don't match, the branch
47+
still has a problem — redo step 2's fix and `git push --force-with-lease`.
4548

4649
## Commit Message Format
4750

.cursor/commands/babysit.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,16 @@ round. Always check both conditions freshly after every push.
2929

3030
1. **Check current state** before doing anything:
3131
```bash
32-
gh pr view <n> --json comments -q '.comments[] | select(.author.login=="greptile-apps") | .body' | tail -1
32+
gh pr view <n> --json comments -q '[.comments[] | select(.author.login=="greptile-apps")] | last | .body'
3333
gh api graphql -f query='
3434
query { repository(owner: "<owner>", name: "<repo>") { pullRequest(number: <n>) {
3535
reviewThreads(first: 50) { pageInfo { hasNextPage endCursor } nodes { id isResolved path line
3636
comments(first: 5) { nodes { id databaseId author { login } body } } } } } } }'
3737
```
38+
`[.comments[]] | last | .body`, not `... | .body | tail -1` — the latter pipes every matching
39+
comment's full multi-line body through the pipeline and keeps only the final *line* of that
40+
combined output (usually the "Reviews (n): Last reviewed commit..." footer), not the last
41+
*comment*, so it silently misses the actual "Confidence Score: X/5" line.
3842
`reviewThreads(first: 50)` is a single page — check `pageInfo.hasNextPage`. If `true`, don't
3943
stop yet: re-run the same query with `after: "<endCursor>"` and keep paging until
4044
`hasNextPage` is `false` before evaluating "clean." A PR with more than 50 threads is rare but
@@ -79,12 +83,15 @@ round. Always check both conditions freshly after every push.
7983
`/ship` does before committing.
8084

8185
6. **Commit and push** the round's fixes as one commit (`--force-with-lease` only if step 5's
82-
sync check required a rebuild), then run `/ship` step 9's post-push verify — not just before
83-
the first push, every push in the loop:
86+
sync check required a rebuild), then run `/ship` step 7's post-push verify — not just before
87+
the first push, every push in the loop (the Cursor `/ship` has 7 steps; the Claude Code skill
88+
version's equivalent is step 9 — see `.agents/skills/babysit/SKILL.md` if working from that copy):
8489
```bash
85-
git fetch origin staging && git log --oneline origin/staging..HEAD
90+
git fetch origin staging && git log --oneline --reverse origin/staging..HEAD
8691
gh pr view <n> --json commits -q '.commits[].messageHeadline'
8792
```
93+
`--reverse` matches `git log`'s newest-first default to the PR commit list's oldest-first
94+
order — without it a positional comparison can spuriously fail on any multi-commit branch.
8895
These two lists must describe the same commits. A review loop runs many pushes across many
8996
rounds; checking sync only before the push (step 5) and never after is how a bad push or a
9097
PR whose commit history quietly went stale between rounds goes unnoticed.

.cursor/commands/ship.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ When the user runs `/ship`:
2929

3030
7. **Create a PR** to staging with a description in the user's voice, then do a final content check — not a count check — comparing what actually landed:
3131
```bash
32-
git fetch origin staging && git log --oneline origin/staging..HEAD
32+
git fetch origin staging && git log --oneline --reverse origin/staging..HEAD
3333
gh pr view <n> --json commits -q '.commits[].messageHeadline'
3434
```
3535
Re-fetch first — comparing against a stale local `origin/staging` ref can mask real drift or
36-
flag a false mismatch even when the branch and push are correct. These two lists must
37-
describe the same commits (same subjects, one of which is the commit from step 5). If they
38-
don't match, the branch still has a problem — redo step 2's fix and `git push --force-with-lease`.
36+
flag a false mismatch even when the branch and push are correct. `--reverse` makes the git log
37+
oldest-first, matching the PR commit list's order — plain `git log` is newest-first, and a
38+
positional/line-by-line comparison against the PR's oldest-first list can spuriously fail on
39+
any multi-commit branch. These two lists must describe the same commits in the same order
40+
(same subjects, the last one being the commit from step 5). If they don't match, the branch
41+
still has a problem — redo step 2's fix and `git push --force-with-lease`.
3942

4043
## Commit Message Format
4144

0 commit comments

Comments
 (0)