fix: identify an agent run by more than the job id the replay withholds

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
hugocasa
2026-09-17 10:51:44 +02:00
co-authored by Claude Opus 5
parent 7e5809acd2
commit 549c6d7907
3 changed files with 23 additions and 3 deletions
@@ -119,6 +119,12 @@
filename?: string | undefined
disableExpand?: boolean
jobId?: string | undefined
/**
* Which run this result belongs to. Separate from `jobId`, which the replay
* page withholds so nothing fetches: the agent views still have to tell one
* run from the next, or a second one continues the first one's fold.
*/
runKey?: string | undefined
workspaceId?: string | undefined
hideAsJson?: boolean
noControls?: boolean
@@ -144,6 +150,7 @@
filename = undefined,
disableExpand = false,
jobId = undefined,
runKey = undefined,
workspaceId = undefined,
hideAsJson = false,
noControls = false,
@@ -764,7 +771,7 @@
{#if isAgentStream(result_stream)}
<!-- An agent streams one JSON event per line, so the raw stream is a wall of
event objects rather than the answer being written. -->
<AgentStreamDisplay raw={result_stream} streamKey={jobId} />
<AgentStreamDisplay raw={result_stream} streamKey={runKey ?? jobId} />
{:else}
<ResultStreamDisplay {result_stream} />
{/if}
@@ -1278,7 +1285,7 @@
{:else if !forceJson && resultKind === 'aiagent'}
{@const agentResult = parseAgentResult(result)}
{#if agentResult}
<AgentResultDisplay result={agentResult} {workspaceId} runKey={jobId}>
<AgentResultDisplay result={agentResult} {workspaceId} runKey={runKey ?? jobId}>
{#snippet structuredOutput(output)}
<DisplayResult
noControls
@@ -13,6 +13,8 @@
loading: boolean
filename?: string | undefined
jobId?: string | undefined
/** Identifies the run, which `jobId` cannot on the replay page. */
runKey?: string | undefined
tag?: string | undefined
workspaceId?: string | undefined
refreshLog?: boolean
@@ -29,6 +31,7 @@
loading,
filename = undefined,
jobId = undefined,
runKey = undefined,
tag = undefined,
workspaceId = undefined,
downloadLogs = true,
@@ -50,7 +53,15 @@
: 'max-h-80'} overflow-auto rounded-md grow min-h-0 border bg-surface-tertiary p-2"
>
{#if result !== undefined || result_stream !== undefined}
<DisplayResult {workspaceId} {jobId} {filename} {result} {result_stream} growVertical />
<DisplayResult
{workspaceId}
{jobId}
{runKey}
{filename}
{result}
{result_stream}
growVertical
/>
{:else if loading}
<Loader2 class="animate-spin" />
{:else}
@@ -2120,6 +2120,7 @@
tagLabel={customUi?.tagLabel}
workspaceId={isReplay ? undefined : job?.workspace_id}
jobId={isReplay ? undefined : job?.id}
runKey={job?.id}
filename={job.id}
loading={job['running']}
tag={job?.tag}
@@ -2226,6 +2227,7 @@
tagLabel={customUi?.tagLabel}
workspaceId={isReplay ? undefined : job?.workspace_id}
jobId={isReplay ? undefined : node.job_id}
runKey={node.job_id}
loading={node.type != 'Success' && node.type != 'Failure'}
waitingForExecutor={node.type == 'WaitingForExecutor'}
refreshLog={node.type == 'InProgress'}