perf(native): narrow reconciliation candidate payloads (#17531)

Select the complete workspace-sync record and native status wake identifier for reconciliation candidates. Preserve candidate policy, JSON types, full later evidence, and stored data. The committed replay regression includes the real reconciliation scan. Full build, typecheck, 114 focused tests, complete CI, and exact-head Greptile5/5 pass.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin FoleyandPaperclip authored and GitHub committed 2026-10-24 19:01:23 -07:00
1 parent 39e5c8c1c3
commit ef0a8db502
3 files changed
+15 -6

No files matched your search

@@ -742,8 +742,8 @@ async function reconcileNativeFinalizationsPass(
resultId: nativeRunFinalizations.resultId,
assessmentId: nativeRunFinalizations.assessmentId,
decisionId: nativeRunFinalizations.decisionId,
runnerProfileJson: heartbeatRuns.runnerProfileJson,
contextSnapshot: heartbeatRuns.contextSnapshot,
nativeWorkspaceSync: sql<unknown>`${heartbeatRuns.runnerProfileJson}->'nativeWorkspaceSync'`,
nativeStatusWakeIntentId: sql<unknown>`${heartbeatRuns.contextSnapshot}->'nativeStatusWakeIntentId'`,
})
.from(heartbeatRuns)
.innerJoin(nativeRunFinalizations, eq(nativeRunFinalizations.runId, heartbeatRuns.id))
@@ -955,8 +955,7 @@ async function reconcileNativeFinalizationsPass(
if (reviewBarrier && reviewBarrier.status !== "succeeded") continue;
const childCompletionRecipient = {
companyId: row.companyId, issueId: row.issueId, agentId: row.agentId, runId: row.runId,
sourceIntentId: typeof record(row.contextSnapshot).nativeStatusWakeIntentId === "string"
? record(row.contextSnapshot).nativeStatusWakeIntentId as string : null,
sourceIntentId: typeof row.nativeStatusWakeIntentId === "string" ? row.nativeStatusWakeIntentId : null,
};
const hasPendingChildCompletion = await hasPendingNativeChildCompletion(db, childCompletionRecipient);
const reassessmentRow = await recordNativeWorkAssessment({
@@ -1095,7 +1094,7 @@ async function reconcileNativeFinalizationsPass(
projectRunStatus: true,
preserveProviderAttempt: Boolean(
readNativeWorkspaceSyncReference(
record(row.runnerProfileJson).nativeWorkspaceSync,
row.nativeWorkspaceSync,
),
),
});
@@ -1153,7 +1152,7 @@ async function reconcileNativeFinalizationsPass(
projectRunStatus: true,
preserveProviderAttempt: Boolean(
readNativeWorkspaceSyncReference(
record(row.runnerProfileJson).nativeWorkspaceSync,
row.nativeWorkspaceSync,
),
),
});
@@ -279,6 +279,11 @@ describeEmbeddedPostgres("native run finalizer / status decision committer — a
});
expect(agentTaskRunCalls(callsBefore)).toHaveLength(0);
expect(reconcileMuseAssignments).toHaveBeenCalledExactlyOnceWith(companyId, agentId, fixture.runId);
await db.insert(workspaceOperations).values({ companyId, issueId: fixture.issueId,
heartbeatRunId: fixture.runId, phase: "workspace_finalize", status: "succeeded" });
const reconciled = await reconcileNativeFinalizations(db, [fixture.runId]);
expect(reconciled).toContainEqual(expect.objectContaining({ runId: fixture.runId, phase: "committed" }));
expect(agentTaskRunCalls(callsBefore)).toHaveLength(0);
});
});