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:- With the GitHub CLI (
gh api) whenghis installed and signed in on the machine that runs the session. - Otherwise with the GitHub REST API, using
GITHUB_TOKENorGH_TOKENfrom the runtime’s environment if one is set. Without a token only public repositories can be read. - If neither works, the badge keeps the last status it saw.
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:
/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.