fix(merger): prefer step headline subject + add autostash race-rescue

- deriveDeterministicSubjectSummary now picks the lowest-numbered
  `complete Step N` headline (or the oldest commit) instead of the most
  recent commit, so trailing quality-gate revisions stop hijacking the
  squash-merge subject (FN-3617 landed as "align mailbox modal css..."
  when 4 of 5 commits were the actual Claude OAuth fix).
- AI subject + body system prompts in ai-summarize.ts now weight by
  commit theme rather than file size, so a small token cleanup that
  touches a large CSS file no longer dominates the summary.
- stashUnrelatedRootDirChanges adds a bounded re-snapshot loop after
  the primary stash is persisted but before \`git reset --hard\`. Any
  late-dirty paths (concurrent dev edits during a long merger run,
  parallel merger runs racing on rootDir, late test/build artifacts)
  get captured in labeled \`race-rescue-N\` stashes recoverable from
  \`git stash list\`, instead of being wiped by the destructive reset.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-06 17:06:46 -07:00
parent e2949ca2b6
commit 923411a940
4 changed files with 127 additions and 11 deletions

View File

@@ -336,6 +336,12 @@ Your ONLY job is to describe what the merge accomplishes based on the step commi
## Style
- 1-3 concise sentences
- Mention the most meaningful modules or behaviors touched
- Weight by COMMIT THEMES, not by file size. If most step commits describe
feature X and a single tail-end commit is a small fixup (lint, design tokens,
doc tweaks) that happens to touch the largest file, lead with feature X and
mention the fixup only as a secondary clause if at all.
- Do not let the most-recent commit alone dictate the summary — quality-gate
revisions land last and are typically the smallest theme on the branch.
- Be factual and avoid inventing details
- Readable and professional`;
@@ -641,7 +647,14 @@ Your ONLY job is to summarize what landed — using the branch's step commit sub
- Imperative mood ("add X", "fix Y", "refactor Z") and lower-case first word
- Hard cap: 60 characters; aim for 4055
- Be specific: name the most consequential module/feature/behavior that changed
- If the branch has one clear theme, describe it; if it's mixed, lead with the largest change
- Weight by COMMIT THEMES, not by file size. If 4 of 5 commits are about feature X
and the 5th is a small token/lint cleanup that happens to touch the largest CSS
file, the subject MUST describe feature X — not the cleanup.
- The most recent commit is often a quality-gate revision or fixup (lint, tokens,
doc tweaks). Do NOT let the latest commit's subject dominate; prefer the
earliest \`complete Step N — …\` headline or the first feat/fix commit.
- If genuinely mixed (no dominant theme across commit subjects), lead with the
earliest step's headline
- Do not invent details that aren't in the input`;
/** Maximum output length for the generated commit subject, in characters. */