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
- Spawn session with agent
- Agent raises a PR and completes work
- Open Session Inspector > Summary tab
- Expected: Summary shows PR number/state/CI/mergeability/review; Board shows PR badge; /prs page lists the session
- 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:
- 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."
- 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.
- 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:
- 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).
- Set
pullRequest: prs[0] ? { number: prs[0].number, state: prs[0].state } : undefined on each mapped session object.
- Skip the PR fetch for
isTerminated sessions to avoid wasted calls on archived/dead sessions.
- 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)
Summary
Session Inspector Summary tab shows outdated information after agent completes work:
Reported by: Aditi Chauhan | Session: agent-orchestrator-2, PR #278 created but not reflected in UI
Analyzed against:
96d1649Confidence: High
Reproduction
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 buildsWorkspaceSessionobjects isuseWorkspaceQuery.ts, and it maps session fields manually without ever settingpullRequest.Three places in the frontend read this dead field:
const hasPr = Boolean(session.pullRequest);gates whether the PR facts query runs. Sincesession.pullRequestis always undefined,hasPris always false, the query never runs, and the summary always shows "No pull request opened yet."{session.pullRequest ? \PR #${session.pullRequest.number} · ${session.pullRequest.state}` : "no PR yet"}` for the kanban card PR badge. Same dead field, same problem.Boolean(s.pullRequest), so the entire /prs page is always empty since nothing ever populates the field.The backend already has the data: the
prtable stores each session's PR, andGET /api/v1/sessions/{sessionId}/prreturns it correctly. The issue is purely that the frontend's session mapping never fetches/attaches this data.Fix
Populate
session.pullRequestcentrally inuseWorkspaceQuery.ts'sfetchWorkspaces()mapping function. Since this is the single source of truth for both project and session data (there is no separateuseProjectsQueryor per-project fetching path), fixing it here automatically propagates to all three broken call sites:fetchWorkspaces(), after fetchingprojectsDataandsessionsData, fetch PR facts for each non-terminated session in parallel viaapiClient.GET(\"/api/v1/sessions/{sessionId}/pr\")(the same callSessionInspector.tsxalready makes for enriched PR details).pullRequest: prs[0] ? { number: prs[0].number, state: prs[0].state } : undefinedon each mapped session object.isTerminatedsessions to avoid wasted calls on archived/dead sessions.undefined) rather than failing the whole workspace query.No changes needed elsewhere:
SessionsBoard.tsxandPullRequestsPage.tsxalready readsession.pullRequestcorrectly — they will start rendering real data once the field is populated.SessionInspector.tsx'sSummaryViewkeeps its own richeruseQuerycall for the same/prendpoint (it needsci/mergeability/reviewfields) — but itshasPrgate will now evaluate correctly since the field is finally populated, so the enriched query will actually run.Impact
useWorkspaceQueryis the only session-list builder for both workspace and projects views)