Skip to content

chore(harness): encode post-merge cleanup into ship-pr + session-start - #63

Merged
fullstackjam merged 1 commit into
mainfrom
chore/post-merge-cleanup-sensor
May 16, 2026
Merged

fullstackjam merged 1 commit into
mainfrom
chore/post-merge-cleanup-sensor

Conversation

@fullstackjam

Copy link
Copy Markdown
Member

Summary

Closes the last gap in the post-edit harness loop: after auto-merge lands a PR, the local feature branch lingers as an orphan, and cleanup was previously oral tradition. Two complementary controls encode it:

  • .claude/hooks/session-start.sh — adds a stale-branch sensor that runs unconditionally (local + remote, before the cache-warming gate). git fetch --prune is silent and cheap; if the current branch's upstream ref is gone, it prints a one-line cleanup hint. No-op on main and on fresh unpushed branches.
  • .claude/skills/ship-pr/SKILL.md — gains a Step 8 that polls gh pr view once after enabling auto-merge. If the PR landed immediately, in-session cleanup runs right away. If still OPEN, the session-start sensor catches it on the next session.
  • docs/HARNESS.md — two new rows in the controls table so both are discoverable from the steering meta-doc.

Verified by running bash .claude/hooks/session-start.sh on a fresh feature branch (silent) and on this branch before push (silent).

Test plan

  • bash -n .claude/hooks/session-start.sh (syntax)
  • make test-unit passes
  • After merge: opening the next session on a feature branch whose upstream was deleted should print the cleanup hint.

Closes the last gap in the post-edit harness loop. Previously, after
auto-merge landed a PR, the local feature branch lingered as an orphan
and cleanup was oral tradition.

Two complementary controls:

- session-start.sh now runs a lightweight stale-branch sensor before the
  cache-warming section. It runs unconditionally (local + remote),
  fetches with --prune, and prints a one-line cleanup hint if the
  current branch's upstream ref is gone. No-op on main and on fresh
  unpushed branches.

- ship-pr SKILL.md gains a Step 8 that polls `gh pr view` once after
  enabling auto-merge. If the PR landed immediately, the in-session
  cleanup runs right away. If still OPEN, the session-start sensor
  picks it up next time.

docs/HARNESS.md gets two new rows so the controls are discoverable from
the steering meta-doc.
@github-actions github-actions Bot added the docs label May 16, 2026
@fullstackjam
fullstackjam enabled auto-merge (squash) May 16, 2026 13:54
@codecov

codecov Bot commented May 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@fullstackjam
fullstackjam merged commit 4f9f65a into main May 16, 2026
13 checks passed
@fullstackjam
fullstackjam deleted the chore/post-merge-cleanup-sensor branch May 16, 2026 13:56
fullstackjam added a commit that referenced this pull request May 16, 2026
…65)

The sensor in .claude/hooks/session-start.sh was introduced when ship-pr
used `gh pr merge --auto` — merges happened asynchronously after the
session ended, so a feature branch could linger checked out into the
next session and the sensor nagged the user to clean it up.

PR #64 dropped --auto. Merges are now synchronous and cleanup is Step 8
of the ship-pr loop, which always runs before the session can end on a
shipped PR. The sensor's trigger condition can no longer occur in
normal flow, so it's dead code paying for a per-session `git fetch`.

- session-start.sh restored to the pre-#63 shape (cache warming only).
- ship-pr SKILL.md drops the 'sensor will catch lingering branches'
  fallback paragraph; the cleanup step is now described as part of the
  loop, not optional.
- docs/HARNESS.md drops the sensor row from the controls table and adds
  a note in 'What's intentionally NOT in the harness' explaining the
  removal — so a future agent doesn't re-add it without also re-adding
  --auto.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant