fix: 隔离代码代理诊断 trace
This commit is contained in:
@@ -714,6 +714,7 @@ export function renderDiagnoseCodeAgentTable(input: {
|
||||
result: Record<string, unknown>;
|
||||
}): RenderedCliResult {
|
||||
const mapping = asPlainRecord(input.result.mapping);
|
||||
const diagnosticTrace = asPlainRecord(input.result.diagnosticTrace);
|
||||
const identity = asPlainRecord(input.result.identity);
|
||||
const agentrun = asPlainRecord(input.result.agentrun);
|
||||
const agentrunAuthority = asPlainRecord(agentrun?.authority);
|
||||
@@ -774,6 +775,12 @@ export function renderDiagnoseCodeAgentTable(input: {
|
||||
` backendProfile=${textValue(identity?.backendProfile)} sourceCommit=${shortenMiddle(textValue(identity?.sourceCommit), 20)}`,
|
||||
` providerProfile=${textValue(providerDecision?.providerProfile)} model=${textValue(providerDecision?.model)} source=${textValue(providerDecision?.providerProfileSource)} adapter=${textValue(providerDecision?.adapter)} runnerNamespace=${textValue(providerDecision?.runnerNamespace)}`,
|
||||
"",
|
||||
"Diagnostic trace:",
|
||||
` traceId=${textValue(diagnosticTrace?.traceId)} parentSpanId=${textValue(diagnosticTrace?.parentSpanId)} operation=${textValue(diagnosticTrace?.operation)} contextReady=${textValue(diagnosticTrace?.contextReady)}`,
|
||||
` target businessTraceId=${textValue(diagnosticTrace?.targetBusinessTraceId)} commandId=${textValue(diagnosticTrace?.targetCommandId)} expectedLinkTraceId=${textValue(diagnosticTrace?.expectedTargetOtelTraceId)}`,
|
||||
` diagnosticReads=${joinValues(diagnosticTrace?.headerReadPaths, 60)} ordinaryReads=${joinValues(diagnosticTrace?.ordinaryReadPaths, 40)}`,
|
||||
` link=${shortenEnd(textValue(diagnosticTrace?.linkQueryClue), 180)}`,
|
||||
"",
|
||||
"Root causes:",
|
||||
formatTable(["CODE", "CONF", "SUMMARY"], rootRows.length > 0 ? rootRows : [["-", "-", "-"]]),
|
||||
"",
|
||||
@@ -793,6 +800,8 @@ export function renderDiagnoseCodeAgentTable(input: {
|
||||
const next = asPlainRecord(input.result.next);
|
||||
lines.push("", "Next:");
|
||||
const nextCommands = [
|
||||
textValue(diagnosticTrace?.traceCommand),
|
||||
textValue(diagnosticTrace?.targetTraceCommand),
|
||||
textValue(next?.diagnoseFull),
|
||||
textValue(next?.traceSummary),
|
||||
textValue(next?.traceReads),
|
||||
@@ -801,7 +810,7 @@ export function renderDiagnoseCodeAgentTable(input: {
|
||||
textValue(next?.projection),
|
||||
].filter((item) => item !== "-");
|
||||
if (nextCommands.length > 0) {
|
||||
for (const command of nextCommands.slice(0, 6)) lines.push(` ${command}`);
|
||||
for (const command of Array.from(new Set(nextCommands)).slice(0, 6)) lines.push(` ${command}`);
|
||||
} else {
|
||||
lines.push(` ${buildDiagnoseCommand(input.target, input.options, true)}`);
|
||||
if (traceId.length > 0 && traceId !== "-") lines.push(` bun scripts/cli.ts platform-infra observability trace --target ${input.target.id} --trace-id ${traceId}`);
|
||||
|
||||
Reference in New Issue
Block a user