Skip to content

fix(kanban): reliably route closed issues (close-time race + reconcile backstop) - #99

Merged
LukasWodka merged 3 commits into
developfrom
fix/kanban-closure-routing-reliability
Jul 28, 2026
Merged

fix(kanban): reliably route closed issues (close-time race + reconcile backstop)#99
LukasWodka merged 3 commits into
developfrom
fix/kanban-closure-routing-reliability

Conversation

@LukasWodka

@LukasWodkaLukasWodka commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Root cause (investigated)

The closure-router fires on every issue close and runs green, but no-ops for completed issues: it looked up the closing PR via closedByPullRequestsReferences, which is eventually-consistent and empty at the instant of the close event. So it hit the "no closing PR → leave Status unchanged" branch and completed issues piled up in their pre-close column (~30 found in the board sweep).

Proof — backend#979 close-run log: Routing decision: status=(unchanged), yet its timeline ClosedEvent.closer = PR #1289→develop was present at run time; closedByPullRequestsReferences was empty.

Fix 1 — router reads the authoritative signal

Switch the lookup to timelineItems(CLOSED_EVENT).closer — the event that triggered the run, present immediately. It cleanly distinguishes:

  • PullRequest closer → mirror its base (develop→On dev, staging→FR on staging, main/master→Prod)
  • Commit closer (direct Closes #N push) → On dev
  • no closer (manual close) → leave unchanged (→ reconcile terminalizes)

Fix 2 — reconcile backstops the rest

The weekly reconcile never swept closed issues stuck in non-terminal columns (only open ones). New category 5: any CLOSED issue in a non-terminal column → routed by state_reason (not_planned/duplicate→Cancelled, else→Prod). Pull widened to Ready/North Stars so none hide. This self-heals the hand-closed case + any residual race.

Safe because the fr-gate rework (#90) now attributes promotions via commits→PRs, so a card parked in Prod can no longer satisfy the gate — which is why the router was conservative before.

Test plan

  • actionlint clean on both files.
  • Router logic traced against backend#979's real timeline (closer PR #1289→develop → On dev).
  • Reconcile MAX_MOVES=100 cap unchanged; first run post-merge finds ~0 (board already reconciled manually this session).

Fixes the recurring closed-issue clutter surfaced in the RFC-0008 board sweep.


Note

Medium Risk
Changes kanban Status for closed issues (including bulk Prod moves in reconcile); mitigated by fr-gate no longer trusting card column alone and existing MAX_MOVES caps.

Overview
Fixes completed issues staying in pre-close kanban columns because the closure router queried closedByPullRequestsReferences, which is empty when the close webhook runs.

Closure router now reads the latest ClosedEvent.closer from the issue timeline: PR closers mirror base branch status; commit closers (Closes #N pushes) go to On dev; manual closes still leave Status unchanged (reconcile handles them).

Weekly reconcile adds closed-issue terminalize: any CLOSED issue in a non-terminal column moves to Cancelled (NOT_PLANNED / DUPLICATE) or Prod (completed/unspecified). The board pull includes Ready and North Stars so stranded closed issues are swept; open issues in planning columns are explicitly left alone.

Reviewed by Cursor Bugbot for commit fb2b372. Bugbot is set up for automated code reviews on this repo. Configure here.

LukasWodkaand others added 2 commits July 28, 2026 14:02
…osedByPullRequestsReferences
closedByPullRequestsReferences is eventually-consistent and EMPTY at the instant
the issues:closed event fires, so the router missed the closing PR and no-oped —
completed issues stayed stuck in their pre-close column (confirmed on backend#979:
timeline had closer PR #1289->develop, closedByPullRequestsReferences empty).
Read timelineItems(CLOSED_EVENT).closer instead — present immediately, and it
distinguishes a PR closer (mirror base), a Commit closer (On dev), and a manual
close (leave to reconcile).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…inal columns
Adds category 5: any CLOSED issue in a non-terminal column is routed by
state_reason (not_planned/duplicate -> Cancelled, else -> Prod). Backstops the
closure-router's close-time race and the hand-closed case that it deliberately
leaves. Widens the pull to the planning columns (Ready/North Stars) so no closed
issue hides. Safe now that fr-gate attributes via commits->PRs (a card in Prod
can't satisfy the gate).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodkaLukasWodka self-assigned this Jul 28, 2026
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

bugbot run

Comment thread.github/workflows/kanban-closure-router.yml
…open+reclose)
Take the most recent ClosedEvent unconditionally instead of filtering to non-null
closers; otherwise a reopen followed by a manual re-close reused the stale PR/commit
closer instead of treating the current close as manual.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@LukasWodka

Copy link
Copy Markdown
ContributorAuthor

bugbot run

@LukasWodka
LukasWodka merged commit 08d1411 into developJul 28, 2026
2 checks passed
@LukasWodka
LukasWodka deleted the fix/kanban-closure-routing-reliability branch July 28, 2026 12:16

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit fb2b372. Configure here.

Sign up for freeto 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

@LukasWodka