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

refactor: one predicate for the no-change completion contract (#9157)

[._.]/ Adam Eivya9733abd47e2
diff --git a/server/lib/README.md b/server/lib/README.md
index 32ff6f0a5c..ceb1ad15d2 100644
--- a/server/lib/README.md
+++ b/server/lib/README.md
@@ -570,6 +570,7 @@ The barrel `server/lib/index.js` is a machine-checkable enumeration of every pub
| `goalFidelityCalibration.js` | Goal-fidelity CALIBRATION contract — what happens when the follow-up investigation overturns a finding, i.e. the objective WAS delivered and the reviewer misjudged it. `GOAL_FIDELITY_CONTEXT_GAPS` is the closed vocabulary of what the reviewer could not see (`truncated-diff`, `truncated-objective`, `objective-omits-context`, `work-outside-diff`, `execution-step-misread`, `rubric-gap`, `other`), enforced ONLY by `normalizeGoalFidelityContextGap` (the report route takes a bounded string, so a near-miss gap name folds to `other` with its diagnosis intact instead of 400ing the report away). `GOAL_FIDELITY_REVIEW_SURFACES` addresses the reviewer's three context surfaces once — objective / diff / rubric — and `GOAL_FIDELITY_CONTEXT_GAP_FIXES` maps each gap onto one of them, so a rename cannot leave seven prose copies lying (`goalFidelityCalibration.pointers.test.js` walks the table against the real files). `goalFidelityCalibrationFingerprint(gap)` keys the dedup on the GAP alone, so many false positives from one blind spot fold into one fix instead of minting an agent each. `buildGoalFidelityCalibrationTask` composes the PortOS-side task body (including the do-not-disarm-the-detector contract) and `buildGoalFidelityFalsePositiveReportBlock` the `curl` instructions appended to a follow-up task, taking `apiBase` as an argument and the call shape from `agentApiToken.js`. I/O lives in `services/goalFidelityCalibration.js`. |
| `goalFidelityFollowUp.js` | Goal-fidelity FOLLOW-UP contract — what happens once the review HAS a finding, as opposed to what the finding is. `resolveGoalFidelityFollowUp(codeReview)` (`null` when neither action is configured; reads the RAW block, since a verdict already exists by the time this is asked), `normalizeGoalFidelityFollowUpTrigger` (shared with the settings projection so the form and the runtime cannot disagree), and `goalFidelityFollowUpApplies(review, trigger)` over `GOAL_FIDELITY_FOLLOW_UP_TRIGGERS` (`rethink` = only the verdict that holds a run, the default; `any-finding` also fires on the advisory `fix-first`). `goalFidelityFingerprint(task)` is the one dedup identity three parties share — the issue body marker (`goalFidelityIssueMarker` / `issueMatchesGoalFidelityMarker`), the tracker listing that reads it back, and the queued task fingerprint — keyed on taskType + app + objective slug so a perpetual task regenerating with a fresh id cannot re-file forever. Public issue markers hash that identity while matching legacy markers. `buildGoalFidelityIssue` requires a complete objective with verified tracker provenance and immutable diff references before publication; `buildGoalFidelityFollowUpTask` carries the finding issue snapshot and its resolution lifecycle. I/O and public-text scrubbing live in `services/goalFidelityFollowUp.js`. |
| `navManifest.js` | Single source of truth for nav (`⌘K` palette + voice). Add an entry when you add a page. Also `getNavPageForPath(pathname)` → `{ label, section, breadcrumb }` for the most specific command that owns a route (`null` for one nothing declares) — how user-facing copy NAMES a page it links to, instead of typing "Models → LLMs" beside the link and stranding it on the next move (#7414). `expandPageToken(text, runtime)` expands a `{page}` token in `text` using `getNavPageForPath(runtime?.manageUrl)`, falling back to generic prose rather than shipping a literal `{page}` (#7419). |
+| `noChangeCompletion.js` | `permitsNoChangeCompletion(task)` — the single predicate for "this run may finish successfully with an empty branch": the persisted `noChangeSuccess` marker AND (`autonomousJob` OR `isInvestigation`). Read by both the prompt builder and finalization so the agent is never told a contract finalize will not honour; whether the branch was really empty is the post-run `branchProvenEmpty` verdict. |
| `noReplaceMove.js` | `moveWithoutReplace(from, to)` — publish a staged file into its final name WITHOUT ever clobbering an existing one. `fs.rename` silently replaces its destination, which is the wrong default for a derived artifact; this uses `link(2)` + `unlink(2)`, so an existing destination fails atomically with `MOVE_DEST_EXISTS` and both files survive. Refuses rather than degrading when the filesystem cannot express it (`MOVE_CROSS_DEVICE`, `MOVE_NO_REPLACE_UNSUPPORTED`) — a `stat`-then-`rename` fallback would be a race. Used by the rigging publication contract (`services/rigging/autoSkin.js`). |
| `personaTraitBlend.js` | Digital-twin persona trait-blending (M34 P7). Blends a persona's `traitAdjustments` against the base twin's communication profile + Big-Five into a "Communication Calibration" directive. A pure leaf — `client/src/lib/personaTraitBlend.js` re-exports it for the Personas UI preview. |
| `textUtils.js` | Pure dependency-free prose helpers. `isStr(v)` and `isNonBlankStr(v)` are the ONLY string predicates under `server/` (#6837) — the bare type check, and type check plus a non-empty `trim()` for ids, keys, hosts, model names and prose fields where whitespace-only is already invalid; the "no private string predicate or bounder" guard in `textUtils.test.js` fails the suite when a copy of either, or a `trimTo`-shaped bounder, is re-declared in any non-test source under `server/` or any source under `client/src/` (`client/src/lib/textUtils.js` re-exports both for the browser bundle). `countWords(text)` is the canonical whitespace-token count (`\S+`) and the only one — every server word count (Writers Room, lettering density, rapid reader, autobiography, script-video beats) and the client's (`client/src/lib/textUtils.js` re-exports it) resolve here, and the "no private countWords" guard in `textUtils.test.js` fails the suite when a re-spelled count (the whitespace-token match, a split-and-filter, or a helper under either conventional name) reappears in any non-test source under `server/` or any source under `client/src/`; the editorial prose-analysis checks deliberately count LETTER words instead, through `editorial/proseTics.js#tokenizeWords`, which owns that tokenizer the same way; `trimTo(value, max)` trims and bounds strings without coercing non-strings, and is safe for shared modules consumed by the browser; `escapeRegExp(value)` is the one to import instead of re-inlining the escape (the sibling guard in `textUtils.test.js` fails the suite when a copy reappears in any non-test source under `server/`, or in ANY source under `client/src/`, tests and `.jsx` included — `client/src/lib/textUtils.js` re-exports this module for the browser bundle); `trimToClause(v, max)` is its boundary-aware twin for PROSE fields — it backs off to the last sentence terminator, then the last clause boundary, then the last whole word, so a capped field never ends mid-thought (it lives here rather than in `storyBible.js`, which re-exports it, so the pure story-model leaves the browser bundle shares can cap prose without pulling `crypto` / `fileUtils`); `kebabCase(text)` is the canonical ASCII slug transform (PLAN.md `[slug]` ids and `planner:<model>` labels), and `truncateOnBoundary(slug, max)` is its bounder — back off to the last `-` at or before `max` so a slug a human reads (a PLAN.md id, the app segment of a CoS worktree directory) is never cut mid-word, which `trimTo` would reintroduce; `clampToCharLimit(text, max)` is `trimTo`'s reader-facing twin — it cuts on a sentence end (when one sits 60%+ into the allowance) or a word boundary rather than mid-word and returns `{ text, truncated }` so the caller can say the text was cut, which is what bounds an AI-enhanced render prompt to a backend's hard cap (reactor.inc fast-h3 rejects an over-length prompt outright). `firstLine(text)` is the first non-blank line, trimmed — the CoS task headline `addTask` dedupes on, declared here rather than in the task store so a closure-sensitive caller can reach it (`cosTaskStore.js` re-exports it). |
diff --git a/server/lib/index.js b/server/lib/index.js
index 63e772e876..dab4b96258 100644
--- a/server/lib/index.js
+++ b/server/lib/index.js
@@ -525,6 +525,7 @@ export * from './modelPinMembership.js';
export * from './modelPinReconcile.js';
export * from './modelPricing.js';
export * from './navManifest.js';
+export * from './noChangeCompletion.js';
export * from './noReplaceMove.js';
export * from './instanceFeatureRegistry.js';
export * from './credentialRegistry.js';
diff --git a/server/lib/noChangeCompletion.js b/server/lib/noChangeCompletion.js
new file mode 100644
index 0000000000..50d83c0587
--- /dev/null
+++ b/server/lib/noChangeCompletion.js
@@ -0,0 +1,18 @@
+/**
+ * No-change completion contract.
+ *
+ * A task may complete successfully with an empty branch only when it opted in
+ * (the persisted `noChangeSuccess` metadata marker) and is an autonomous job or
+ * an investigation; whether the branch really was empty is `branchProvenEmpty`,
+ * decided after the run by the forge/branch check in agentFinalization.
+ *
+ * The prompt builder and finalization both read this one predicate, so the agent
+ * is only told a clean no-op exit is allowed where finalize will honour it.
+ */
+import { isTruthyMeta } from './metadataFlags.js';
+
+export function permitsNoChangeCompletion(task) {
+ const meta = task?.metadata;
+ return isTruthyMeta(meta?.noChangeSuccess)
+ && (isTruthyMeta(meta?.autonomousJob) || isTruthyMeta(meta?.isInvestigation));
+}
diff --git a/server/lib/prDisposition.js b/server/lib/prDisposition.js
index b4de4d365c..332b727296 100644
--- a/server/lib/prDisposition.js
+++ b/server/lib/prDisposition.js
@@ -145,12 +145,12 @@ export const PR_CREATION = Object.freeze({
* @param {boolean} opts.agentOpensOwnPr - the prompt told the agent to open it
* @param {boolean} opts.prClaimVerified - finalize ran `verifyPrClaim` for this
* run (i.e. `prExpected` was true), so cleanup must not ask a second time
- * @param {boolean} [opts.noChangesToShip] - finalize verified an opted-in audit
+ * @param {boolean} [opts.branchProvenEmpty] - finalize verified an opted-in audit
* left no commits and no change request, so cleanup must not create an empty PR
* @returns {string} a `PR_CREATION` value
*/
-export function resolvePrCreation({ taskOpenPR, agentOpensOwnPr, prClaimVerified, noChangesToShip = false }) {
- if (!taskOpenPR || noChangesToShip) return PR_CREATION.NEVER;
+export function resolvePrCreation({ taskOpenPR, agentOpensOwnPr, prClaimVerified, branchProvenEmpty = false }) {
+ if (!taskOpenPR || branchProvenEmpty) return PR_CREATION.NEVER;
if (!agentOpensOwnPr) return PR_CREATION.ALWAYS;
return prClaimVerified ? PR_CREATION.NEVER : PR_CREATION.IF_MISSING;
}
@@ -167,7 +167,7 @@ export function resolvePrCreation({ taskOpenPR, agentOpensOwnPr, prClaimVerified
* branch with no PR gets cleaned up as if it had one.
*
* A verified verdict therefore requires BOTH `ok` and a named `branch` — which
- * only the `found` and `noChangesToShip` shapes carry.
+ * only the `found` and `branchProvenEmpty` shapes carry.
*
* @param {{ok?: boolean, branch?: string|null}|null|undefined} prVerdict
* @returns {boolean}
diff --git a/server/lib/prDisposition.test.js b/server/lib/prDisposition.test.js
index be30656afb..be8196d863 100644
--- a/server/lib/prDisposition.test.js
+++ b/server/lib/prDisposition.test.js
@@ -38,7 +38,7 @@ describe('resolvePrCreation (#3733)', () => {
taskOpenPR: true,
agentOpensOwnPr: false,
prClaimVerified: false,
- noChangesToShip: true,
+ branchProvenEmpty: true,
})).toBe(PR_CREATION.NEVER);
});
@@ -63,7 +63,7 @@ describe('resolvePrCreation (#3733)', () => {
describe('prClaimWasVerified (#3733)', () => {
it('accepts only a forge answer about a real branch', () => {
expect(prClaimWasVerified({ ok: true, branch: 'feature-x' })).toBe(true);
- expect(prClaimWasVerified({ ok: true, branch: 'feature-x', noChangesToShip: true })).toBe(true);
+ expect(prClaimWasVerified({ ok: true, branch: 'feature-x', branchProvenEmpty: true })).toBe(true);
});
it('rejects a bare ok — that is "nothing was verified", not "a PR exists"', () => {
diff --git a/server/lib/repoStateExpectations.js b/server/lib/repoStateExpectations.js
index 3df4f0f011..5e41cf8938 100644
--- a/server/lib/repoStateExpectations.js
+++ b/server/lib/repoStateExpectations.js
@@ -22,7 +22,7 @@ import { PR_COMPLETIONS } from './prDisposition.js';
*
* There is deliberately no "the agent never opened a PR" code: `verifyPrClaim`
* (services/agentFinalization.js) already owns that question on every completion
- * path, is forge-agnostic, and carries the `noChangesToShip` carve-out (#3358) —
+ * path, is forge-agnostic, and carries the `branchProvenEmpty` carve-out (#3358) —
* a run that found the work already done ships nothing and must not be told to
* open a PR for an empty branch.
*/
diff --git a/server/services/agentCliSpawning.js b/server/services/agentCliSpawning.js
index a673754ef6..7dc6c0b19a 100644
--- a/server/services/agentCliSpawning.js
+++ b/server/services/agentCliSpawning.js
@@ -785,7 +785,7 @@ export async function spawnDirectly({
// that threw, and a throw from finalize skips the assignment entirely; in all
// three cases nothing was verified, so cleanup must ask rather than stand down.
let prClaimVerified = false;
- let noChangesToShip = false;
+ let branchProvenEmpty = false;
// try/finally so a throw from finalizeAgent still runs the local cleanup
// (the shared completion dispatch, pid unregister, activeAgents delete).
@@ -813,7 +813,7 @@ export async function spawnDirectly({
});
if (finalized && typeof finalized.success === 'boolean') cleanupSuccess = finalized.success;
prClaimVerified = prClaimWasVerified(finalized?.prVerdict);
- noChangesToShip = finalized?.prVerdict?.noChangesToShip === true;
+ branchProvenEmpty = finalized?.prVerdict?.branchProvenEmpty === true;
} finally {
// Pipeline progression → worktree cleanup with the PR disposition →
// retry-hold release, in the one owner both in-process spawners share.
@@ -825,7 +825,7 @@ export async function spawnDirectly({
success: cleanupSuccess,
prOwnership,
prClaimVerified,
- noChangesToShip,
+ branchProvenEmpty,
outputBuffer,
}).catch(err => console.error(`❌ CLI completion cleanup failed for ${agentId}: ${err.message}`));
diff --git a/server/services/agentCompletionCleanup.js b/server/services/agentCompletionCleanup.js
index e9b5cc9ea0..755ac8114b 100644
--- a/server/services/agentCompletionCleanup.js
+++ b/server/services/agentCompletionCleanup.js
@@ -238,11 +238,11 @@ export async function handlePipelineProgression(task, agentId, success) {
*
* @returns {Promise<Object>} the third argument to `cleanupAgentWorktree`
*/
-async function resolveWorktreeCleanupOptions({ agentId, task, outputBuffer, taskOpenPR, agentOpensOwnPr, prClaimVerified = false, noChangesToShip = false }) {
+async function resolveWorktreeCleanupOptions({ agentId, task, outputBuffer, taskOpenPR, agentOpensOwnPr, prClaimVerified = false, branchProvenEmpty = false }) {
// `if-missing` for an agent-owned PR that finalize did NOT verify: cleanup
// asks the forge once and only stands down when a PR actually exists, so a
// harness that skipped its completion workflow can't strand the branch.
- const prCreation = resolvePrCreation({ taskOpenPR, agentOpensOwnPr, prClaimVerified, noChangesToShip });
+ const prCreation = resolvePrCreation({ taskOpenPR, agentOpensOwnPr, prClaimVerified, branchProvenEmpty });
// Merge per-task reviewer metadata with the user's Code Review Defaults
// (Settings → Code Reviewers page). Settings I/O is cached inside the
// resolver, so this is effectively free even when invoked from a tight CoS
@@ -285,9 +285,9 @@ async function resolveWorktreeCleanupOptions({ agentId, task, outputBuffer, task
* be skipped by a throw from the JIRA/pipeline/Creative Director steps — either
* would leave the task held until the orphan sweep noticed.
*
- * @param {{ agentId: string, task: object, agent: object, effectiveSuccess: boolean, outputBuffer: string, noChangesToShip?: boolean }} params
+ * @param {{ agentId: string, task: object, agent: object, effectiveSuccess: boolean, outputBuffer: string, branchProvenEmpty?: boolean }} params
*/
-export async function runAgentCompletionCleanup({ agentId, task, agent, effectiveSuccess, outputBuffer, prClaimVerified = false, noChangesToShip = false }) {
+export async function runAgentCompletionCleanup({ agentId, task, agent, effectiveSuccess, outputBuffer, prClaimVerified = false, branchProvenEmpty = false }) {
// Fetch agent state once for JIRA, plan-question, and the resume pointer. Its
// worktree fields are stamped once at registerAgent and never mutated, so passing
// it to the release spares a re-read that would re-split the whole output.txt.
@@ -296,7 +296,7 @@ export async function runAgentCompletionCleanup({ agentId, task, agent, effectiv
try {
await runCompletionCleanupSteps({
- agentId, task, agent, agentState, effectiveSuccess, outputBuffer, prClaimVerified, noChangesToShip,
+ agentId, task, agent, agentState, effectiveSuccess, outputBuffer, prClaimVerified, branchProvenEmpty,
});
} finally {
await releaseRetryHold({
@@ -524,14 +524,14 @@ export async function removeCompletionSentinel({ agentId, agent, agentState }) {
await rmGuarded(resolveDoneSentinelPath(workspace, agentId), { force: true });
}
-async function completeWorktreeCleanup({ agentId, task, agent, agentState, effectiveSuccess, prOwnership, outputBuffer, prClaimVerified, noChangesToShip }) {
+async function completeWorktreeCleanup({ agentId, task, agent, agentState, effectiveSuccess, prOwnership, outputBuffer, prClaimVerified, branchProvenEmpty }) {
if (task?.metadata?.jiraBranch) return;
const ownership = prOwnership ?? resolveRunnerPrOwnership({ task, agent, agentState });
return cleanupAgentWorktree(agentId, effectiveSuccess, await resolveWorktreeCleanupOptions({
agentId, task, outputBuffer,
taskOpenPR: ownership.taskOpenPR,
agentOpensOwnPr: ownership.agentOpensOwnPr,
- prClaimVerified, noChangesToShip,
+ prClaimVerified, branchProvenEmpty,
}));
}
@@ -569,18 +569,18 @@ async function reportWorktreeCleanupWarnings({ agentId, task, cleanupWarnings })
* a failed hand-off must release the task with the resume pointer cleanup left.
*
* `prOwnership` is `resolvePrOwnership`'s answer for this run;
- * `prClaimVerified` / `noChangesToShip` are read off finalize's return.
+ * `prClaimVerified` / `branchProvenEmpty` are read off finalize's return.
* `success` is the verdict finalize actually persisted — a PR-claim downgrade
* must reach cleanup, or a run that opened no PR is cleaned up as a success and
* loses its retry state (#3358).
*/
-export async function runSpawnerCompletionCleanup({ agentId, task, success, prOwnership, prClaimVerified = false, noChangesToShip = false, outputBuffer }) {
+export async function runSpawnerCompletionCleanup({ agentId, task, success, prOwnership, prClaimVerified = false, branchProvenEmpty = false, outputBuffer }) {
try {
const { getAgent } = await import('./cos.js');
const agentState = await getAgent(agentId).catch(() => null);
await runCompletionCleanupSteps({
agentId, task, agentState, effectiveSuccess: success, prOwnership,
- prClaimVerified, noChangesToShip, outputBuffer, continueOnError: true,
+ prClaimVerified, branchProvenEmpty, outputBuffer, continueOnError: true,
});
} finally {
await releaseRetryHold({ agentId, task, success })
diff --git a/server/services/agentCompletionCleanup.test.js b/server/services/agentCompletionCleanup.test.js
index c8e79f838a..48a47d7f6a 100644
--- a/server/services/agentCompletionCleanup.test.js
+++ b/server/services/agentCompletionCleanup.test.js
@@ -277,9 +277,9 @@ describe('runAgentCompletionCleanup — agentOpensOwnPr mirrors the prompt gate'
// `prClaimVerified` is the caller's answer to "did finalize's PR-claim check
// actually produce a forge verdict for this run?" — threaded in, never
// re-derived here (see the note at its use site).
- const cleanupCallFor = async (agent, { prClaimVerified = false, noChangesToShip = false, task = prTask } = {}) => {
+ const cleanupCallFor = async (agent, { prClaimVerified = false, branchProvenEmpty = false, task = prTask } = {}) => {
await runAgentCompletionCleanup({
- agentId: 'a1', task, agent, effectiveSuccess: true, outputBuffer: '', prClaimVerified, noChangesToShip,
+ agentId: 'a1', task, agent, effectiveSuccess: true, outputBuffer: '', prClaimVerified, branchProvenEmpty,
});
// cleanupAgentWorktree(agentId, success, options) — options is the 3rd arg.
return cleanupAgentWorktree.mock.calls.at(-1)[2];
@@ -357,7 +357,7 @@ describe('runAgentCompletionCleanup — agentOpensOwnPr mirrors the prompt gate'
const prOpenedBy = stampFor({ providerId: 'claude-ollama', providerCommand: 'claude', leanMode: true });
const opts = await cleanupCallFor(
{ providerId: 'claude-ollama', providerCommand: 'claude', leanMode: true, prOpenedBy },
- { noChangesToShip: true },
+ { branchProvenEmpty: true },
);
expect(opts.prCreation).toBe('never');
});
@@ -510,7 +510,7 @@ describe('runSpawnerCompletionCleanup — the in-process spawners\' dispatch', (
// A task that asked for a PR from a run whose prompt hands it back to PortOS.
prOwnership: { taskOpenPR: true, prOpenedBy: 'portos', agentOpensOwnPr: false, prClaimExpected: false },
prClaimVerified: false,
- noChangesToShip: false,
+ branchProvenEmpty: false,
outputBuffer: 'out',
...overrides,
});
@@ -555,7 +555,7 @@ describe('runSpawnerCompletionCleanup — the in-process spawners\' dispatch', (
// to ship, so no PR is opened for an empty branch and no reviewer defaults
// are read for a follow-up that will never spawn.
it('never opens a PR when finalize proved there was nothing to ship', async () => {
- await runSpawnerCompletionCleanup(spawnerArgs({ noChangesToShip: true }));
+ await runSpawnerCompletionCleanup(spawnerArgs({ branchProvenEmpty: true }));
expect(cleanupAgentWorktree).toHaveBeenCalledWith('a1', true, expect.objectContaining({ prCreation: 'never' }));
expect(resolveReviewLoopOptions).not.toHaveBeenCalled();
diff --git a/server/services/agentFinalization.js b/server/services/agentFinalization.js
index f104c71597..9084fa4a47 100644
--- a/server/services/agentFinalization.js
+++ b/server/services/agentFinalization.js
@@ -63,6 +63,7 @@ import { usesCreativeDirectorScratchCwd, removeCreativeDirectorScratchCwd } from
import { issueNumberFromRef } from './issueReconcile.js';
import { isTruthyMeta } from '../lib/metadataFlags.js';
+import { permitsNoChangeCompletion } from '../lib/noChangeCompletion.js';
/**
* Release the execution lane and complete tool-execution tracking for a
* finishing agent. Pulled OUT of finalizeAgent so callers can fire it
@@ -124,7 +125,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, noChangesToShip = false, noChangeProof = null }) {
+export async function evaluateSuccessCriteria({ task, terminatedByUser, workspacePath, startedAt = null, success = false, hookResult = null, branchProvenEmpty = false, emptyBranchInconclusiveEvidence = null }) {
if (terminatedByUser) return null;
const taskType = task?.taskType || 'user';
// The SCHEDULED type (`metadata.analysisType`) if any, else the queue category —
@@ -148,16 +149,16 @@ export async function evaluateSuccessCriteria({ task, terminatedByUser, workspac
// 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
+ // `branchProvenEmpty` 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 && isVerifiedNoChangeTask(task)) return true;
+ if (success && branchProvenEmpty === true && permitsNoChangeCompletion(task)) return true;
// A marked no-change audit needs a forge answer and an unambiguous empty-branch
// proof. If either check was inconclusive, leave learning undeclared rather than
// scoring a correct no-op as a commit miss. A non-empty branch remains a real
// change path and still uses the ordinary commit criterion below.
- if (success && isVerifiedNoChangeTask(task) && noChangeProof?.inconclusive === true) return null;
+ if (success && permitsNoChangeCompletion(task) && emptyBranchInconclusiveEvidence?.inconclusive === true) return null;
// 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 =
@@ -287,11 +288,6 @@ function hasIssuePartialTrailer(body, issueNumber) {
return new RegExp(`\\b(refs?|part of)\\s+#${issueNumber}\\b`, 'i').test(body);
}
-function isVerifiedNoChangeTask(task) {
- return (isTruthyMeta(task?.metadata?.autonomousJob) || isTruthyMeta(task?.metadata?.isInvestigation))
- && isTruthyMeta(task?.metadata?.noChangeSuccess);
-}
-
/**
* The branch a finished agent's workspace is sitting on, or null when the
* workspace is gone / not a repo / detached. Read at finalize time, while the
@@ -443,7 +439,7 @@ function prVerdictFromObservation(observation) {
if (policy.category) verdict.category = policy.category;
if (observation.message) verdict.message = observation.message;
if (observation.advisory) verdict.advisory = observation.advisory;
- if (observation.outcome === PR_OBSERVATION.EMPTY_BRANCH) verdict.noChangesToShip = true;
+ if (observation.outcome === PR_OBSERVATION.EMPTY_BRANCH) verdict.branchProvenEmpty = true;
if (observation.outcome === PR_OBSERVATION.MISSING_PR) {
// Both facts ride the miss unconditionally: `commitsAhead` feeds the
// suggested fix, and an explicit `inconclusive: false` is what tells the
@@ -556,14 +552,14 @@ async function observePrClaim({ task, workspacePath, success, prExpected }) {
*
* Four outcome families, never collapsed:
* - `ok: true` — a PR exists with a valid claim trailer, or there was nothing to check
- * - `ok: true, noChangesToShip: true` — the forge answered "no PR" and the
+ * - `ok: true, branchProvenEmpty: true` — the forge answered "no PR" and the
* branch holds no commits, so there was nothing a PR could have been opened
* for; the run concluded that no change was warranted
* - `ok: false, category: 'pr-missing'` — the forge answered "no PR" for a
* branch that DOES hold commits
* - `ok: false, category: 'forge-unreachable'` — we could not ask
*
- * @returns {Promise<{ ok: boolean, category?: string, message?: string, branch?: string|null, noChangesToShip?: boolean, commitsAhead?: number|null, inconclusive?: boolean }>}
+ * @returns {Promise<{ ok: boolean, category?: string, message?: string, branch?: string|null, branchProvenEmpty?: boolean, commitsAhead?: number|null, inconclusive?: boolean }>}
* `inconclusive: true` is set for every requested check that cannot reach an
* unambiguous answer (no resolvable branch, unreachable forge, unreadable claim
* body, or unreadable commit count). It is omitted for a proven empty branch and
@@ -1178,8 +1174,8 @@ function resolvePrEvidence({ primaryObservation, noChangeObservation }) {
return {
completionOk: primary.completionOk,
completionVerdict: prVerdictFromObservation(primaryObservation),
- noChangesToShip: provenEmpty(primaryObservation) || provenEmpty(noChangeObservation),
- noChangeProof: noChangeObservation ? prVerdictFromObservation(noChangeObservation) : null,
+ branchProvenEmpty: provenEmpty(primaryObservation) || provenEmpty(noChangeObservation),
+ emptyBranchInconclusiveEvidence: noChangeObservation ? prVerdictFromObservation(noChangeObservation) : null,
// The branch the surviving evidence names, for the operator-facing log line.
evidenceBranch: evidence.branch || noChangeObservation?.branch || null,
ledgerEntry: evidencePolicy.recordable
@@ -1187,7 +1183,7 @@ function resolvePrEvidence({ primaryObservation, noChangeObservation }) {
verified: evidencePolicy.completionOk,
branch: evidence.branch,
category: evidencePolicy.category,
- noChangesToShip: provenEmpty(evidence),
+ branchProvenEmpty: provenEmpty(evidence),
}
: null,
cleanupEvidence: prVerdictFromObservation(evidence),
@@ -1238,7 +1234,7 @@ export async function finalizeAgent({
// A THROW here is not a verdict — fall back to the reported outcome rather
// than manufacturing a failure out of a check that never ran, and say so by
// NAME so the ledger gate below doesn't have to infer it from an empty result.
- const noChangeAudit = !terminatedByUser && reportedSuccess && isVerifiedNoChangeTask(task);
+ const noChangeAudit = !terminatedByUser && reportedSuccess && permitsNoChangeCompletion(task);
const primaryPrObservation = terminatedByUser
? prObservation(PR_OBSERVATION.SKIPPED)
: await observePrClaim({ task, workspacePath, success: reportedSuccess, prExpected })
@@ -1257,7 +1253,7 @@ export async function finalizeAgent({
task, workspacePath, success: reportedSuccess, agentId,
});
const prEvidence = resolvePrEvidence({ primaryObservation: primaryPrObservation, noChangeObservation });
- const noChangesToShip = prEvidence.noChangesToShip;
+ const branchProvenEmpty = prEvidence.branchProvenEmpty;
// Record the verdict in the lifecycle ledger (#4540) — but ONLY for an outcome
// the policy table marks recordable. The sparse result returns the same
@@ -1282,7 +1278,7 @@ export async function finalizeAgent({
verified,
branch: branch ?? null,
category: category ?? null,
- noChangesToShip: prEvidence.ledgerEntry.noChangesToShip,
+ branchProvenEmpty: prEvidence.ledgerEntry.branchProvenEmpty,
},
});
}
@@ -1355,7 +1351,7 @@ export async function finalizeAgent({
emitLog('warn', `⚠️ ${prCompletionVerdict.message} — recording ${agentId} as needs-attention (${prCompletionVerdict.category}) rather than complete`, {
agentId, taskId: task?.id, branch: prCompletionVerdict.branch, category: prCompletionVerdict.category
});
- } else if (noChangesToShip) {
+ } else if (branchProvenEmpty) {
// A no-op run is a legitimate completion, not a silent one — the human still
// wants to know a task burned an agent and concluded there was nothing to do.
emitLog('info', `🫧 ${agentId} opened no change request and committed nothing to ${prEvidence.evidenceBranch} — recording the run as complete with no change warranted`, {
@@ -1564,8 +1560,8 @@ export async function finalizeAgent({
startedAt: runStartedAt,
success: verdict.success,
hookResult,
- noChangesToShip,
- noChangeProof: prEvidence.noChangeProof,
+ branchProvenEmpty,
+ emptyBranchInconclusiveEvidence: prEvidence.emptyBranchInconclusiveEvidence,
})
.catch(err => {
emitLog('warn', `⚠️ Success-criteria validation failed for ${agentId}: ${err.message}`, { agentId });
diff --git a/server/services/agentFinalization.prVerification.test.js b/server/services/agentFinalization.prVerification.test.js
index 10e0a9d458..84abc99526 100644
--- a/server/services/agentFinalization.prVerification.test.js
+++ b/server/services/agentFinalization.prVerification.test.js
@@ -218,7 +218,7 @@ describe('verifyPrClaim (#3358)', () => {
findPullRequestForBranchMock.mockResolvedValue({ status: 'none', number: null, url: null, detail: null });
const verdict = await verifyPrClaim({ task: prTask(), workspacePath: '/w', success: true, prExpected: true });
expect(verdict.ok).toBe(true);
- expect(verdict.noChangesToShip).toBe(true);
+ expect(verdict.branchProvenEmpty).toBe(true);
expect(verdict.category).toBeUndefined();
});
@@ -408,7 +408,7 @@ describe('finalizeAgent — a PR-shaped run with no PR is not a success (#3358)'
expect(findPullRequestForBranchMock).toHaveBeenCalledWith('cos/sys-1/agent-1', { cwd: '/w', env: null });
const [, result] = completeAgentMock.mock.calls[0];
expect(result).toMatchObject({ success: true, validationPassed: true });
- expect(finalized.prVerdict).toMatchObject({ ok: true, branch: 'cos/sys-1/agent-1', noChangesToShip: true });
+ expect(finalized.prVerdict).toMatchObject({ ok: true, branch: 'cos/sys-1/agent-1', branchProvenEmpty: true });
});
it('leaves validation undeclared when a marked no-op audit cannot reach the forge', async () => {
@@ -591,10 +591,10 @@ describe('finalizeAgent — records the PR verdict in the lifecycle ledger', ()
data: expect.objectContaining({
verified: true,
branch: 'cos/sys-1/agent-1',
- noChangesToShip: true,
+ branchProvenEmpty: true,
})
})]);
- expect(finalized.prVerdict).toMatchObject({ branch: 'cos/sys-1/agent-1', noChangesToShip: true });
+ expect(finalized.prVerdict).toMatchObject({ branch: 'cos/sys-1/agent-1', branchProvenEmpty: true });
});
it('does not record a premature miss while cleanup can still create a PR', async () => {
@@ -721,7 +721,7 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
arrange: () => onBranch('claim/issue-1'),
success: true,
cleanupEvidence: { ok: true, branch: 'claim/issue-1' },
- ledger: { verified: true, branch: 'claim/issue-1', category: null, noChangesToShip: false },
+ ledger: { verified: true, branch: 'claim/issue-1', category: null, branchProvenEmpty: false },
},
{
name: 'verified-claim — a partial-ship trailer passes, carrying its advisory to cleanup',
@@ -731,7 +731,7 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
},
success: true,
cleanupEvidence: { ok: true, branch: 'claim/issue-1', advisory: expect.stringMatching(/partially ships/i) },
- ledger: { verified: true, branch: 'claim/issue-1', category: null, noChangesToShip: false },
+ ledger: { verified: true, branch: 'claim/issue-1', category: null, branchProvenEmpty: false },
},
{
name: 'invalid-trailer — a PR that does not close its issue fails and is NOT verified evidence',
@@ -742,7 +742,7 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
success: false,
completionReason: ISSUE_TRAILER_MISSING_CATEGORY,
cleanupEvidence: { ok: false, branch: 'claim/issue-1', category: ISSUE_TRAILER_MISSING_CATEGORY, message: anyMessage },
- ledger: { verified: false, branch: 'claim/issue-1', category: ISSUE_TRAILER_MISSING_CATEGORY, noChangesToShip: false },
+ ledger: { verified: false, branch: 'claim/issue-1', category: ISSUE_TRAILER_MISSING_CATEGORY, branchProvenEmpty: false },
},
{
name: 'missing-pr — commits on the branch, no PR',
@@ -754,7 +754,7 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
success: false,
completionReason: PR_MISSING_CATEGORY,
cleanupEvidence: { ok: false, branch: 'claim/issue-1', category: PR_MISSING_CATEGORY, message: anyMessage, commitsAhead: 3, inconclusive: false },
- ledger: { verified: false, branch: 'claim/issue-1', category: PR_MISSING_CATEGORY, noChangesToShip: false },
+ ledger: { verified: false, branch: 'claim/issue-1', category: PR_MISSING_CATEGORY, branchProvenEmpty: false },
},
{
name: 'missing-pr — an UNREADABLE commit count leaves the miss standing, flagged inconclusive',
@@ -766,7 +766,7 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
success: false,
completionReason: PR_MISSING_CATEGORY,
cleanupEvidence: { ok: false, branch: 'claim/issue-1', category: PR_MISSING_CATEGORY, message: anyMessage, commitsAhead: null, inconclusive: true },
- ledger: { verified: false, branch: 'claim/issue-1', category: PR_MISSING_CATEGORY, noChangesToShip: false },
+ ledger: { verified: false, branch: 'claim/issue-1', category: PR_MISSING_CATEGORY, branchProvenEmpty: false },
},
{
name: 'empty-branch — a PROVEN empty branch completes, and cleanup must not open a PR for it',
@@ -776,8 +776,8 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
findPullRequestForBranchMock.mockResolvedValue(noPr);
},
success: true,
- cleanupEvidence: { ok: true, branch: 'claim/issue-1', noChangesToShip: true },
- ledger: { verified: true, branch: 'claim/issue-1', category: null, noChangesToShip: true },
+ cleanupEvidence: { ok: true, branch: 'claim/issue-1', branchProvenEmpty: true },
+ ledger: { verified: true, branch: 'claim/issue-1', category: null, branchProvenEmpty: true },
},
{
name: 'forge-unavailable — the probe failed: the run is held, but NOTHING goes on the ledger',
@@ -852,9 +852,9 @@ describe('finalizeAgent — completion, ledger and cleanup evidence agree per ou
git.ahead = 0;
findPullRequestForBranchMock.mockResolvedValue(noPr);
const proven = await finalize({ prExpected: false, task: auditTask() });
- expect(proven.prVerdict).toEqual({ ok: true, branch: 'cos/sys-1/agent-1', noChangesToShip: true });
+ expect(proven.prVerdict).toEqual({ ok: true, branch: 'cos/sys-1/agent-1', branchProvenEmpty: true });
expect(prVerified().map((e) => e.data)).toEqual([
- { verified: true, branch: 'cos/sys-1/agent-1', category: null, noChangesToShip: true },
+ { verified: true, branch: 'cos/sys-1/agent-1', category: null, branchProvenEmpty: true },
]);
vi.clearAllMocks();
diff --git a/server/services/agentFinalization.successCriteria.test.js b/server/services/agentFinalization.successCriteria.test.js
index 138a1a26b2..45e98e8a24 100644
--- a/server/services/agentFinalization.successCriteria.test.js
+++ b/server/services/agentFinalization.successCriteria.test.js
@@ -365,7 +365,7 @@ describe('evaluateSuccessCriteria — commit criterion (#2344, #3637)', () => {
task,
workspacePath: '/w',
success: true,
- noChangesToShip: true,
+ branchProvenEmpty: true,
startedAt: STARTED_AT
})).toBe(true);
// The no-change proof came from verifyPrClaim's forge + branch checks; it
@@ -384,7 +384,7 @@ describe('evaluateSuccessCriteria — commit criterion (#2344, #3637)', () => {
task,
workspacePath: '/w',
success: true,
- noChangesToShip: false,
+ branchProvenEmpty: false,
startedAt: STARTED_AT
})).toBe(false);
expect(committedDuringRun).toHaveBeenCalledWith('/w', STARTED_AT);
@@ -396,7 +396,7 @@ describe('evaluateSuccessCriteria — commit criterion (#2344, #3637)', () => {
task: { id: 'ordinary-audit-1', taskType: 'internal', metadata: { autonomousJob: true } },
workspacePath: '/w',
success: true,
- noChangesToShip: true,
+ branchProvenEmpty: true,
startedAt: STARTED_AT
})).toBe(false);
expect(committedDuringRun).toHaveBeenCalledWith('/w', STARTED_AT);
@@ -409,7 +409,7 @@ describe('evaluateSuccessCriteria — commit criterion (#2344, #3637)', () => {
metadata: { autonomousJob: 'true', noChangeSuccess: 'true' }
};
expect(await evaluateSuccessCriteria({
- task, workspacePath: '/w', success: true, noChangesToShip: true, startedAt: STARTED_AT
+ task, workspacePath: '/w', success: true, branchProvenEmpty: true, startedAt: STARTED_AT
})).toBe(true);
expect(committedDuringRun).not.toHaveBeenCalled();
});
diff --git a/server/services/agentLifecycle.js b/server/services/agentLifecycle.js
index 61fbcba294..04cc1bf322 100644
--- a/server/services/agentLifecycle.js
+++ b/server/services/agentLifecycle.js
@@ -666,7 +666,7 @@ export async function handleAgentCompletion(agentId, exitCode, success, duration
});
if (finalized && typeof finalized.success === 'boolean') cleanupSuccess = finalized.success;
runnerPrClaimVerified = prClaimWasVerified(finalized?.prVerdict);
- runnerNoChangesToShip = finalized?.prVerdict?.noChangesToShip === true;
+ runnerNoChangesToShip = finalized?.prVerdict?.branchProvenEmpty === true;
} catch (err) {
finalizeError = err;
emitLog('error', `finalizeAgent threw for ${agentId} (continuing cleanup): ${err.message}`, { agentId, error: err.message });
@@ -676,7 +676,7 @@ export async function handleAgentCompletion(agentId, exitCode, success, duration
// pipeline progression, the Creative Director chain hook, and worktree
// cleanup (+ cleanup-warning notification and merge-recovery task). Runs
// inside this try so a throw still hits the finally below.
- await runAgentCompletionCleanup({ agentId, task, agent, effectiveSuccess: cleanupSuccess, outputBuffer, prClaimVerified: runnerPrClaimVerified, noChangesToShip: runnerNoChangesToShip });
+ await runAgentCompletionCleanup({ agentId, task, agent, effectiveSuccess: cleanupSuccess, outputBuffer, prClaimVerified: runnerPrClaimVerified, branchProvenEmpty: runnerNoChangesToShip });
// Surface a finalizeAgent throw to the caller after best-effort
// cleanup completed — without this the runner harness would never see
diff --git a/server/services/agentPromptBuilder.js b/server/services/agentPromptBuilder.js
index fa99139e9d..9b2e97787d 100644
--- a/server/services/agentPromptBuilder.js
+++ b/server/services/agentPromptBuilder.js
@@ -11,6 +11,7 @@ import { stat } from 'fs/promises';
import { getMemorySection } from './memoryRetriever.js';
import { getToolsSummaryForPrompt } from './tools.js';
import { isTruthyMeta } from '../lib/metadataFlags.js';
+import { permitsNoChangeCompletion } from '../lib/noChangeCompletion.js';
import { PATHS, tryReadFile } from '../lib/fileUtils.js';
import { loadSlashdoFile, loadSlashdoLib, writeResolvedSlashdoBody } from '../lib/slashdoLoader.js';
import { DEFAULT_REVIEWER, DEFAULT_REVIEW_STOP_MODE, isToolFreeReviewer, isCliReviewer, hasRequiredReviewer, resolveReviewerConfig } from '../lib/validation.js';
@@ -450,7 +451,7 @@ export async function buildAgentPrompt(task, config, workspaceDir, worktreeInfo
// is the JSON payload in the sentinel, not an API action — so it takes the
// programmatic-output contract ahead of the no-code one.
const sentinelPayloadOutput = isPublicReviewRestrictedProfile(task.metadata?.executionProfile) && !toolFreeReasoning;
- const noChangeSuccess = isTruthyMeta(task.metadata?.noChangeSuccess);
+ const noChangeSuccess = permitsNoChangeCompletion(task);
const isReadOnly = isTruthyMeta(task.metadata?.readOnly);
// The review-loop follow-up that addresses PR feedback and merges (spawned by
// the previous agent's cleanup hook). Its own procedure section renders far
@@ -936,7 +937,7 @@ function buildLightContextSections(task, workspaceDir, worktreeInfo, { isTui = t
const noCodeOutput = isTruthyMeta(task.metadata?.noCodeOutput) || !!task.metadata?.creativeDirector;
const toolFreeReasoning = isPublicReviewNoToolProfile(task.metadata?.executionProfile);
const sentinelPayloadOutput = isPublicReviewRestrictedProfile(task.metadata?.executionProfile) && !toolFreeReasoning;
- const noChangeSuccess = isTruthyMeta(task.metadata?.noChangeSuccess);
+ const noChangeSuccess = permitsNoChangeCompletion(task);
const isReviewLoopFollowUp = isTruthyMeta(task.metadata?.reviewLoopFollowUp);
const isWorktreeOnExistingBranch = isPrBranchWorktree(task, worktreeInfo);
// Ordered reviewer list + flags for the Review Loop (task metadata wins; else
diff --git a/server/services/agentPromptBuilder.test.js b/server/services/agentPromptBuilder.test.js
index 77c9d22584..45d265a47c 100644
--- a/server/services/agentPromptBuilder.test.js
+++ b/server/services/agentPromptBuilder.test.js
@@ -1639,6 +1639,17 @@ describe('buildLightContextPrompt', () => {
expect(prompt).not.toMatch(/PortOS will push and open the PR/);
});
+ it('offers no-change guidance only where finalize will honour it (marker alone is not enough)', () => {
+ const build = (metadata) => buildLightContextPrompt(
+ makeTask({ metadata: { noChangeSuccess: true, useWorktree: true, openPR: true, ...metadata } }),
+ '/r',
+ { branchName: 'b', worktreePath: '/tmp/wt' },
+ { isTui: false, providerId: 'codex', providerCommand: 'codex' });
+ expect(build({})).not.toMatch(/no change is needed/i);
+ expect(build({ autonomousJob: true })).toMatch(/no change is needed/i);
+ expect(build({ isInvestigation: true })).toMatch(/no change is needed/i);
+ });
+
it('gives a marked catalog audit an explicit no-change exit while retaining the change workflow', () => {
const task = makeTask({ metadata: {
autonomousJob: true,
diff --git a/server/services/agentTuiSpawning/sessionController.js b/server/services/agentTuiSpawning/sessionController.js
index 4a27c0f530..5a8db606af 100644
--- a/server/services/agentTuiSpawning/sessionController.js
+++ b/server/services/agentTuiSpawning/sessionController.js
@@ -860,7 +860,7 @@ export function createTuiSessionController({
* threw — a memory-extraction crash would otherwise strand the worktree and
* the shell session on disk.
*/
- const releaseRunResources = async ({ agentData, cleanupSuccess, prClaimVerified, noChangesToShip }) => {
+ const releaseRunResources = async ({ agentData, cleanupSuccess, prClaimVerified, branchProvenEmpty }) => {
// Pipeline progression → worktree cleanup with the PR disposition →
// sentinel removal → retry-hold release, in the one owner every completion
// path shares. Caught so a throw there cannot skip the in-memory teardown
@@ -871,7 +871,7 @@ export function createTuiSessionController({
success: cleanupSuccess,
prOwnership,
prClaimVerified,
- noChangesToShip,
+ branchProvenEmpty,
outputBuffer: getOutputBuffer(),
}).catch(err => emitLog('warn', `TUI completion cleanup failed for ${agentId}: ${err.message}`, { agentId }));
if (sentinel.cleanup) {
@@ -1074,7 +1074,7 @@ export function createTuiSessionController({
// throw from finalize itself skips the assignment entirely — in all three
// cases nothing was verified, so cleanup must ask rather than stand down.
let prClaimVerified = false;
- let noChangesToShip = false;
+ let branchProvenEmpty = false;
// try/finally so a throw from finalizeAgent (e.g. processAgentCompletion
// hook crash) still runs the local cleanup — sentinel removal, the shared
@@ -1108,9 +1108,9 @@ export function createTuiSessionController({
});
if (finalizeVerdict && typeof finalizeVerdict.success === 'boolean') cleanupSuccess = finalizeVerdict.success;
prClaimVerified = prClaimWasVerified(finalizeVerdict?.prVerdict);
- noChangesToShip = finalizeVerdict?.prVerdict?.noChangesToShip === true;
+ branchProvenEmpty = finalizeVerdict?.prVerdict?.branchProvenEmpty === true;
} finally {
- await releaseRunResources({ agentData, cleanupSuccess, prClaimVerified, noChangesToShip });
+ await releaseRunResources({ agentData, cleanupSuccess, prClaimVerified, branchProvenEmpty });
}
};
diff --git a/server/services/autonomousJobs/portosCliCatalogRefresh.js b/server/services/autonomousJobs/portosCliCatalogRefresh.js
index 8a420fe5e4..fca62955fe 100644
--- a/server/services/autonomousJobs/portosCliCatalogRefresh.js
+++ b/server/services/autonomousJobs/portosCliCatalogRefresh.js
@@ -73,7 +73,7 @@ export const PORTOS_CLI_CATALOG_REFRESH_JOB = Object.freeze({
type: 'agent',
promptTemplate: PORTOS_CLI_CATALOG_REFRESH_PROMPT,
// A verified empty branch is a valid result for this audit. The finalizer
- // consumes this marker only alongside verifyPrClaim's noChangesToShip proof;
+ // consumes this marker only alongside verifyPrClaim's branchProvenEmpty proof;
// it is not a general commit-criterion exemption.
taskMetadata: { useWorktree: true, openPR: true, simplify: true, noChangeSuccess: true },
providerId: null,
diff --git a/server/services/cleanupAgentWorktree.test.js b/server/services/cleanupAgentWorktree.test.js
index 9a9c887a41..3d41c11393 100644
--- a/server/services/cleanupAgentWorktree.test.js
+++ b/server/services/cleanupAgentWorktree.test.js
@@ -590,7 +590,7 @@ describe('cleanupAgentWorktree - PR-creation path', () => {
});
it('stands down when the branch holds no commits — there was nothing to open a PR for', async () => {
- verifyPrClaimMock.mockResolvedValue({ ok: true, noChangesToShip: true, branch: 'cos/task-abc123' });
+ verifyPrClaimMock.mockResolvedValue({ ok: true, branchProvenEmpty: true, branch: 'cos/task-abc123' });
await cleanupAgentWorktree('agent-1', true, netOpts);
@@ -2320,7 +2320,7 @@ describe('resolveWorktreeDisposition', () => {
[false, 'never', null, {}, 'merge-or-preserve', false, true],
[true, 'if-missing', { category: 'pr-missing' }, {}, 'open-pr', false, false],
[true, 'if-missing', { ok: true, branch: 'example' }, {}, 'stand-down', true, false],
- [true, 'if-missing', { ok: true, branch: 'example', noChangesToShip: true }, {}, 'stand-down', true, false],
+ [true, 'if-missing', { ok: true, branch: 'example', branchProvenEmpty: true }, {}, 'stand-down', true, false],
[true, 'if-missing', { ok: true, branch: null }, {}, 'stand-down-uncertain', true, true],
[true, 'if-missing', { category: 'forge-unreachable' }, {}, 'stand-down-uncertain', true, true],
[true, 'if-missing', null, {}, 'stand-down-uncertain', true, true],