Skip to content

bug: session inspector in summary section doesn't show PR details even though its been raised #251

@neversettle17-101

Description

@neversettle17-101

Summary

Session Inspector Summary tab shows outdated information after agent completes work:

  • PR section: Shows "No pull request opened yet" even though PR was created
  • Board (projects view) kanban card: Shows "no PR yet" instead of PR number/state
  • /prs page: Always empty, never shows any sessions with PRs

Reported by: Aditi Chauhan | Session: agent-orchestrator-2, PR #278 created but not reflected in UI
Analyzed against: 96d1649
Confidence: High

Reproduction

  1. Spawn session with agent
  2. Agent raises a PR and completes work
  3. Open Session Inspector > Summary tab
  4. Expected: Summary shows PR number/state/CI/mergeability/review; Board shows PR badge; /prs page lists the session
  5. Actual: Summary shows "No pull request opened yet"; Board shows "no PR yet"; /prs page is empty

Root Cause

WorkspaceSession.pullRequest (frontend/src/renderer/types/workspace.ts) is declared as an optional field (pullRequest?: { number, state }) but never populated anywhere in the codebase. The only place that builds WorkspaceSession objects is useWorkspaceQuery.ts, and it maps session fields manually without ever setting pullRequest.

Three places in the frontend read this dead field:

  1. SessionInspector.tsx (SummaryView, line 121)const hasPr = Boolean(session.pullRequest); gates whether the PR facts query runs. Since session.pullRequest is always undefined, hasPr is always false, the query never runs, and the summary always shows "No pull request opened yet."
  2. SessionsBoard.tsx (SessionCard, line 223){session.pullRequest ? \PR #${session.pullRequest.number} · ${session.pullRequest.state}` : "no PR yet"}` for the kanban card PR badge. Same dead field, same problem.
  3. PullRequestsPage.tsx (line ~41) — filters sessions by Boolean(s.pullRequest), so the entire /prs page is always empty since nothing ever populates the field.

The backend already has the data: the pr table stores each session's PR, and GET /api/v1/sessions/{sessionId}/pr returns it correctly. The issue is purely that the frontend's session mapping never fetches/attaches this data.

Fix

Populate session.pullRequest centrally in useWorkspaceQuery.ts's fetchWorkspaces() mapping function. Since this is the single source of truth for both project and session data (there is no separate useProjectsQuery or per-project fetching path), fixing it here automatically propagates to all three broken call sites:

  1. In fetchWorkspaces(), after fetching projectsData and sessionsData, fetch PR facts for each non-terminated session in parallel via apiClient.GET(\"/api/v1/sessions/{sessionId}/pr\") (the same call SessionInspector.tsx already makes for enriched PR details).
  2. Set pullRequest: prs[0] ? { number: prs[0].number, state: prs[0].state } : undefined on each mapped session object.
  3. Skip the PR fetch for isTerminated sessions to avoid wasted calls on archived/dead sessions.
  4. On per-session fetch error, treat it like "no PR" (undefined) rather than failing the whole workspace query.

No changes needed elsewhere:

  • SessionsBoard.tsx and PullRequestsPage.tsx already read session.pullRequest correctly — they will start rendering real data once the field is populated.
  • SessionInspector.tsx's SummaryView keeps its own richer useQuery call for the same /pr endpoint (it needs ci/mergeability/review fields) — but its hasPr gate will now evaluate correctly since the field is finally populated, so the enriched query will actually run.

Impact

  • PR information flows correctly from backend to frontend without adding new APIs or embedding data in the session response
  • All three broken UX locations (Summary tab, Board kanban badge, /prs page) will show correct PR state once fixed
  • Single fix point propagates everywhere (confirmed: useWorkspaceQuery is the only session-list builder for both workspace and projects views)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions