Skip to content

fix(ci): make hunt regeneration actually regenerate - #370

Merged
triw0lf merged 1 commit into
mainfrom
fix/regeneration-hunt-file-lookup
Aug 3, 2026
Merged

fix(ci): make hunt regeneration actually regenerate#370
triw0lf merged 1 commit into
mainfrom
fix/regeneration-hunt-file-lookup

Conversation

@triw0lf

@triw0lf triw0lf commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

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 — not H-259.md. The glob has never matched:

ls: cannot access 'Flames/H-*.md': No such file or directory

ls fails → EXISTING_HUNT_FILE is empty → is_regeneration is Falsegenerate_from_cti.py logs 🌱 Generating new hunt: H260 and 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.md and H260.md.

Effects

Regeneration doesn't regenerate A new hunt file is added per attempt
Orphan hunts accumulate Draft branches hold every attempt
Hunt IDs consumed Each attempt burns a number
Regeneration prompt never runs The is_regeneration branch in generate_from_cti.py is unreachable
Attempts still counted Users burn 1 of 5 for a no-op

Broken 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*.md matches every hunt already on main — verified, it returns Flames/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:

$ git diff --name-only origin/main...origin/draft/issue-369 -- 'Flames/H*.md' | head -n 1
Flames/H259.md      # correct — the original draft

Testing note

on: issues workflows always run the copy on the default branch, so this fix can't be exercised from a PR branch. It needs to land on main before regeneration can be verified end to end.

🤖 Generated with Claude Code

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>
@triw0lf
triw0lf merged commit e3fde32 into main Aug 3, 2026
3 checks passed
@triw0lf
triw0lf deleted the fix/regeneration-hunt-file-lookup branch August 3, 2026 16:13
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.

1 participant