Skip to content

Commit 3d4b45a

Browse files
committed
merge: restore Codex schema admission
* commit '58b43010c9f76684b3694a55d772be11661099ba': fix(review): restore Codex schema admission
2 parents bb69d1f + 58b4301 commit 3d4b45a

4 files changed

Lines changed: 88 additions & 80 deletions

File tree

‎schema/clawsweeper-decision.schema.json‎

Lines changed: 50 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -858,93 +858,63 @@
858858
},
859859
"regressionAssessment": {
860860
"description": "A non-blaming preliminary regression assessment. Do not name a predecessor here; a PR link is published only through independently verified regressionProvenance.",
861-
"oneOf": [
862-
{
863-
"type": "null"
861+
"type": ["object", "null"],
862+
"additionalProperties": false,
863+
"required": ["confidence", "supportingEvidence"],
864+
"properties": {
865+
"confidence": {
866+
"type": "string",
867+
"enum": ["suspected", "probable"]
864868
},
865-
{
866-
"type": "object",
867-
"additionalProperties": false,
868-
"required": ["confidence", "supportingEvidence"],
869-
"properties": {
870-
"confidence": {
871-
"type": "string",
872-
"enum": ["suspected", "probable"]
873-
},
874-
"supportingEvidence": {
875-
"type": "array",
876-
"minItems": 1,
877-
"maxItems": 3,
878-
"uniqueItems": true,
879-
"items": {
880-
"type": "string",
881-
"enum": [
882-
"reproduction",
883-
"reviewed_change",
884-
"failure_trace",
885-
"known_regression_link"
886-
]
887-
}
888-
}
889-
},
890-
"allOf": [
891-
{
892-
"if": {
893-
"properties": { "confidence": { "const": "probable" } }
894-
},
895-
"then": {
896-
"properties": { "supportingEvidence": { "minItems": 2 } }
897-
}
898-
}
899-
]
869+
"supportingEvidence": {
870+
"type": "array",
871+
"minItems": 1,
872+
"maxItems": 3,
873+
"items": {
874+
"type": "string",
875+
"enum": ["reproduction", "reviewed_change", "failure_trace", "known_regression_link"]
876+
}
900877
}
901-
]
878+
}
902879
},
903880
"regressionProvenance": {
904881
"description": "An untrusted candidate predecessor link. The runtime publishes it only after exact GitHub PR metadata and local blame agree on the merge commit; use null unless one exact relevant source line and prior merged PR are known.",
905-
"oneOf": [
906-
{
907-
"type": "null"
882+
"type": ["object", "null"],
883+
"additionalProperties": false,
884+
"required": [
885+
"repo",
886+
"pullRequestNumber",
887+
"pullRequestUrl",
888+
"mergeCommitSha",
889+
"sourcePath",
890+
"sourceLine"
891+
],
892+
"properties": {
893+
"repo": {
894+
"type": "string",
895+
"description": "Target owner/repository only."
908896
},
909-
{
910-
"type": "object",
911-
"additionalProperties": false,
912-
"required": [
913-
"repo",
914-
"pullRequestNumber",
915-
"pullRequestUrl",
916-
"mergeCommitSha",
917-
"sourcePath",
918-
"sourceLine"
919-
],
920-
"properties": {
921-
"repo": {
922-
"type": "string",
923-
"description": "Target owner/repository only."
924-
},
925-
"pullRequestNumber": {
926-
"type": "integer",
927-
"minimum": 1
928-
},
929-
"pullRequestUrl": {
930-
"type": "string",
931-
"description": "Canonical https://github.com/<owner>/<repo>/pull/<number> URL."
932-
},
933-
"mergeCommitSha": {
934-
"type": "string",
935-
"pattern": "^[0-9a-fA-F]{40}$"
936-
},
937-
"sourcePath": {
938-
"type": "string",
939-
"description": "One exact repository-relative tracked source path; no absolute or traversal path."
940-
},
941-
"sourceLine": {
942-
"type": "integer",
943-
"minimum": 1
944-
}
945-
}
897+
"pullRequestNumber": {
898+
"type": "integer",
899+
"minimum": 1
900+
},
901+
"pullRequestUrl": {
902+
"type": "string",
903+
"description": "Canonical https://github.com/<owner>/<repo>/pull/<number> URL."
904+
},
905+
"mergeCommitSha": {
906+
"type": "string",
907+
"pattern": "^[0-9a-fA-F]{40}$"
908+
},
909+
"sourcePath": {
910+
"type": "string",
911+
"description": "One exact repository-relative tracked source path; no absolute or traversal path."
912+
},
913+
"sourceLine": {
914+
"type": "integer",
915+
"minimum": 1
946916
}
947-
]
917+
}
948918
},
949919
"closeComment": {
950920
"type": "string"

‎src/clawsweeper-review-runtime.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ ${extra}
690690
fixedSha: null,
691691
fixedAt: null,
692692
fixedPullRequest: null,
693+
regressionAssessment: null,
693694
regressionProvenance: null,
694695
closeComment: "",
695696
workCandidate: "none",

‎test/codex-review-runner.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,30 @@ import {
2020
} from "../dist/clawsweeper.js";
2121
import { closeDecision, item, tmpPrefix } from "./helpers.ts";
2222

23+
test("Codex decision schema avoids unsupported strict-output keywords recursively", () => {
24+
const schema = JSON.parse(
25+
readFileSync(join(process.cwd(), "schema", "clawsweeper-decision.schema.json"), "utf8"),
26+
) as unknown;
27+
const forbidden = new Set(["oneOf", "allOf", "if", "then", "uniqueItems"]);
28+
const found: string[] = [];
29+
30+
const visit = (value: unknown, path: string): void => {
31+
if (!value || typeof value !== "object") return;
32+
if (Array.isArray(value)) {
33+
value.forEach((entry, index) => visit(entry, `${path}[${index}]`));
34+
return;
35+
}
36+
for (const [key, child] of Object.entries(value)) {
37+
const childPath = `${path}.${key}`;
38+
if (forbidden.has(key)) found.push(childPath);
39+
visit(child, childPath);
40+
}
41+
};
42+
43+
visit(schema, "$");
44+
assert.deepEqual(found, []);
45+
});
46+
2347
test("Codex failure logs distinguish provider throttling from content output failures", () => {
2448
assert.equal(
2549
codexFailureLogKindForTest(
@@ -343,6 +367,7 @@ test("codex failure decisions expose stderr and stdout separately", () => {
343367
decision.evidence.find((entry) => entry.label === "codex stderr")?.detail,
344368
"user\nThe reviewed prompt discusses rate limits.",
345369
);
370+
assert.equal(decision.regressionAssessment, null);
346371
assert.match(
347372
decision.evidence.find((entry) => entry.label === "codex stdout")?.detail ?? "",
348373
/"type":"turn.failed"/,

‎test/decision-parser.test.ts‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,18 @@ test("decision parser accepts non-blaming regression assessments only with norma
440440
),
441441
/decision\.regressionAssessment has insufficient or duplicate supporting evidence/,
442442
);
443+
assert.throws(
444+
() =>
445+
parseDecision(
446+
closeDecision({
447+
regressionAssessment: {
448+
confidence: "probable",
449+
supportingEvidence: ["reproduction", "reproduction"],
450+
},
451+
}),
452+
),
453+
/decision\.regressionAssessment has insufficient or duplicate supporting evidence/,
454+
);
443455
assert.throws(
444456
() =>
445457
parseDecision(

0 commit comments

Comments
 (0)