fix: guide minimax away from sed patch fallbacks

This commit is contained in:
Codex
2026-06-03 13:27:59 +00:00
parent 67a0446e51
commit a264626472
2 changed files with 177 additions and 6 deletions
@@ -1037,6 +1037,70 @@ export async function runSshArgvGuidanceContract(): Promise<JsonRecord> {
failedCompoundVisibleV2.stderr,
);
const missingPlusLargeInsertVisibleV2 = await applyPatchV2FixtureAttempt([
"*** Begin Patch",
"*** Update File: access-control.test.ts",
"@@",
" });",
"",
" test(\"cloud api accepts read-only workspace.build / debug.download sub-actions without --reason\", async () => {",
" const receivedJobs = [];",
" const executor = createServer(async (request, response) => {",
" const body = await requestJson(request);",
" receivedJobs.push({ url: request.url, body });",
" response.writeHead(200, { \"content-type\": \"application/json; charset=utf-8\" });",
" response.end(JSON.stringify({ accepted: true, status: \"completed\" }));",
" });",
" });",
"",
" test(\"cloud api routes device-pod probe GET requests through executor jobs\", async () => {",
"*** End Patch",
"",
].join("\n"), {
"access-control.test.ts": [
"test(\"cloud api bounds device-pod job output payloads\", async () => {",
"});",
"",
"test(\"cloud api routes device-pod probe GET requests through executor jobs\", async () => {",
"});",
"",
].join("\n"),
}, { stderrOutput: true });
assertCondition(missingPlusLargeInsertVisibleV2.exitCode === 1 && missingPlusLargeInsertVisibleV2.error === null, "v2 should still reject unsafe large insertion hunks whose added lines are missing + prefixes", missingPlusLargeInsertVisibleV2);
assertCondition(
missingPlusLargeInsertVisibleV2.stderr.includes("First expected line appears near target line(s): 2, 5")
&& missingPlusLargeInsertVisibleV2.stderr.includes("Best partial context match: 2 expected line(s) matched")
&& missingPlusLargeInsertVisibleV2.stderr.includes("large insertion whose new lines were written as context")
&& missingPlusLargeInsertVisibleV2.stderr.includes("regenerate the patch instead of editing it with sed"),
"v2 missing-plus failure should diagnose the MiniMax sed-regression pattern explicitly",
missingPlusLargeInsertVisibleV2.stderr,
);
const nestedEnvelopeV2 = await applyPatchV2FixtureAttempt([
"*** Begin Patch",
"*** Update File: nested-envelope.txt",
"@@",
" alpha",
"*** End Patch",
"*** Begin Patch",
"*** Update File: nested-envelope.txt",
"@@",
"-beta",
"+BETA",
"*** End Patch",
"",
].join("\n"), {
"nested-envelope.txt": "alpha\nbeta\n",
}, { stderrOutput: true });
assertCondition(nestedEnvelopeV2.exitCode === 0 && nestedEnvelopeV2.error === null, "v2 should accept MiniMax-style nested patch envelopes between hunks", nestedEnvelopeV2);
assertCondition(nestedEnvelopeV2.files["nested-envelope.txt"] === "alpha\nBETA\n", "v2 nested-envelope compatibility should still apply the later hunk", nestedEnvelopeV2);
assertCondition(
nestedEnvelopeV2.stderr.includes("ignored nested MiniMax-style End Patch marker")
&& nestedEnvelopeV2.stderr.includes("ignored nested MiniMax-style Begin Patch marker"),
"v2 nested-envelope compatibility should emit canonical envelope hints",
nestedEnvelopeV2.stderr,
);
const addBeforeFailedUpdateV2 = await applyPatchV2FixtureAttempt([
"*** Begin Patch",
"*** Add File: hwpod",