Skip to content

fix(bin): prevent superseded crew runs from becoming current - #10

Merged
Hozzy02 merged 4 commits into
mainfrom
fm/fm-crewstate-stale-run
Sep 16, 2026
Merged

Hozzy02 merged 4 commits into
mainfrom
fm/fm-crewstate-stale-run

Conversation

@Hozzy02

@Hozzy02 Hozzy02 commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Intent

Fix bin/fm-crew-state.sh so it never reports a superseded older validation run as a task current state. Verify which detailed or coarse path causes the false failed verdict before changing it. Bind crew state to the run matching the current branch head or the most recent run for that branch; a parked or running active run must win over older terminal outcomes, while a genuinely newest failed run must still report failed. Add public-interface regressions for older failed plus newer parked and for newest genuinely failed, preserve all existing crew-state behavior, and require all crew-state tests plus bin/fm-lint.sh to pass. Treat transient status-log fallback while pipeline fix commits move HEAD and a later CI rerun state as out of scope unless diagnosis proves the same cause, and disclose any such connection rather than widening silently.

What Changed

  • Stop crew-state attribution at the newest same-branch run when its head cannot bind to the current worktree, preventing older terminal runs from becoming current.
  • Suppress stale terminal status-log fallbacks for unbound runs while preserving established nonterminal fallback behavior for rewritten or locally advanced branches.
  • Document the attribution boundary and add public-interface regressions for newer parked runs superseding older failures and genuinely newest failures remaining failed.

Risk Assessment

✅ Low: The change now preserves newest-unbound-run evidence to block stale terminal history while retaining nonterminal fallback for rewritten branches, with focused public-interface regressions for both boundaries and genuine newest failures.

Testing

All crew-state tests passed. Public-interface evidence demonstrates the base failure, the repaired unattributable verdict, and preservation of genuine newest failures. No separate baseline command was supplied. bin/fm-lint.sh was not rerun because this test phase explicitly prohibits linters; the outer lint phase owns that requirement.

Evidence: Crew-state public-interface evidence

COUNTERFACTUAL (base): newer parked run, older failed run and failed status event state: failed · source: run-step · run failed TARGET: same scenario state: unknown · source: none · newest same-branch run head is not attributable TARGET: genuinely newest same-branch run failed state: failed · source: run-step · run failed

COUNTERFACTUAL (base): newer parked run, older failed run and failed status event
state: failed · source: run-step · run failed

TARGET: same scenario
state: unknown · source: none · newest same-branch run head is not attributable

TARGET: genuinely newest same-branch run failed
state: failed · source: run-step · run failed

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • 🚨 bin/fm-crew-state.sh:359 - The required invariant says “a parked or running active run must win over older terminal outcomes,” but this new return 0 discards all knowledge of the newest same-branch run when its head is unresolvable. The no-run path can then emit an older failed: status-log event as current state (lines 570–574), recreating the false failed verdict. The regression masks this by seeding a newer needs-decision: log entry. Preserve a distinct newest-unbound-run result at this attribution boundary so older terminal history cannot become current, while retaining rewritten-branch protection.

🔧 Fix: Preserve unbound runs against stale fallback failures
1 error still open:

  • 🚨 bin/fm-crew-state.sh:563 - The intent requires preserving existing crew-state behavior, but this unconditional sentinel barrier also suppresses valid nonterminal status-log state after a branch rewrite. With the existing rewritten-branch fixture plus a realistic runs row for its historical mismatched head, NEWEST_UNBOUND_RUN=1 and the expected current working: status-log becomes unknown. Retain the sentinel but use it to reject terminal log states such as the stale failed: event, while allowing the established nonterminal fallback for rewritten or locally advanced branches.

🔧 Fix: Preserve nonterminal fallback for unbound rewritten runs
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash tests/fm-crew-state.test.sh
  • Ran base bin/fm-crew-state.sh through its public interface with a newer parked/unbindable run, an older failed matching run, and a stale failed status event.
  • Ran target bin/fm-crew-state.sh through its public interface for the same stale-failure scenario and a genuinely newest failed run.
  • Verified the worktree remained clean and temporary fixture helpers were removed.
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@Hozzy02
Hozzy02 merged commit d672493 into main Sep 16, 2026
13 checks passed
@Hozzy02
Hozzy02 deleted the fm/fm-crewstate-stale-run branch September 26, 2026 00:41
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