Skip to content

feat(pr-metrics): Capture branch_name in CodingAgentResult for delegated agents#117402

Merged
giovanni-guidini merged 1 commit into
masterfrom
gio/send-delegated-agent-branch-to-seer
Jun 12, 2026
Merged

feat(pr-metrics): Capture branch_name in CodingAgentResult for delegated agents#117402
giovanni-guidini merged 1 commit into
masterfrom
gio/send-delegated-agent-branch-to-seer

Conversation

@giovanni-guidini

@giovanni-guidini giovanni-guidini commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Adds branch_name to CodingAgentResult and wires it in for both Claude Code and GitHub Copilot during the polling phase, so the branch the agent created is shipped to Seer alongside pr_url in state updates.

Why: branch_name was never captured anywhere in this system — not in Sentry, not in Seer. It's a useful signal for matching delegated-agent sessions to GitHub PR webhooks (see CW-1485)

What changed:

  • CodingAgentResult gains branch_name: str | None = None
  • Claude Code: extract_result_from_events now captures the branch name from the regex group in tree URLs (/tree/<branch>), which is what the agent returns when auto_create_pr=False
  • GitHub Copilot: polling now reads head_ref from branch-type artifacts in the task status response, which were already returned by the API but silently ignored

No status or state transitions are affected — this only adds data to the payload already being sent.

Refs CW-1485


On the seer side, CodingAgentResult already includes the branch_name.

…ted agents

Add branch_name field to CodingAgentResult so the branch the agent
created is shipped to Seer alongside the pr_url during state updates.

For Claude Code: extract the branch name from the tree URL the agent
returns (https://github.com/owner/repo/tree/<branch>) in addition to
the existing URL extraction, and populate result.branch_name.

For GitHub Copilot: read head_ref from branch-type artifacts returned
by the task status API alongside the existing PR artifact lookup.

Refs CW-1485
Co-Authored-By: Claude <noreply@anthropic.com>
@linear-code

linear-code Bot commented Jun 11, 2026

Copy link
Copy Markdown

CW-1485

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 11, 2026
@giovanni-guidini giovanni-guidini marked this pull request as ready for review June 11, 2026 10:26
@giovanni-guidini giovanni-guidini requested a review from a team as a code owner June 11, 2026 10:26
@giovanni-guidini giovanni-guidini requested a review from vaind June 11, 2026 10:26
@giovanni-guidini giovanni-guidini merged commit 81377e9 into master Jun 12, 2026
72 checks passed
@giovanni-guidini giovanni-guidini deleted the gio/send-delegated-agent-branch-to-seer branch June 12, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants