diff --git a/docs/openclawcode/run-json-contract.md b/docs/openclawcode/run-json-contract.md index 959c604f0f..a710c78c94 100644 --- a/docs/openclawcode/run-json-contract.md +++ b/docs/openclawcode/run-json-contract.md @@ -309,7 +309,8 @@ those nested objects. - boolean summary fields such as `verificationHasFindings` default to `false` when the corresponding section is absent - derived boolean fields such as `failureDiagnosticBootstrapWarningShown` - default to `false` when the nested diagnostic signal is absent + default to `false` when the nested diagnostic signal is absent and otherwise + mirror the recorded boolean signal - string or timestamp fields use `null` when the underlying value is absent - `failureDiagnostics` uses `null` when no structured workflow failure metadata was recorded for the run diff --git a/src/commands/openclawcode.test.ts b/src/commands/openclawcode.test.ts index 2e149cb240..9770d8541b 100644 --- a/src/commands/openclawcode.test.ts +++ b/src/commands/openclawcode.test.ts @@ -1839,6 +1839,22 @@ describe("openclawCodeRunCommand", () => { expect(payload.failureDiagnosticUsageTotal).toBe(0); }); + it("prints failureDiagnosticBootstrapWarningShown as false when diagnostics omitted bootstrap warnings", async () => { + mocks.runIssueWorkflow.mockResolvedValue( + createRun({ + stage: "failed", + failureDiagnostics: { + summary: "HTTP 400: Internal server error", + }, + }), + ); + + await openclawCodeRunCommand({ issue: "2", repoRoot: "/repo", json: true }, runtime); + + const payload = JSON.parse(runtime.log.mock.calls[0]?.[0] ?? "null"); + expect(payload.failureDiagnosticBootstrapWarningShown).toBe(false); + }); + it("prints failureDiagnosticBootstrapWarningShown as true when diagnostics flagged bootstrap warnings", async () => { mocks.runIssueWorkflow.mockResolvedValue( createRun({ diff --git a/src/commands/openclawcode.ts b/src/commands/openclawcode.ts index 1bc99ff432..ed08f84f4f 100644 --- a/src/commands/openclawcode.ts +++ b/src/commands/openclawcode.ts @@ -1362,7 +1362,10 @@ function toWorkflowRunJson(run: WorkflowRun) { failureDiagnosticSkillCount: run.failureDiagnostics?.skillCount ?? null, failureDiagnosticInjectedWorkspaceFileCount: run.failureDiagnostics?.injectedWorkspaceFileCount ?? null, - failureDiagnosticBootstrapWarningShown: run.failureDiagnostics?.bootstrapWarningShown ?? false, + failureDiagnosticBootstrapWarningShown: + run.failureDiagnostics != null + ? Boolean(run.failureDiagnostics.bootstrapWarningShown) + : false, failureDiagnosticToolCount: run.failureDiagnostics?.toolCount ?? null, failureDiagnosticUsageTotal: run.failureDiagnostics?.lastCallUsageTotal ?? null, blueprintContext: run.blueprintContext ?? null,