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
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
address review (codex): preserve catalog audit no-op success (#5074)
[._.]/ Adam Eivy904f1603e80a
diff --git a/server/services/agentFinalization.js b/server/services/agentFinalization.jsindex 959e3a699b..9a6e94a578 100644--- a/server/services/agentFinalization.js+++ b/server/services/agentFinalization.js@@ -103,7 +103,7 @@ export function releaseAgentLane({ agentId, success, duration, exitCode, executi** @returns {Promise<boolean|null|'skip-learning'>}*/-export async function evaluateSuccessCriteria({ task, terminatedByUser, workspacePath, startedAt = null, success = false, hookResult = null }) {+export async function evaluateSuccessCriteria({ task, terminatedByUser, workspacePath, startedAt = null, success = false, hookResult = null, noChangesToShip = false }) {if (terminatedByUser) return null;const taskType = task?.taskType || 'user';// The SCHEDULED type (`metadata.analysisType`) if any, else the queue category —@@ -126,6 +126,14 @@ export async function evaluateSuccessCriteria({ task, terminatedByUser, workspac// Interactive/user tasks declare no machine-checkable criterion; neither does// a run missing the task id or workspace needed to validate.if (taskType === 'user' || !task?.id || !workspacePath) return null;+ // A PortOS-owned audit can validly conclude that its shipped data is current.+ // `noChangesToShip` is only set by verifyPrClaim after the forge answered that+ // no PR exists AND the branch was proven empty; the task marker narrows this+ // exception to an explicitly opted-in autonomous job. Do not use the marker+ // as a general no-commit exemption: a real change still needs the commit probe.+ if (success && noChangesToShip === true+ && task?.metadata?.autonomousJob === true+ && task?.metadata?.noChangeSuccess === true) return true;// Pipeline/media tasks deliver artifacts, not a commit — the// commit criterion doesn't apply, so don't mislabel a clean artifact run as a// validation miss (which would also pollute the correlation window). null =@@ -795,7 +803,15 @@ export async function finalizeAgent({// exit-code `success`, so task-learning telemetry can distinguish "ran clean// but produced nothing" from a genuine success. Best-effort — a validation// check failure must never block finalize (falls back to the null sentinel).- const validationPassed = await evaluateSuccessCriteria({ task, terminatedByUser, workspacePath, startedAt: runStartedAt, success, hookResult })+ const validationPassed = await evaluateSuccessCriteria({+ task,+ terminatedByUser,+ workspacePath,+ startedAt: runStartedAt,+ success,+ hookResult,+ noChangesToShip: prVerdict.noChangesToShip === true,+ }).catch(err => {emitLog('warn', `⚠️ Success-criteria validation failed for ${agentId}: ${err.message}`, { agentId });return null;diff --git a/server/services/agentFinalization.prVerification.test.js b/server/services/agentFinalization.prVerification.test.jsindex a9ecfb5ba5..5c6668894d 100644--- a/server/services/agentFinalization.prVerification.test.js+++ b/server/services/agentFinalization.prVerification.test.js@@ -345,6 +345,21 @@ describe('finalizeAgent — a PR-shaped run with no PR is not a success (#3358)'expect(resolveFailedTaskUpdateMock).not.toHaveBeenCalled();});+ it('records validation success when the marked catalog audit has no change to ship', async () => {+ onBranch('cos/sys-1/agent-1');+ git.ahead = 0;+ findPullRequestForBranchMock.mockResolvedValue({ status: 'none', number: null, url: null, detail: null });+ await finalize({+ task: {+ ...prTask(),+ metadata: { ...prTask().metadata, autonomousJob: true, noChangeSuccess: true }+ }+ });++ const [, result] = completeAgentMock.mock.calls[0];+ expect(result).toMatchObject({ success: true, validationPassed: true });+ });+it('marks the RUN record failed too, even though the process exited 0', async () => {onBranch('claim/issue-1');findPullRequestForBranchMock.mockResolvedValue({ status: 'none', number: null, url: null, detail: null });diff --git a/server/services/agentFinalization.successCriteria.test.js b/server/services/agentFinalization.successCriteria.test.jsindex b78ab0bf75..0b455da586 100644--- a/server/services/agentFinalization.successCriteria.test.js+++ b/server/services/agentFinalization.successCriteria.test.js@@ -346,6 +346,53 @@ describe('withOutputHookTimeout (#2727)', () => {describe('evaluateSuccessCriteria — commit criterion (#2344, #3637)', () => {beforeEach(() => vi.clearAllMocks());+ it('accepts a verified no-change result for an explicitly marked autonomous audit', async () => {+ const task = {+ id: 'catalog-audit-1',+ taskType: 'internal',+ metadata: { autonomousJob: true, noChangeSuccess: true }+ };+ expect(await evaluateSuccessCriteria({+ task,+ workspacePath: '/w',+ success: true,+ noChangesToShip: true,+ startedAt: STARTED_AT+ })).toBe(true);+ // The no-change proof came from verifyPrClaim's forge + branch checks; it+ // must not trigger a second commit probe or turn a clean audit into a miss.+ expect(committedDuringRun).not.toHaveBeenCalled();+ });++ it('does not let the marker bypass validation without the verified no-change proof', async () => {+ const task = {+ id: 'catalog-audit-2',+ taskType: 'internal',+ metadata: { autonomousJob: true, noChangeSuccess: true }+ };+ committedDuringRun.mockResolvedValueOnce(false);+ expect(await evaluateSuccessCriteria({+ task,+ workspacePath: '/w',+ success: true,+ noChangesToShip: false,+ startedAt: STARTED_AT+ })).toBe(false);+ expect(committedDuringRun).toHaveBeenCalledWith('/w', STARTED_AT);+ });++ it('does not let an unmarked task claim the no-change exemption', async () => {+ committedDuringRun.mockResolvedValueOnce(false);+ expect(await evaluateSuccessCriteria({+ task: { id: 'ordinary-audit-1', taskType: 'internal', metadata: { autonomousJob: true } },+ workspacePath: '/w',+ success: true,+ noChangesToShip: true,+ startedAt: STARTED_AT+ })).toBe(false);+ expect(committedDuringRun).toHaveBeenCalledWith('/w', STARTED_AT);+ });+it('passes an autonomous code run that COMMITTED during its window', async () => {committedDuringRun.mockResolvedValueOnce(true);expect(await evaluateSuccessCriteria({ task: { id: 't1', taskType: 'internal' }, workspacePath: '/w', startedAt: STARTED_AT })).toBe(true);diff --git a/server/services/autonomousJobs/portosCliCatalogRefresh.js b/server/services/autonomousJobs/portosCliCatalogRefresh.jsindex af1c258ec6..c2a8580077 100644--- a/server/services/autonomousJobs/portosCliCatalogRefresh.js+++ b/server/services/autonomousJobs/portosCliCatalogRefresh.js@@ -32,7 +32,9 @@ to compare against, not as sufficient proof for the shipped catalog. Do not makeprovider calls during PortOS startup and do not duplicate or bypass the liverefresh path in server/services/providers.js.-If a shipped fallback is stale, update only the PortOS static catalog and the+If a shipped fallback is stale, update only the PortOS static catalog and both+fresh-install seed snapshots (server/lib/aiToolkit/defaults/providers.sample.json+and data.reference/providers.json), keeping those seeds synchronized. Update thecompatibility recognition that protects independently upgraded installs. When ashipped default changes, preserve the old seeded Antigravity list inPRIOR_ANTIGRAVITY_MODEL_CATALOGS (and update any equivalent provider-specific@@ -68,7 +70,10 @@ export const PORTOS_CLI_CATALOG_REFRESH_JOB = Object.freeze({autonomyLevel: 'manager',type: 'agent',promptTemplate: PORTOS_CLI_CATALOG_REFRESH_PROMPT,- taskMetadata: { useWorktree: true, openPR: true, simplify: true },+ // A verified empty branch is a valid result for this audit. The finalizer+ // consumes this marker only alongside verifyPrClaim's noChangesToShip proof;+ // it is not a general commit-criterion exemption.+ taskMetadata: { useWorktree: true, openPR: true, simplify: true, noChangeSuccess: true },providerId: null,model: null,effort: null,diff --git a/server/services/autonomousJobs/portosCliCatalogRefresh.test.js b/server/services/autonomousJobs/portosCliCatalogRefresh.test.jsindex 65cb26a519..e41e4118bb 100644--- a/server/services/autonomousJobs/portosCliCatalogRefresh.test.js+++ b/server/services/autonomousJobs/portosCliCatalogRefresh.test.js@@ -21,7 +21,7 @@ describe('PortOS CLI provider catalog refresh custom task', () => {interval: 'monthly',intervalMs: 30 * DAY,enabled: false,- taskMetadata: { useWorktree: true, openPR: true, simplify: true }+ taskMetadata: { useWorktree: true, openPR: true, simplify: true, noChangeSuccess: true }})expect(SELF_IMPROVEMENT_TASK_TYPES).not.toContain(PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE)expect(DEFAULT_TASK_INTERVALS[PORTOS_CLI_CATALOG_REFRESH_TASK_TYPE]).toBeUndefined()@@ -42,7 +42,7 @@ describe('PortOS CLI provider catalog refresh custom task', () => {expect(job).toMatchObject({appId: PORTOS_APP_ID,- taskMetadata: { useWorktree: true, openPR: true, simplify: true },+ taskMetadata: { useWorktree: true, openPR: true, simplify: true, noChangeSuccess: true },providerId: null,model: null,effort: null,@@ -104,6 +104,7 @@ describe('PortOS CLI provider catalog refresh custom task', () => {useWorktree: true,openPR: true,simplify: true,+ noChangeSuccess: true,provider: 'codex-cli',model: 'gpt-example',effort: 'high'diff --git a/server/services/autonomousJobs/skillTemplates.js b/server/services/autonomousJobs/skillTemplates.jsindex 386fd45030..744979b7a1 100644--- a/server/services/autonomousJobs/skillTemplates.js+++ b/server/services/autonomousJobs/skillTemplates.js@@ -162,6 +162,10 @@ async function generateTaskFromJob(job) {...(meta.useWorktree != null ? { useWorktree: meta.useWorktree } : {}),...(meta.openPR != null ? { openPR: meta.openPR } : {}),...(meta.simplify != null ? { simplify: meta.simplify } : {}),+ // Some PortOS-owned audits can legitimately conclude that no change is+ // needed. This is only a completion marker; agentFinalization still+ // requires verifyPrClaim to prove the branch is empty before honoring it.+ ...(meta.noChangeSuccess === true ? { noChangeSuccess: true } : {}),// Optional per-job AI provider + model override. resolveAgentProviderAndModel// reads metadata.provider to switch providers and selectModelForTask reads// metadata.model as the highest-priority model choice. Absent = active