fix: improve observability code agent diagnosis
This commit is contained in:
@@ -41,7 +41,7 @@ export function observabilityHelp(): Record<string, unknown> {
|
||||
"bun scripts/cli.ts platform-infra observability search --target D518 --grep 'no rollout found' [--lookback-minutes 360] [--candidate-limit 80] [--limit 20] [--full|--raw]",
|
||||
"bun scripts/cli.ts platform-infra observability search --target D518 --path /v1/workbench/sessions --status 502 [--lookback-minutes 120] [--full|--raw]",
|
||||
"bun scripts/cli.ts platform-infra observability diagnose-code-agent --target D518 --business-trace-id <trc_...> [--full|--raw]",
|
||||
"bun scripts/cli.ts platform-infra observability diagnose-code-agent --target D518 --run-id <run_...> [--command-id <cmd_...>] [--runner-job-id <rjob_...>] [--full|--raw]",
|
||||
"bun scripts/cli.ts platform-infra observability diagnose-code-agent --target D518 --run-id <run_...> [--command-id <cmd_...>] [--session-id <ses_...>] [--runner-job-id <rjob_...>] [--full|--raw]",
|
||||
],
|
||||
boundary: "Prometheus remains the metrics source; this command owns only platform-infra OTel Collector, trace backend readiness, and trace lookup.",
|
||||
};
|
||||
@@ -222,6 +222,7 @@ export function parseDiagnoseCodeAgentOptions(args: string[]): DiagnoseCodeAgent
|
||||
let traceId: string | null = null;
|
||||
let runId: string | null = null;
|
||||
let commandId: string | null = null;
|
||||
let sessionId: string | null = null;
|
||||
let runnerJobId: string | null = null;
|
||||
let limit = 40;
|
||||
let candidateLimit = 300;
|
||||
@@ -252,6 +253,12 @@ export function parseDiagnoseCodeAgentOptions(args: string[]): DiagnoseCodeAgent
|
||||
if (!/^cmd_[A-Za-z0-9_-]+$/u.test(value)) throw new Error(`${arg} must look like cmd_<id>`);
|
||||
commandId = value;
|
||||
index += 1;
|
||||
} else if (arg === "--session-id" || arg === "--session") {
|
||||
const value = args[index + 1];
|
||||
if (value === undefined || value.startsWith("--")) throw new Error(`${arg} requires a value`);
|
||||
if (!/^ses_[A-Za-z0-9_-]+$/u.test(value)) throw new Error(`${arg} must look like ses_<id>`);
|
||||
sessionId = value;
|
||||
index += 1;
|
||||
} else if (arg === "--runner-job-id" || arg === "--runner-job" || arg === "--runnerjob") {
|
||||
const value = args[index + 1];
|
||||
if (value === undefined || value.startsWith("--")) throw new Error(`${arg} requires a value`);
|
||||
@@ -290,5 +297,5 @@ export function parseDiagnoseCodeAgentOptions(args: string[]): DiagnoseCodeAgent
|
||||
if (businessTraceId === null && traceId === null && runId === null && commandId === null && runnerJobId === null) {
|
||||
throw new Error("observability diagnose-code-agent requires --business-trace-id <trc_...>, --trace-id <otelTraceId>, --run-id <run_...>, --command-id <cmd_...>, or --runner-job-id <rjob_...>");
|
||||
}
|
||||
return { ...parseCommonOptions(commonArgs), businessTraceId, traceId, runId, commandId, runnerJobId, limit, candidateLimit, lookbackMinutes };
|
||||
return { ...parseCommonOptions(commonArgs), businessTraceId, traceId, runId, commandId, sessionId, runnerJobId, limit, candidateLimit, lookbackMinutes };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user