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([issue-13265]): preserve legacy audit learning semantics

[._.]/ Adam Eivy097a04d7c408
diff --git a/server/lib/agentOutcome.js b/server/lib/agentOutcome.js
index 24d933f352..7b4abab7fb 100644
--- a/server/lib/agentOutcome.js
+++ b/server/lib/agentOutcome.js
@@ -110,7 +110,12 @@ export function isTaskDeliveryComplete(agent) {
export function resolveTaskOutcome({ reported, success, validationPassed, branchProvenEmpty, noChangeAllowed }) {
if (reported && ['blocked', 'incomplete'].includes(reported.status)) return reported;
- if (!success || validationPassed === false) return { status: 'incomplete', reason: 'Delivery checks did not pass.' };
+ if (!success) return { status: 'incomplete', reason: 'Delivery checks did not pass.' };
+ // Legacy learning criteria include commit probes that are not delivery gates
+ // (for example, an audit may save its report without a code change). Keep
+ // those runs unverified unless the agent supplied a delivery contract.
+ if (validationPassed === false) return reported
+ ? { status: 'incomplete', reason: 'Delivery checks did not pass.' } : null;
if (branchProvenEmpty && noChangeAllowed) return { status: 'no-action-needed', reason: 'The permitted no-change result was verified against the repository.' };
if (reported?.status === 'no-action-needed' && validationPassed !== true) {
return { status: 'incomplete', reason: 'The reported no-action-needed result was not verified.' };
diff --git a/server/services/agentFinalization.outputHooks.test.js b/server/services/agentFinalization.outputHooks.test.js
index 6dde44c14d..849a49ee5f 100644
--- a/server/services/agentFinalization.outputHooks.test.js
+++ b/server/services/agentFinalization.outputHooks.test.js
@@ -309,14 +309,16 @@ describe('recovery output-hook dispatch (#3182)', () => {
expect(recordAuditQuality).not.toHaveBeenCalled();
});
- it('persists assessment and delivery verdicts without rewriting a clean execution', async () => {
+ it.each([false, true])('preserves legacy learning results while enforcing explicit delivery=%s', async explicit => {
isProgrammaticIoTaskType.mockImplementation(type => type !== 'security');
const task = { ...TASK, metadata: { ...TASK.metadata, analysisType: 'security' } };
recordAuditQuality.mockResolvedValueOnce(false);
await finalizeAgent({ agentId: 'audit-final', task, success: true, exitCode: 0, duration: 1000,
- workspacePath: '/missing-audit-worktree', startedAt: Date.now() - 1000, outputBuffer: 'Audit complete' });
+ workspacePath: '/missing-audit-worktree', startedAt: Date.now() - 1000, outputBuffer: 'Audit complete',
+ finalSummary: explicit ? JSON.stringify({ summary: 'Invented audit report.', taskOutcome: { status: 'completed', reason: 'Invented completion claim.' } }) : null });
expect(completeAgent).toHaveBeenCalledWith('audit-final', expect.objectContaining({
- success: false, executionSuccess: true, validationPassed: false, taskOutcome: { status: 'incomplete', reason: 'Delivery checks did not pass.' }, auditAssessment: { status: 'not-recorded' },
+ success: !explicit, executionSuccess: true, validationPassed: false,
+ taskOutcome: explicit ? { status: 'incomplete', reason: 'Delivery checks did not pass.' } : null, auditAssessment: { status: 'not-recorded' },
}));
isProgrammaticIoTaskType.mockReturnValue(true);
});
diff --git a/server/services/agentLifecycle.recoveredAudit.test.js b/server/services/agentLifecycle.recoveredAudit.test.js
index 3029e849d2..df141c8486 100644
--- a/server/services/agentLifecycle.recoveredAudit.test.js
+++ b/server/services/agentLifecycle.recoveredAudit.test.js
@@ -159,7 +159,7 @@ describe('recovered runner audit completion (#11526)', () => {
if (mode === 'stale primary cwd') runnerAgents.get(run.agentId).workspacePath = run.primaryPath;
await handleAgentCompletion(run.agentId, 0, true, 1000);
expect(run.record.metadata.auditFindings).toMatchObject({ status: 'complete', report });
- expect(run.record.result).toMatchObject({ success: true, auditAssessment: { status: 'recorded' } });
+ expect(run.record.result).toMatchObject({ success: true, executionSuccess: true, taskOutcome: null, auditAssessment: { status: 'recorded' } });
expect(fixture.quality).toEqual([{ category: 'observability', agentId: run.agentId, report: quality(82) }]);
expect(fixture.trace.indexOf('findings')).toBeLessThan(fixture.trace.indexOf('quality'));
expect(fixture.trace.indexOf('quality')).toBeLessThan(fixture.trace.indexOf('complete'));