Keep PR-backed native tasks open until delivery is merged

Native completion accepted an agent claim after a PR was opened, even when
CI and review remained unfinished. Follow-up contracts could narrow the
reported objective to opening the PR and lose the task's delivery obligation.

Preserve that obligation in task guidance and verify declared PR outputs
with the company-scoped GitHub resolver before terminal completion. Recheck
current outputs under the status lock, including reassessment, while allowing
configured review stages and conversation responses to retain their lifecycle.

Verified with server typecheck and 461 focused tests covering completion,
finalization, configured review, changed outputs, and a stalled HTTP body.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip committed 2026-11-18 14:53:12 -08:00
1 parent 07d9316218
commit 88249dc41d
11 files changed
+318 -10

No files matched your search

@@ -236,7 +236,8 @@ export async function nativeCompletionFeedback(
const objective = typeof continuation?.objective === "string"
? continuation.objective : [issue.title, issue.description].filter(Boolean).join("\n");
await validateNativeDeliverableEvidence(db, { companyId: run.companyId, issueId: issue.id, runId,
objective, semanticToolReceipts: run.resultJson?.semanticToolReceipts }, result);
objective, semanticToolReceipts: run.resultJson?.semanticToolReceipts,
enteringConfiguredReview: !isConversation(issue) && completionReviewStageEntry(issue, run.agentId).kind === "starts" }, result);
if (result.reportedWorkDisposition === "done") {
const quality = await readRequiredQualityReview(db, issue);
if (!quality.satisfied) throw new Error(`Required human quality review is incomplete: ${JSON.stringify(quality.missing)}. Read each existing review and preserve approved unchanged outputs. For missing or revised outputs call request_human_input with a concise confirmation payload.qualityReview:{key} (or item_verdicts items with qualityReview:{key}), payload.target with the exact current output, top-level resolverPolicy:human_only and continuationPolicy:wake_assignee, and payload.supersedeOnUserComment:false. Do not omit payload or its bindings after a validation error. Wait for its recorded response; do not report done, create a generic completion review, or treat plan acceptance/file presence as quality approval.`);