Skip to content

combine on-close-hook-failures + version-stamped-hooks#5

Closed
eric-jones wants to merge 14 commits into
mainfrom
topic/external-hook-combine
Closed

combine on-close-hook-failures + version-stamped-hooks#5
eric-jones wants to merge 14 commits into
mainfrom
topic/external-hook-combine

Conversation

@eric-jones
Copy link
Copy Markdown
Owner

Fork-PR for review. Upstream: gastownhall#1607 (EXTERNAL, OPEN). Carrying for our integration.

Casey Boyle and others added 13 commits May 2, 2026 08:16
Hook scripts now embed a gc-hook-stamp comment with the build date and
commit. installBeadHooks reads the on-disk stamp before writing and
skips the write when the existing hook was installed by a newer binary.
This prevents stale per-worktree gc binaries from silently reverting
hooks to old templates.

Rules:
- Dev builds (date=unknown) always write
- Legacy hooks (no stamp) are always upgraded
- Stamped hooks are only overwritten by equal-or-newer builds

Also adds engdocs/contributors/stale-worktree-binaries.md documenting
the workflow gap and workaround for stale per-worktree gc copies.
The bd on_close hook is the only mechanism that cascade-closes sling
scaffolding (auto-convoy + molecule root + step beads) when a work bead
closes. Every gc invocation in the hook redirected stderr to /dev/null
and swallowed non-zero exits with `|| true`, so any failure -- gc not on
the hook subshell's PATH, store-resolution errors, transient panics --
was completely invisible. The downstream symptom was leaked sling
scaffolding with no diagnostic record anywhere.

Capture each gc command's stderr to ${BEADS_DIR:-.beads}/hooks.log, and
on non-zero exit append a dated diagnostic line that names the hook,
the bead id, the failed command, and the resolved $GC_BIN. Keep the
trailing `|| true` chain so a logging-write failure can't propagate to
bd, and keep the leading `&` so bd close stays non-blocking.

Apply the same pattern to the on_create / on_update generator for
consistency. Add hookNameFromEventType() so the diagnostic line names
the hook the operator can grep for ("on_create"/"on_close"/"on_update")
rather than the event-type label.

Closes gastownhall#1417
@eric-jones eric-jones force-pushed the topic/external-hook-combine branch from 53e4378 to 0b4724a Compare May 20, 2026 16:30
@eric-jones eric-jones closed this May 22, 2026
@eric-jones eric-jones deleted the topic/external-hook-combine branch May 22, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants