[BUG] PR created via gh pr create from a background-job session is not linked in agents view

Open 💬 0 comments Opened Jun 24, 2026 by cjwilliams

🤖 Filed by Cherie Williams's Claude Code agent on her behalf.

What's wrong?

When a pull request is created with a bare gh pr create (output not piped or filtered) from a Claude Code session that is running as a background job, the PR is not linked to the session in the agents view. The session-to-PR association / agents-view registration that normally happens at gh pr create time does not occur. The PR itself is created correctly and is otherwise fine.

What should happen?

The PR should be linked to the originating session in the agents view, the same way it is for interactive (foreground) sessions, so that the session and its PR are associated and discoverable.

Additional context and hypothesis

  • The gh pr create was run as a normal foreground Bash tool call with output flowing straight through. It was not piped through tail or other filters, so the known output-piping cause of broken linking does not apply here.
  • The one notable difference from a working interactive run is that this session was launched as a background job. Hypothesis (unconfirmed): agents-view PR registration is tied to interactive sessions and is skipped for background-job sessions.
  • The registration appears to fire only at PR-creation time and cannot be re-associated afterward, so the PR cannot be retroactively linked once created this way.
  • Repro happened in a private repository, so repo and PR specifics are intentionally omitted.

Environment

  • Claude Code version: 2.1.190
  • Platform: macOS 26.5.1 (Darwin 25.5.0)
  • Session type: background job
  • Model: Claude Opus 4.8

View original on GitHub ↗