Skip to content

fix(stokowski): make the before_run hook best-effort - #287

Merged
ruby-automation merged 4 commits into
mainfrom
fix/before-run-hook
Sep 26, 2026
Merged

ruby-automation merged 4 commits into
mainfrom
fix/before-run-hook

Conversation

@ruby-automation

@ruby-automation ruby-automation commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Problem

EXT-68 stayed in implement after its run succeeded. One of the causes was the before_run hook in workflow.glean.yaml:

git rebase origin/main 2>/dev/null || git rebase --abort

On a dirty worktree, git rebase refuses to start. git rebase --abort then exits 128 ("no rebase in progress"), so the hook failed on every dispatch in that workspace. The orchestrator retried it every 5 minutes until it was stopped. The duplicate-worker bug that let this block a finished stage is fixed in bougyman/stokowski#13.

The other three workflow files skipped the rebase on a dirty tree. But they used set -eu, which the Bash standard forbids, and they left a half-finished rebase behind when the rebase hit a conflict.

Changes

  • workflow.glean.yaml, workflow.opus.yaml, workflow.codex.yaml and workflow.claude.yaml now share one before_run hook:
    • It skips the rebase when git fetch or git status fails, or when the worktree is dirty.
    • It aborts a failed rebase.
    • It fails only if that abort fails.
  • workflow.opus.yaml: resolve leftover merge-conflict markers in after_create, which made the file invalid YAML. The main side (cd app && mix deps.get) is kept, because mix setup does not fetch the app's dependencies.
  • All four after_create hooks now run mix deps.get at the top level before mix setup. The root RepoTasks project depends on req and has no alias that fetches deps, so a fresh clone ran mix setup without them.
  • AGENTS.md (which CLAUDE.md links to): the repository layout note no longer says the root project has no deps.

Verification

  • All four files parse as YAML, and their before_run values are identical.
  • I ran the hook under /bin/sh against a scratch repo:
    • A clean tree behind origin rebases, exit 0.
    • A dirty tree skips the rebase, exit 0.
    • A conflicting rebase is aborted with no .git/rebase-merge left, exit 0.
    • With no remote, the fetch failure is reported and the rebase skipped, exit 0.
  • The pre-commit gate passed: 24 root tests, 577 app tests, credo --strict clean.

🤖 Generated with Claude Code

ruby-automation and others added 4 commits September 26, 2026 01:12
The glean workflow's hook ran `git rebase origin/main || git rebase
--abort`. On a dirty worktree the rebase refuses to start, and the abort
then exits 128 because no rebase is in progress, so every dispatch in that
workspace failed. EXT-68 retried it every 5 minutes until the orchestrator
was stopped.

The other three workflows used `set -eu`, which the Bash standard forbids,
and left a half-finished rebase behind when it hit a conflict.

All four now share one hook: skip the rebase when fetch or status fails
or the tree is dirty, abort a failed rebase, and fail only when that abort
fails. Also resolve leftover merge-conflict markers in the opus workflow's
after_create hook, which made the file invalid YAML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The root RepoTasks project depends on req, and it has no alias that
fetches deps. In a fresh clone, `mix setup` therefore ran without its
dependencies. Every after_create hook now runs `mix deps.get` at the top
level before `mix setup`.

Also correct the repository layout note in CLAUDE.md, which described
the root project as having no deps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The repository layout described the root RepoTasks project as having
no deps. It depends on req, so a fresh clone needs `mix deps.get` at the
top level as well as in app/. (The previous commit's message mentioned
this change, but the edit did not reach that commit.)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ruby-automation
ruby-automation merged commit 47d3c1b into main Sep 26, 2026
3 checks passed
@ruby-automation
ruby-automation deleted the fix/before-run-hook branch September 26, 2026 13:06
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.

2 participants