fix: compact terminal codex steer rejection
This commit is contained in:
@@ -200,6 +200,45 @@ export function runCodeQueueCliSteerContract(): JsonRecord {
|
||||
assertCondition(nestedRecord(exhaustedDiagnostics, ["operatorGuidance"]).rawProxyEquivalentIsFallback === false, "raw proxy equivalent should be diagnostic, not fallback", exhaustedDiagnostics);
|
||||
assertCondition(String(nestedRecord(exhausted, ["commands"]).rawProxy || "").includes("microservice proxy code-queue /api/tasks/direct_task/steer"), "failure should still expose raw proxy diagnostic command", exhausted);
|
||||
|
||||
const terminalPrompt = `${"do not leak ".repeat(40)}tail-secret-marker`;
|
||||
const terminalRejection = codexSteerTaskForTest("completed_task", [terminalPrompt], () => ({
|
||||
ok: false,
|
||||
status: 409,
|
||||
body: {
|
||||
ok: false,
|
||||
error: "task does not have an active steerable turn",
|
||||
task: {
|
||||
id: "completed_task",
|
||||
queueId: "default",
|
||||
status: "succeeded",
|
||||
terminalStatus: "completed",
|
||||
currentAttempt: 1,
|
||||
updatedAt: "2026-05-22T00:00:00.000Z",
|
||||
finishedAt: "2026-05-22T00:00:00.000Z",
|
||||
prompt: `${"hidden task prompt ".repeat(60)}tail`,
|
||||
output: [{ seq: 1, text: "noisy raw task output" }],
|
||||
},
|
||||
},
|
||||
})) as JsonRecord;
|
||||
const terminalSteer = nestedRecord(terminalRejection, ["steer"]);
|
||||
assertCondition(terminalRejection.ok === false, "terminal steer rejection should fail", terminalRejection);
|
||||
assertCondition(terminalSteer.reason === "task-already-terminal", "terminal steer rejection should use compact terminal reason", terminalSteer);
|
||||
assertCondition(terminalSteer.status === "succeeded", "terminal steer rejection should expose task status", terminalSteer);
|
||||
assertCondition(terminalSteer.terminalStatus === "completed", "terminal steer rejection should expose terminal status", terminalSteer);
|
||||
assertCondition(terminalSteer.lastUpdate === "2026-05-22T00:00:00.000Z", "terminal steer rejection should expose last update", terminalSteer);
|
||||
assertCondition(terminalSteer.updatedAt === "2026-05-22T00:00:00.000Z", "terminal steer rejection should expose last update time", terminalSteer);
|
||||
assertCondition(terminalSteer.retryable === false, "terminal steer rejection should not be retryable", terminalSteer);
|
||||
const terminalCommands = nestedRecord(terminalRejection, ["commands"]);
|
||||
assertCondition(String(terminalCommands.show || "").includes("codex task completed_task"), "terminal rejection should suggest show command", terminalCommands);
|
||||
assertCondition(String(terminalCommands.read || "").includes("codex read completed_task"), "terminal rejection should suggest read command", terminalCommands);
|
||||
assertCondition(String(terminalCommands.followUpSubmit || "").includes("codex submit --prompt-file <path> --reference-task-id completed_task"), "terminal rejection should suggest follow-up submit pattern", terminalCommands);
|
||||
const terminalJson = JSON.stringify(terminalRejection);
|
||||
assertCondition(!terminalJson.includes("tail-secret-marker"), "terminal rejection must not echo steer prompt", terminalRejection);
|
||||
assertCondition(!terminalJson.includes("hidden task prompt"), "terminal rejection must not echo task prompt", terminalRejection);
|
||||
assertCondition(!terminalJson.includes("noisy raw task output"), "terminal rejection must not echo task output", terminalRejection);
|
||||
assertCondition(!("request" in terminalRejection), "terminal rejection should omit request preview", terminalRejection);
|
||||
assertCondition(!("diagnostics" in terminalRejection), "terminal rejection should omit bulky diagnostics", terminalRejection);
|
||||
|
||||
return {
|
||||
ok: true,
|
||||
checks: [
|
||||
@@ -216,6 +255,7 @@ export function runCodeQueueCliSteerContract(): JsonRecord {
|
||||
"successful steer confirms write without echoing prompt",
|
||||
"steer failure classification is JSON-consumable",
|
||||
"retryable tunnel aborts are retried with bounded diagnostics",
|
||||
"terminal steer rejection is compact and actionable",
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user