When task.baseCommitSha becomes stale (because main has advanced past
it via legitimate merges of OTHER tasks), git log baseSha..branchName
includes commits that are already on main with foreign task-id
attribution. classifyForeignOnlyContamination then returns
kind="ambiguous" — own commits AND foreign commits in range — and the
contamination recovery skips, blocking the merger handoff
indefinitely.
This stranded FN-5092 after manual merges of FN-5060/FN-5090/FN-5053
moved main forward without updating downstream tasks' baseCommitSha.
Fix: when git merge-base(branch, main) is a descendant of the
persisted baseSha, prefer the live merge-base for the contamination
classification range. Fail open to persisted baseSha on any git
error. Also pass the effective base to classifyBootstrapMisbinding
so both classifiers see consistent input.
Fusion-Task-Id: FN-5090
Squash-merge of fusion/fn-5053 (7 commits including retry duplicates).
Drops stale conflict in packages/core/src/index.ts (FN-5053 branch
re-exported symbols that main already exports) and packages/core/src/store.ts
(branch had a stale, narrower updateTask signature; main is authoritative).
Manual CEO recovery after the trailerless-commit attribution bug
(now fixed by FN-5090 in 92be8225e) stranded this task in in-review.
Fusion-Task-Id: FN-5053
The contamination detector relied solely on the Fusion-Task-Id commit
trailer to attribute commits to a task. Agent-driven commits do not
currently get the trailer written (no commit-msg hook installs it), so
filterFilesToOwnTaskCommits saw 0 of N commits attributed even when
every commit subject was clearly feat(FN-XXXX): / fix(FN-XXXX): work
for that task. This drove attributedFileCount=0 reports, false-positive
task:worktree-contamination-detected events, and indefinite
foreign-only-contamination-skipped + completion-handoff-limbo loops
that stranded FN-5053, FN-5060, FN-5083 (manually merged) for hours.
Hotfix:
- extractAttributedTaskId now accepts both Fusion-Task-Id and a
generic Task-Id trailer.
- New extractTaskIdFromSubject recognizes conventional-commit
(feat(<id>):), bracketed ([<id>]) and legacy colon (<id>:) styles
for any uppercase task prefix (FN, KB, RF, PROJ, JIRA, ...).
- filterFilesToOwnTaskCommits falls back to subject-derived
attribution when the trailer is missing, with case-insensitive
match against opts.taskId.
Project-agnostic by design: the subject regex matches any
[A-Z]+-\d+ pattern, so projects with non-FN taskPrefix are
covered automatically.
Two new tests cover the FN-5083 production repro and the
KB-/lowercase/legacy variants.
Fusion-Task-Id: FN-5090