fix: require real progress evidence artifacts
This commit is contained in:
@@ -96,13 +96,36 @@ async function runLongTaskWrapper(workspaceDir: string, ctx: any): Promise<any |
|
||||
}
|
||||
|
||||
function buildProgressEvidence(wrapperResult: any): Record<string, unknown> | null {
|
||||
const candidate = wrapperResult?.progressEvidence;
|
||||
if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const progressEvidence: Record<string, unknown> = {};
|
||||
|
||||
const taskName = typeof wrapperResult?.taskRecord?.task_name === "string"
|
||||
? wrapperResult.taskRecord.task_name.trim()
|
||||
const sessionKey = typeof candidate.sessionKey === "string"
|
||||
? candidate.sessionKey.trim()
|
||||
: "";
|
||||
if (wrapperResult?.silentLaunchOk === true && taskName) {
|
||||
progressEvidence.sessionKey = taskName;
|
||||
if (sessionKey) {
|
||||
progressEvidence.sessionKey = sessionKey;
|
||||
}
|
||||
|
||||
const runId = typeof candidate.runId === "string"
|
||||
? candidate.runId.trim()
|
||||
: "";
|
||||
if (runId) {
|
||||
progressEvidence.runId = runId;
|
||||
}
|
||||
|
||||
if (Array.isArray(candidate.modified_files) && candidate.modified_files.length > 0) {
|
||||
progressEvidence.modified_files = candidate.modified_files;
|
||||
}
|
||||
|
||||
const verificationResult = typeof candidate.verificationResult === "string"
|
||||
? candidate.verificationResult.trim()
|
||||
: "";
|
||||
if (verificationResult) {
|
||||
progressEvidence.verificationResult = verificationResult;
|
||||
}
|
||||
|
||||
return Object.keys(progressEvidence).length > 0 ? progressEvidence : null;
|
||||
@@ -174,9 +197,8 @@ function buildGateLockInput(wrapperResult: any): Record<string, unknown> {
|
||||
const progressEvidenceReason = claimedProgression && !progressEvidence
|
||||
? "progression claim requires concrete evidence such as sessionKey, runId, modified_files, or verification result"
|
||||
: "";
|
||||
const hasExternalizedCheckpointEvidence = wrapperResult.silentLaunchOk === true
|
||||
&& typeof wrapperResult.taskRecord?.task_name === "string"
|
||||
&& wrapperResult.taskRecord.task_name.trim().length > 0;
|
||||
const hasExternalizedCheckpointEvidence = typeof wrapperResult.externalizedCheckpointPath === "string"
|
||||
&& wrapperResult.externalizedCheckpointPath.trim().length > 0;
|
||||
const hasButtonPathClosureEvidence = needsOwnerDecision && wrapperResult.silentLaunchOk === true;
|
||||
|
||||
return {
|
||||
@@ -206,8 +228,8 @@ function buildGateLockInput(wrapperResult: any): Record<string, unknown> {
|
||||
dispatchEvidence: "",
|
||||
fileChangeEvidence: "",
|
||||
verificationEvidence: "",
|
||||
checkpointArtifactEvidence: hasExternalizedCheckpointEvidence ? wrapperResult.taskRecord.task_name.trim() : "",
|
||||
externalizedCheckpointPath: hasExternalizedCheckpointEvidence ? wrapperResult.taskRecord.task_name.trim() : "",
|
||||
checkpointArtifactEvidence: hasExternalizedCheckpointEvidence ? wrapperResult.externalizedCheckpointPath.trim() : "",
|
||||
externalizedCheckpointPath: hasExternalizedCheckpointEvidence ? wrapperResult.externalizedCheckpointPath.trim() : "",
|
||||
externalizedTrigger: hasExternalizedCheckpointEvidence ? "hook-preflight-checkpoint" : "",
|
||||
handoffMode: hasButtonPathClosureEvidence ? (wrapperResult.handoff?.mode ?? "button_path") : "direct_reply",
|
||||
replyClosureMode: hasButtonPathClosureEvidence ? (wrapperResult.handoff?.mode ?? "button_path") : "direct_reply",
|
||||
|
||||
Reference in New Issue
Block a user