fix(ci): make hunt regeneration actually regenerate - #370
Merged
Conversation
The regeneration step looked for the existing draft with: HUNT_FILE=$(ls Flames/H-*.md | head -n 1) Hunt files are named HNNN.md, not H-NNN.md, so the glob has never matched. ls fails, EXISTING_HUNT_FILE is empty, is_regeneration is False, and generate_from_cti.py logs "Generating new hunt" and writes an additional hunt file instead of updating the existing one. Effects: draft branches accumulate orphan hunts, hunt IDs are consumed per attempt, the regeneration-specific prompt never runs, and users still burn one of their five attempts. Broken since 5a0b4bc (2025-06-21), when the regeneration loop was added. Fix by selecting the hunt file added on the draft branch rather than globbing the working tree. A bare Flames/H*.md would be worse than the original bug - it matches every hunt already on main and would overwrite a production file (verified: it returns Flames/H001.md). Fail loudly if no draft file is found, rather than silently degrading to a new generation. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Hunt regeneration has never worked. Found while testing the regeneration path after the Sonnet 5 migration.
.github/workflows/issue-generate-hunts.yml:107:HUNT_FILE=$(ls Flames/H-*.md | head -n 1)Hunt files are named
H259.md— notH-259.md. The glob has never matched:lsfails →EXISTING_HUNT_FILEis empty →is_regenerationisFalse→generate_from_cti.pylogs🌱 Generating new hunt: H260and writes an additional hunt file instead of updating the existing one.Observed on a live test run
Issue #369, regeneration run 30830538400. The draft branch ended up with both
H259.mdandH260.md.Effects
is_regenerationbranch ingenerate_from_cti.pyis unreachableBroken since
5a0b4bc(2025-06-21), the commit that added the regeneration loop.Fix
Select the hunt file added on the draft branch rather than globbing the working tree:
HUNT_FILE=$(git diff --name-only origin/main...HEAD -- 'Flames/H*.md' | head -n 1)Note the naive fix is worse than the bug. Changing the glob to
Flames/H*.mdmatches every hunt already on main — verified, it returnsFlames/H001.md, so regeneration would silently overwrite a production hunt.Also fails loudly when no draft file is found, instead of silently degrading to a new generation.
Verified
Against the real
draft/issue-369:Testing note
on: issuesworkflows always run the copy on the default branch, so this fix can't be exercised from a PR branch. It needs to land onmainbefore regeneration can be verified end to end.🤖 Generated with Claude Code