Skip to content

Comments

fix: reconcile session status with live PR state#95

Open
AgentWrapper wants to merge 2 commits intomainfrom
fix/pr-status-reconciliation
Open

fix: reconcile session status with live PR state#95
AgentWrapper wants to merge 2 commits intomainfrom
fix/pr-status-reconciliation

Conversation

@AgentWrapper
Copy link
Collaborator

Summary

  • Dashboard showed contradictory PR status: "PR Open" in session header while "Merged" in PR details card
  • Root cause: session.status comes from stale metadata (pr_open) while pr.state is fetched live from GitHub API (merged) — nothing reconciled them
  • Added reconcileSessionStatus() that updates session.status based on live pr.state after SCM enrichment, called in all 3 data paths (SSR page, API list, API detail)

Test plan

  • 10 new tests in serialize.test.ts covering all reconciliation scenarios (merged, closed, stale statuses, terminal statuses, no PR, full pipeline)
  • 2 new tests in get-attention-level.test.ts verifying attention level is "done" when PR is merged regardless of stale session status
  • All 81 relevant tests pass, build/lint/typecheck clean

🤖 Generated with Claude Code

When a PR is merged on GitHub, the session metadata file still shows
the old status (e.g. "pr_open"). The dashboard fetches live PR state
from GitHub API (correctly showing "merged") but never updates the
session status, causing contradictory displays: "PR Open" in the
session header while "Merged" appears in the PR details card.

Add reconcileSessionStatus() that updates session.status based on
live pr.state after SCM enrichment. Called in all 3 data paths:
SSR page, API list endpoint, and API detail endpoint.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

The test "returns done when PR is merged even if session status is stale
(pr_open)" was using status: "merged" instead of status: "pr_open",
making it a duplicate of the existing test. Fixed to use the stale
status and removed the redundant second test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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