When a Code session opens a pull request on GitHub, or pushes to one, the session remembers it. The session’s row in the rail then shows a PR badge, and Open PR takes you straight to it. This works for local sessions on Desktop and for cloud sessions, on every surface.

How a PR gets linked

Gizzi Code reads the result of each finished step. A PR is linked when the step is one of these: The link must name a real PR number, such as https://github.com/acme/site/pull/42. The “create a pull request” hint that GitHub prints after pushing a new branch (.../pull/new/my-branch) is not a PR, so it is not linked. A PR link that only shows up in a file the agent read, a web page it fetched, or a search result is not linked. gh pr list does not link every PR it lists either. A PR opened by a subagent is linked to the subagent’s session and to the main session that started it, so it shows on the row you see in the rail. Each PR is linked once per session, however many times it comes up.

The PR badge

A session with linked PRs shows a badge on its row with an icon and the number of PRs: Hover over the badge to see the list. Each PR shows its title, its status (Open, Draft, Conflict or Merged), owner/repo #number, and the lines it adds and removes in green and red. Click a PR to open it in your browser.

Open PR

Open PR is in the session row’s ⋯ menu and in the session header’s menu. The shortcut is G. With one linked PR it opens that PR. With several, it shows them in a submenu. The item only appears when the session has a linked PR. See Code session list for the rest of the menu.

How status stays current

Gizzi Code looks up each PR on GitHub:
  1. With the GitHub CLI (gh api) when gh is installed and signed in on the machine that runs the session.
  2. Otherwise with the GitHub REST API, using GITHUB_TOKEN or GH_TOKEN from the runtime’s environment if one is set. Without a token only public repositories can be read.
  3. If neither works, the badge keeps the last status it saw.
A status is reused for 60 seconds before it is checked again, and for 10 minutes once the PR is merged or closed. Checks run in the background. They never hold up the agent’s turn, and the rail updates by itself when a status changes. A PR counts as Merged once GitHub reports a merge, Closed when it was closed without one, and Conflict when GitHub says it can’t be merged cleanly. While GitHub is still working that out, the badge shows the PR as open.

Status and branch graph

Under each PR row in the Changes card, and in the PR badge popover on the rail, a small graph and a status pill show where the PR stands. The line draws in once when the row appears. On iPhone the Code panel shows the same states as a pill with plus and minus counts. In Gizzi Code, /pr prints the merge state first, then the conflict count and lint, types and preview marks. Branch names, commit lists and test pills show only when the server sends them. Today it does not.

For developers

PR links are stored with the session in Gizzi Code’s storage (session_prs/<sessionID>.json) and deleted with the session. Code: cmd/gizzi-code/src/runtime/session/linked-prs.ts (LinkedPRs). The detector runs from Session.updatePart when a tool part completes, off the turn’s path. It is wrapped so a failure is logged and never reaches the tool pipeline. Each linked PR has this shape:
Routes on the Gizzi Code server, with the same auth as the other session routes. Each one also works without the /v1 prefix. When a session’s list or a PR’s status changes, the event stream sends session.prs.updated with { sessionID, prs }. The app’s agent-sessions feed (/v1/agent-sessions/sync) sends it as { type: "session_prs", session_id, prs }, and GET /v1/agent-sessions/:id/prs returns the same { prs }. The TypeScript SDK has sessionPrsList, sessionPrsBulk, sessionPrsRefresh, sessionPrsLink and sessionPrsUnlink, plus the LinkedPr and EventSessionPrsUpdated types.