Skip to content

Add closed session status on GitHub issue closure#269

Merged
nicobistolfi merged 2 commits intomainfrom
vigilante/issue-263-add-a-closed-session-status-that-is-set-only-after-github-issue-closure-finalizes-the-session
Mar 20, 2026
Merged

Add closed session status on GitHub issue closure#269
nicobistolfi merged 2 commits intomainfrom
vigilante/issue-263-add-a-closed-session-status-that-is-set-only-after-github-issue-closure-finalizes-the-session

Conversation

@nicobistolfi
Copy link
Copy Markdown
Collaborator

@nicobistolfi nicobistolfi commented Mar 20, 2026

Summary

  • Add SessionStatusClosed to the session status enum as a distinct terminal state that means "successful work + GitHub issue closed + finalization complete"
  • Transition successful sessions to closed automatically in cleanupClosedIssueSessions only after cleanup succeeds and the GitHub issue is detected as closed
  • Update all status consumers (grouping, labels, telemetry, iteration support) to handle closed explicitly
  • PR merge alone does not trigger the closed transition; cleanup failure leaves the session as success
  • Skip closed sessions in processGitHubCleanupRequests to avoid unnecessary GitHub API calls for comment polling on finalized sessions

Test plan

  • go vet ./... passes
  • go test ./... passes (all 17 packages)
  • New test: TestSessionStatusClosedRoundTrips — enum serializes/deserializes correctly in sessions.json
  • New test: TestGroupSessionsClosedInCompletedGroup — closed sessions appear in the "Completed / failed" status group
  • Existing test updated: TestScanOnceCleansUpClosedIssueSession — now asserts status transitions to closed
  • New test: TestScanOnceKeepsSuccessStatusForOpenIssue — success session stays success while issue is open
  • New test: TestScanOnceDoesNotMarkClosedOnCleanupFailure — cleanup failure does not falsely mark closed
  • New test: TestScanOncePRMergeAloneDoesNotTransitionToClosed — merged PR with open issue stays success
  • New test: TestScanOnceSkipsClosedSessionsForCleanupCommentPolling — closed sessions are not polled for cleanup comments

Closes #263

🤖 Generated with Claude Code

…es session

Introduce SessionStatusClosed as a distinct terminal state that records
when a successful session has been fully finalized because its GitHub
issue was closed. The transition happens automatically in
cleanupClosedIssueSessions after cleanup succeeds — PR merge alone
does not trigger it, and cleanup failure leaves the session as success.

Status consumers (groupSessions, desiredSessionLabels, telemetry,
sessionSupportsIteration) handle the new status explicitly so closed
sessions appear in the completed group, get the done label, emit a
closed transition event, and are excluded from iteration.

Closes #263

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Closed sessions are fully finalized and should not trigger GitHub API
calls for comment polling. processGitHubCleanupRequests was the only
scan function that iterated all sessions without a status filter,
causing unnecessary API calls for closed sessions on every scan cycle.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@nicobistolfi nicobistolfi merged commit bef0ae8 into main Mar 20, 2026
1 check passed
@nicobistolfi nicobistolfi deleted the vigilante/issue-263-add-a-closed-session-status-that-is-set-only-after-github-issue-closure-finalizes-the-session branch March 20, 2026 17:27
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.

Add a closed session status that is set only after GitHub issue closure finalizes the session

1 participant