anthropics / anthropics/claude-code
Cached prState in list_sessions goes stale after a PR merges
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 147k
- Forks
- 24k
- PR merge metrics
- PR metrics pending
Description
Description
A session's list_sessions entry reported prState: "OPEN" for PR #375 in a project, but the PR was actually MERGED on GitHub at the time (confirmed live via gh pr view 375 --json state, which returned "state":"MERGED").
This looks like the same class of issue as #95723 (stale worktreePath/worktreeName after a worktree is removed) — session-list metadata that isn't refreshed/invalidated when the underlying GitHub state changes. Filing separately per request in that issue's thread, since the fix path may differ even if the root cause (a cache that doesn't get invalidated on external state changes) turns out to be shared.
Impact
Low severity — no data loss, just a misleading status shown in list_sessions/get_session. Could cause confusion (e.g. thinking a PR still needs review/merging when it's already landed) or make automated tooling built on top of this data draw the wrong conclusion.
Repro sketch
- Have a session with an open PR tracked in its metadata (
prNumberset). - Merge that PR on GitHub, outside of any action taken through this session.
- Call
list_sessions(orget_session) for that session later —prStatestill reads"OPEN"instead of"MERGED".
Related
- #95723 — same class of staleness, for
worktreePath/worktreeNameafter worktree removal.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the list_sessions and get_session entry points and trace how prState is read after a PR is merged externally. Reproduce with gh pr view 375 --json state, then verify that session metadata reports MERGED rather than retaining OPEN after the GitHub state changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100