Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(conversations): disable process-source command when no data exists

Steven Enamakel2e211dfc9fad
diff --git a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx b/app/src/features/conversations/Conversations.processSourceCommand.test.tsx
index c90fb1b1fb..d4b2fad179 100644
--- a/app/src/features/conversations/Conversations.processSourceCommand.test.tsx
+++ b/app/src/features/conversations/Conversations.processSourceCommand.test.tsx
@@ -174,14 +174,14 @@ describe('the agent-process-source command follows the panel that hosts it', ()
registry.reset();
});
- it('is enabled on the assistant-ui surface, which mounts TranscriptOverlays', async () => {
+ it('is disabled when the assistant-ui surface has no process data to show', async () => {
await renderChat('text');
const action = registry.getAction(ACTION_ID);
expect(action, 'the command must be registered on the text composer').toBeDefined();
- expect(action?.enabled?.()).toBe(true);
+ expect(action?.enabled?.()).toBe(false);
// The palette runs it through `runAction`, which re-checks `enabled`.
- expect(registry.runAction(ACTION_ID)).toBe(true);
+ expect(registry.runAction(ACTION_ID)).toBe(false);
});
it('is disabled in mic-cloud voice mode, where nothing renders the panel', async () => {
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index a7d96876ee..7d755b8ae2 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -315,7 +315,17 @@ const Conversations = ({
labelKey: 'conversations.agentTaskInsights.viewProcessSource',
group: 'Chat',
handler: () => setShowProcessSource(true),
- enabled: () => selectedThreadId !== null && composer !== 'mic-cloud',
+ enabled: () => {
+ if (selectedThreadId === null || composer === 'mic-cloud') return false;
+ return (
+ (toolTimelineByThread[selectedThreadId]?.length ?? 0) > 0 ||
+ (processingByThread[selectedThreadId]?.length ?? 0) > 0 ||
+ Object.values(turnTimelinesByThread[selectedThreadId] ?? {}).some(entries => entries.length > 0) ||
+ Object.values(turnTranscriptsByThread[selectedThreadId] ?? {}).some(
+ transcript => transcript.length > 0
+ )
+ );
+ },
keywords: ['agent', 'process', 'source', 'timeline', 'run'],
});
const [inputMode, setInputMode] = useState<InputMode>('text');
@@ -397,10 +407,12 @@ const Conversations = ({
// behaviour stays intact.
const uiLocale = useAppSelector(state => state.locale?.current ?? 'en');
const toolTimelineByThread = useAppSelector(state => state.chatRuntime.toolTimelineByThread);
+ const turnTimelinesByThread = useAppSelector(state => state.chatRuntime.turnTimelinesByThread);
const interruptedAssistantByThread = useAppSelector(
state => state.chatRuntime.interruptedAssistantByThread
);
const processingByThread = useAppSelector(state => state.chatRuntime.processingByThread);
+ const turnTranscriptsByThread = useAppSelector(state => state.chatRuntime.turnTranscriptsByThread);
const inferenceStatusByThread = useAppSelector(
state => state.chatRuntime.inferenceStatusByThread
);
@@ -1827,6 +1839,22 @@ const Conversations = ({
const selectedThreadProcessing = selectedThreadId
? (processingByThread[selectedThreadId] ?? EMPTY_PROCESSING)
: EMPTY_PROCESSING;
+ // The command-palette panel describes the whole selected conversation, not
+ // only a currently streaming turn. Settled trails are stored per-turn, so
+ // combine them with live data here instead of opening an empty panel after a
+ // thread is reloaded.
+ const selectedThreadProcessSourceEntries = selectedThreadId
+ ? [
+ ...Object.values(turnTimelinesByThread[selectedThreadId] ?? {}).flat(),
+ ...selectedThreadToolTimeline,
+ ]
+ : EMPTY_TOOL_TIMELINE;
+ const selectedThreadProcessSourceTranscript = selectedThreadId
+ ? [
+ ...Object.values(turnTranscriptsByThread[selectedThreadId] ?? {}).flat(),
+ ...selectedThreadProcessing,
+ ]
+ : EMPTY_PROCESSING;
// Detached background sub-agents (mode === 'async') spawned in this thread.
// Kept here (in addition to ChatThreadView's own copy) because the header's
// background-processes badge needs the count/status without reaching into
@@ -2728,8 +2756,8 @@ const Conversations = ({
overlay, positioned against the viewport. */}
<TranscriptOverlays
threadId={selectedThreadId ?? null}
- entries={selectedThreadToolTimeline}
- transcript={selectedThreadProcessing}
+ entries={selectedThreadProcessSourceEntries}
+ transcript={selectedThreadProcessSourceTranscript}
backgroundProcesses={backgroundProcesses}
showBackgroundProcesses={showBackgroundProcesses}
onCloseBackgroundProcesses={() => setShowBackgroundProcesses(false)}
diff --git a/app/src/utils/__tests__/toolTimelineFormatting.test.ts b/app/src/utils/__tests__/toolTimelineFormatting.test.ts
index ce5a84995f..a9c6896936 100644
--- a/app/src/utils/__tests__/toolTimelineFormatting.test.ts
+++ b/app/src/utils/__tests__/toolTimelineFormatting.test.ts
@@ -496,7 +496,7 @@ describe('formatter null-safety (malformed / legacy snapshot guard)', () => {
describe('extractAgentSources', () => {
const source = (id: string, url: string): ToolTimelineEntry =>
- entry({ id, name: 'web_fetch', argsBuffer: JSON.stringify({ url }) });
+ entry({ id, name: 'web_fetch', status: 'success', argsBuffer: JSON.stringify({ url }) });
it('surfaces http(s) sources with hostname titles, deduped in first-seen order', () => {
const out = extractAgentSources([
@@ -527,4 +527,17 @@ describe('extractAgentSources', () => {
])
).toEqual([]);
});
+
+ it('does not present an unsuccessful fetch as a visited source', () => {
+ expect(
+ extractAgentSources([
+ entry({
+ id: 'failed',
+ name: 'web_fetch',
+ status: 'error',
+ argsBuffer: JSON.stringify({ url: 'https://unreachable.example.com' }),
+ }),
+ ])
+ ).toEqual([]);
+ });
});
diff --git a/app/src/utils/toolTimelineFormatting.ts b/app/src/utils/toolTimelineFormatting.ts
index 592f7ef7db..5f5bdf0115 100644
--- a/app/src/utils/toolTimelineFormatting.ts
+++ b/app/src/utils/toolTimelineFormatting.ts
@@ -307,7 +307,10 @@ export function formatTimelineEntry(entry: ToolTimelineEntry): { title: string;
// The harness discovery bridge: `tool_call {name, arguments}` runs a deferred
// tool (usually a Composio action the orchestrator found with `tool_search`).
// Label the tool it ran, not the bridge.
- const bridged = entry.name === 'tool_call' ? parsedArgs?.name?.trim() : undefined;
+ const bridged =
+ entry.name === 'tool_call' && typeof parsedArgs?.name === 'string'
+ ? parsedArgs.name.trim()
+ : undefined;
if (bridged && bridged !== 'tool_call') {
return formatTimelineEntry({
...entry,
@@ -506,7 +509,9 @@ export function extractAgentSources(entries: ToolTimelineEntry[]): AgentSource[]
const sources: AgentSource[] = [];
for (const entry of entries) {
const baseName = entry.name.replace(/^subagent:/, '');
- if (!URL_SOURCE_TOOLS.has(baseName)) continue;
+ // An attempted request is not a source. Do not represent a failed,
+ // cancelled, or still-running fetch as a page the agent visited.
+ if (entry.status !== 'success' || !URL_SOURCE_TOOLS.has(baseName)) continue;
const url = parseToolArgs(entry.argsBuffer)?.url?.trim();
// `url` is the raw tool-call argument the model emitted — it is
// prompt-injection-influenceable and not guaranteed to be a real web