Skip to content

Commit 1ce11b6

Browse files
jesseturner21claude
andcommitted
fix: increase get-trace query timeout to 60s and add timeout detection
The polling loop only waited 30 seconds and silently fell through to a misleading "No trace data found" error on timeout. Increase to 60s and add an explicit timeout check matching the pattern in list-traces.ts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c5b98d4 commit 1ce11b6

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/cli/operations/traces/get-trace.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,18 @@ export async function getTrace(options: GetTraceOptions): Promise<GetTraceResult
5555

5656
// Poll for results
5757
let traceData: Record<string, string>[] = [];
58+
let queryStatus = 'Running';
5859

59-
for (let i = 0; i < 30; i++) {
60+
for (let i = 0; i < 60; i++) {
6061
await new Promise(resolve => setTimeout(resolve, 1000));
6162

6263
const queryResults = await client.send(new GetQueryResultsCommand({ queryId: startQuery.queryId }));
6364

64-
const status = queryResults.status ?? 'Unknown';
65+
queryStatus = queryResults.status ?? 'Unknown';
6566

66-
if (status === 'Complete' || status === 'Failed' || status === 'Cancelled') {
67-
if (status !== 'Complete') {
68-
return { success: false, error: `Query ${status.toLowerCase()}` };
67+
if (queryStatus === 'Complete' || queryStatus === 'Failed' || queryStatus === 'Cancelled') {
68+
if (queryStatus !== 'Complete') {
69+
return { success: false, error: `Query ${queryStatus.toLowerCase()}` };
6970
}
7071

7172
traceData = (queryResults.results ?? []).map(row => {
@@ -81,6 +82,10 @@ export async function getTrace(options: GetTraceOptions): Promise<GetTraceResult
8182
}
8283
}
8384

85+
if (queryStatus === 'Running') {
86+
return { success: false, error: 'Query timed out after 60 seconds' };
87+
}
88+
8489
if (traceData.length === 0) {
8590
return { success: false, error: `No trace data found for trace ID: ${traceId}` };
8691
}

0 commit comments

Comments
 (0)