Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

fix: skip diff fidelity for no-commit tasks (#7691)

[._.]/ Adam Eivy6d1d07eabd20
diff --git a/server/services/agentFinalization.goalFidelity.test.js b/server/services/agentFinalization.goalFidelity.test.js
index 57ee5eb6d5..7c1ec1b2bd 100644
--- a/server/services/agentFinalization.goalFidelity.test.js
+++ b/server/services/agentFinalization.goalFidelity.test.js
@@ -101,7 +101,7 @@ import { finalizeAgent } from './agentFinalization.js';
import { cosEvents } from './cosEvents.js';
import { completeAgentRun } from './agentRunTracking.js';
import { resolveFailedTaskUpdate } from './agentErrorAnalysis.js';
-import { getTaskOutputHook, isProgrammaticIoTaskType, resolveTaskHookType } from './taskTypeHooks.js';
+import { declaresNoCommitCriterion, getTaskOutputHook, isProgrammaticIoTaskType, resolveTaskHookType } from './taskTypeHooks.js';
import { GOAL_FIDELITY_CATEGORY, GOAL_FIDELITY_HOLD_EVENT } from '../lib/goalFidelity.js';
const verdict = (overrides = {}) => ({
@@ -195,6 +195,7 @@ beforeEach(() => {
execGh.mockResolvedValue(JSON.stringify({ number: 42, title: 'Retry the opening line', body: 'Retry transient synthesis failures and clear the pending opening after success.' }));
getTaskOutputHook.mockResolvedValue(null);
isProgrammaticIoTaskType.mockReturnValue(false);
+ declaresNoCommitCriterion.mockReturnValue(false);
resolveTaskHookType.mockImplementation(task => task?.metadata?.analysisType || task?.metadata?.taskAnalysisType || task?.taskType || null);
resolveFailedTaskUpdate.mockImplementation(async (_task, analysis) => ({
status: 'pending',
@@ -230,6 +231,27 @@ describe('finalizeAgent — goal-fidelity gate', () => {
expect(updateTaskMock).toHaveBeenCalledWith('task-1', expect.objectContaining({ status: 'completed' }), 'internal');
});
+ it.each([
+ { analysisType: 'release-check' },
+ { prRemediationFollowUp: true },
+ { noCodeOutput: true },
+ { creativeDirector: { projectId: 'example-project' } },
+ { analysisType: 'reference-watch', worktreeChangesExpected: false },
+ { discardWorktree: true },
+ ])('leaves a declared no-commit task unjudged without reading the checkout diff: %j', async metadata => {
+ declaresNoCommitCriterion.mockReturnValue(true);
+ runLocalGoalFidelityReviewMock.mockResolvedValue(verdict({ verdict: 'rethink' }));
+
+ await finalize({ task: { id: 'task-1', taskType: 'internal', description: 'Complete the external action', metadata } });
+
+ expect(declaresNoCommitCriterion).toHaveBeenCalledWith(expect.objectContaining({ metadata }));
+ expect(runWindowDiffMock).not.toHaveBeenCalled();
+ expect(runLocalGoalFidelityReviewMock).not.toHaveBeenCalled();
+ expect(completion()).toMatchObject({ success: true });
+ expect(completion().goalFidelity).toBeUndefined();
+ expect(cosEvents.emit).not.toHaveBeenCalledWith(GOAL_FIDELITY_HOLD_EVENT, expect.anything());
+ });
+
it.each([0, 1, undefined])('still judges single-issue claims with swarmCount %s', async swarmCount => {
await finalize({ task: { id: 'task-1', description: 'Fix the uploader', metadata: { analysisType: 'claim-issue', swarmCount } } });
expect(runLocalGoalFidelityReviewMock).toHaveBeenCalledOnce();
@@ -467,6 +489,7 @@ describe('finalizeAgent — goal-fidelity gate', () => {
});
it('records a forge-established ship without reading a diff or calling a model', async () => {
+ declaresNoCommitCriterion.mockReturnValue(true);
runLocalGoalFidelityReviewMock.mockResolvedValue(verdict({ verdict: 'rethink', unrequested: ['Resolve and merge PR #7653'] }));
await finalize({ task: mergeFollowUp() });
@@ -495,6 +518,7 @@ describe('finalizeAgent — goal-fidelity gate', () => {
// A leave-open follow-up's objective is the review fixes, which ARE ordinary
// diff — it must keep the model review a merge objective skips.
it('does not divert a leave-open follow-up, whose deliverable is a diff', async () => {
+ declaresNoCommitCriterion.mockReturnValue(true);
await finalize({ task: mergeFollowUp({ reviewLoopLeaveOpen: 'true' }) });
expect(getPullRequestState).not.toHaveBeenCalled();
diff --git a/server/services/agentFinalization.js b/server/services/agentFinalization.js
index ed3be4161f..8f66ff3efa 100644
--- a/server/services/agentFinalization.js
+++ b/server/services/agentFinalization.js
@@ -719,6 +719,16 @@ async function evaluateGoalFidelity({ task, workspacePath, startedAt }) {
// `mergeOutcomeObjective` for the run this gate wrongly held.
const mergeObjective = mergeOutcomeObjective(task);
if (mergeObjective) return verifyMergeOutcome(workspacePath, mergeObjective);
+ // Every remaining task that declares no commit criterion delivers an action
+ // outside this checkout, so its run-window diff is not evidence of fidelity.
+ // Leave-open review follow-ups are the deliberate exception: their deliverable
+ // IS the review-fix commits, while merge-shaped follow-ups were settled from
+ // forge state immediately above.
+ const reviewLoopFollowUp = task.metadata?.reviewLoopFollowUp === true
+ || task.metadata?.reviewLoopFollowUp === 'true';
+ const reviewLoopLeaveOpen = reviewLoopFollowUp
+ && (task.metadata?.reviewLoopLeaveOpen === true || task.metadata?.reviewLoopLeaveOpen === 'true');
+ if (declaresNoCommitCriterion(task) && !reviewLoopLeaveOpen) return noFidelityVerdict();
const claimFlow = task.metadata?.claimFlow === true || task.metadata?.claimFlow === 'true'
|| CLAIM_FLOW_TASK_TYPES.has(resolveTaskHookType(task));
const objective = claimFlow