Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions .agents/skills/parallels-discord-roundtrip/SKILL.md

This file was deleted.

1 change: 1 addition & 0 deletions docs/openclawcode/run-json-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ those nested objects.
### Change And Scope Signals

- `buildSummary`
- `buildHasSignals`
- `buildSummaryPresent`
- `changedFiles`
- `changedFilesPresent`
Expand Down
40 changes: 40 additions & 0 deletions src/commands/openclawcode.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ describe("openclawCodeRunCommand", () => {
expect(payload.buildAttemptCount).toBe(1);
expect(payload.verificationAttemptCount).toBe(1);
expect(payload.buildSummary).toBe("Updated JSON output");
expect(payload.buildHasSignals).toBe(true);
expect(payload.buildSummaryPresent).toBe(true);
expect(payload.changedFiles).toEqual([
"src/openclawcode/app/run-issue.ts",
Expand Down Expand Up @@ -440,6 +441,44 @@ describe("openclawCodeRunCommand", () => {
);
});

it("treats a boolean build summary as a present build signal in JSON output", async () => {
const run = createRun();
mocks.runIssueWorkflow.mockResolvedValue(
createRun({
buildResult: {
...run.buildResult!,
summary: true as never,
},
}),
);

await openclawCodeRunCommand({ issue: "2", repoRoot: "/repo", json: true }, runtime);

const payload = JSON.parse(runtime.log.mock.calls[0]?.[0] ?? "null");
expect(payload.buildSummary).toBe(true);
expect(payload.buildHasSignals).toBe(true);
expect(payload.buildSummaryPresent).toBe(true);
});

it("treats a non-empty build summary entry list as present build signals in JSON output", async () => {
const run = createRun();
mocks.runIssueWorkflow.mockResolvedValue(
createRun({
buildResult: {
...run.buildResult!,
summary: ["lint", "tests"] as never,
},
}),
);

await openclawCodeRunCommand({ issue: "2", repoRoot: "/repo", json: true }, runtime);

const payload = JSON.parse(runtime.log.mock.calls[0]?.[0] ?? "null");
expect(payload.buildSummary).toEqual(["lint", "tests"]);
expect(payload.buildHasSignals).toBe(true);
expect(payload.buildSummaryPresent).toBe(true);
});

it("prints empty top-level scope fields and blocks auto-merge when workflow data is missing", async () => {
mocks.runIssueWorkflow.mockResolvedValue(
createRun({
Expand All @@ -465,6 +504,7 @@ describe("openclawCodeRunCommand", () => {
expect(payload.buildAttemptCount).toBe(1);
expect(payload.verificationAttemptCount).toBe(1);
expect(payload.buildSummary).toBeNull();
expect(payload.buildHasSignals).toBe(false);
expect(payload.buildSummaryPresent).toBe(false);
expect(payload.changedFiles).toEqual([]);
expect(payload.changedFilesPresent).toBe(false);
Expand Down
19 changes: 18 additions & 1 deletion src/commands/openclawcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,22 @@ function resolveDraftPullRequestDisposition(run: WorkflowRun): {
};
}

function resolveBuildHasSignals(summary: unknown): boolean {
if (summary === true) {
return true;
}
if (typeof summary === "string") {
return summary.trim().length > 0;
}
if (Array.isArray(summary)) {
return summary.length > 0;
}
if (summary != null && typeof summary === "object") {
return Object.keys(summary).length > 0;
}
return false;
}

function resolveChangedFileListStable(run: WorkflowRun): boolean {
const changedFiles = run.buildResult?.changedFiles;
if (changedFiles == null) {
Expand Down Expand Up @@ -1247,7 +1263,8 @@ function toWorkflowRunJson(run: WorkflowRun) {
buildAttemptCount: run.attempts?.building ?? null,
verificationAttemptCount: run.attempts?.verifying ?? null,
buildSummary: run.buildResult?.summary ?? null,
buildSummaryPresent: (run.buildResult?.summary?.length ?? 0) > 0,
buildHasSignals: resolveBuildHasSignals(run.buildResult?.summary),
buildSummaryPresent: resolveBuildHasSignals(run.buildResult?.summary),
changedFiles: run.buildResult?.changedFiles ?? [],
changedFilesPresent: (run.buildResult?.changedFiles.length ?? 0) > 0,
changedFileListStable: resolveChangedFileListStable(run),
Expand Down
Loading