Summary
Clicking a source that is missing, failed, or not ready can show chunks from a different ready source. In the observed staging case, clicking ncc2022-volume-one compressed.pdf led the chunk panel to request and display NVDA Q1 FY27 Earnings Call Transcript.pdf.
Evidence
Recent staging request after the reported click:
2026-07-05 22:31:48 CST
GET /api/sources/demo-financial-nvda-q1-fy27-earnings-call/chunks -> 200
The NVDA demo endpoint returns chunks with source title NVDA Q1 FY27 Earnings Call Transcript.pdf.
Code Path
useWorkspaceSourceWorkflow exposes selectedSourceId: resolvedSelectedSourceId rather than the raw clicked id.
workspaceSourceState.getResolvedSelectedSourceId(...) falls back to getFirstReadySourceId(sources) when the selected source is not found or not ready.
route-listing.ts orders visible demo sources before workspace sources, so a ready demo source can become the fallback.
Expected Behavior
Clicking a non-ready, failed, or stale source should keep the user focused on that source and show its processing/error/unavailable state. It should not silently select another source and display unrelated chunks.
Suggested Fix
Separate raw selected source id from resolved queryable chunk source id, or make source resolution return an explicit unavailable state instead of falling back to the first ready source for direct user selection.
Verification
Add a client state/hook test: when selectedSourceId points to a non-ready source and other ready demo sources exist, the selected source title remains the clicked source and no unrelated demo chunk request is made.
Summary
Clicking a source that is missing, failed, or not ready can show chunks from a different ready source. In the observed staging case, clicking
ncc2022-volume-one compressed.pdfled the chunk panel to request and displayNVDA Q1 FY27 Earnings Call Transcript.pdf.Evidence
Recent staging request after the reported click:
The NVDA demo endpoint returns chunks with source title
NVDA Q1 FY27 Earnings Call Transcript.pdf.Code Path
useWorkspaceSourceWorkflowexposesselectedSourceId: resolvedSelectedSourceIdrather than the raw clicked id.workspaceSourceState.getResolvedSelectedSourceId(...)falls back togetFirstReadySourceId(sources)when the selected source is not found or not ready.route-listing.tsorders visible demo sources before workspace sources, so a ready demo source can become the fallback.Expected Behavior
Clicking a non-ready, failed, or stale source should keep the user focused on that source and show its processing/error/unavailable state. It should not silently select another source and display unrelated chunks.
Suggested Fix
Separate raw selected source id from resolved queryable chunk source id, or make source resolution return an explicit unavailable state instead of falling back to the first ready source for direct user selection.
Verification
Add a client state/hook test: when
selectedSourceIdpoints to a non-ready source and other ready demo sources exist, the selected source title remains the clicked source and no unrelated demo chunk request is made.