diff --git a/docs/openclawcode/run-json-contract.md b/docs/openclawcode/run-json-contract.md index 6d2e66dc47..6fb81c55dd 100644 --- a/docs/openclawcode/run-json-contract.md +++ b/docs/openclawcode/run-json-contract.md @@ -79,6 +79,7 @@ those nested objects. - `failureDiagnostics` - `failureDiagnosticsSummary` +- `failureDiagnosticUsageTotal` ### Suitability Signals diff --git a/src/commands/openclawcode.test.ts b/src/commands/openclawcode.test.ts index 56a34d33e8..5a3f2dc367 100644 --- a/src/commands/openclawcode.test.ts +++ b/src/commands/openclawcode.test.ts @@ -856,6 +856,7 @@ describe("openclawCodeRunCommand", () => { expect(payload.historyEntryCount).toBeNull(); expect(payload.failureDiagnostics).toBeNull(); expect(payload.failureDiagnosticsSummary).toBeNull(); + expect(payload.failureDiagnosticUsageTotal).toBeNull(); }); it("prints failure diagnostics when a failed workflow recorded provider metadata", async () => { @@ -886,6 +887,7 @@ describe("openclawCodeRunCommand", () => { const payload = JSON.parse(runtime.log.mock.calls[0]?.[0] ?? "null"); expect(payload.failureDiagnosticsSummary).toBe("HTTP 400: Internal server error"); + expect(payload.failureDiagnosticUsageTotal).toBe(0); expect(payload.failureDiagnostics).toEqual({ summary: "HTTP 400: Internal server error", provider: "crs", diff --git a/src/commands/openclawcode.ts b/src/commands/openclawcode.ts index a6972ec8e0..27d9663acb 100644 --- a/src/commands/openclawcode.ts +++ b/src/commands/openclawcode.ts @@ -406,6 +406,7 @@ function toWorkflowRunJson(run: WorkflowRun) { noteCount: run.buildResult?.notes.length ?? null, failureDiagnostics: run.failureDiagnostics ?? null, failureDiagnosticsSummary: run.failureDiagnostics?.summary ?? null, + failureDiagnosticUsageTotal: run.failureDiagnostics?.lastCallUsageTotal ?? null, suitabilityDecision: run.suitability?.decision ?? null, suitabilitySummary: run.suitability?.summary ?? null, suitabilityReasons: run.suitability?.reasons ?? null,