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: retain unavailable runtime resume evidence without blocking other holds (#13484)

Adam Eivya4276527b9e0
diff --git a/server/services/agentWorktreeCleanup.js b/server/services/agentWorktreeCleanup.js
index 3e47aa7987..1328e5b368 100644
--- a/server/services/agentWorktreeCleanup.js
+++ b/server/services/agentWorktreeCleanup.js
@@ -23,6 +23,7 @@ import { getAgents } from './cosAgentLifecycle.js';
import * as git from './git.js';
import { resolveTaskHookType } from './taskTypeHooks.js';
import { removeWorktree, classifyWorktreeDirt, listWorktrees } from './worktreeManager.js';
+import { hasClaimFlowContract } from '../lib/claimFlowTaskTypes.js';
import { claimContinuationPointer } from '../lib/claimContinuation.js';
import { isTruthyMeta } from './agentState.js';
import { PATHS } from '../lib/fileUtils.js';
@@ -1496,6 +1497,7 @@ export async function spawnMergeRecoveryTask(cleanupWarnings, agentId, task, app
async function runtimeResumePatch({ task, agentId, agentMetadata }) {
const claim = await resolveClaimContinuationPatch({ task, agentId, agentMetadata });
if (claim) return claim;
+ if (hasClaimFlowContract(task)) throw new Error('Runtime verification claim checkout identity is unavailable; retain the prerequisite');
if (!agentMetadata?.isWorktree || agentMetadata.isPersistentWorktree) return {};
const branch = agentMetadata.worktreeBranch;
const path = agentMetadata.workspacePath || join(PATHS.worktrees, agentId);
diff --git a/server/services/runtimeVerification.js b/server/services/runtimeVerification.js
index bdd5784755..cdab2ca025 100644
--- a/server/services/runtimeVerification.js
+++ b/server/services/runtimeVerification.js
@@ -108,7 +108,11 @@ export async function sweepRuntimeVerifications() {
// finalization, resetting budgets or declaring checkout retirement complete.
if (m.runtimeVerificationReadyAgentId !== p.agentId) {
const { releaseRetryHold } = await import('./agentWorktreeCleanup.js');
- await releaseRetryHold({ agentId: p.agentId, task: { ...task, taskType }, success: false, agentMetadata: owner.metadata });
+ await releaseRetryHold({ agentId: p.agentId, task: { ...task, taskType }, success: false, agentMetadata: owner.metadata })
+ .catch(async () => {
+ await updateTask(task.id, { metadata: { blockedReason: 'Runtime prerequisite retained: original checkout resume evidence is unavailable.' } }, taskType,
+ { expectedStatus: 'blocked', expectedMetadata: { runtimeVerificationId: m.runtimeVerificationId, deliveryDecisionAgentId: p.agentId } });
+ });
continue;
}
const boot = getBootCommit();
diff --git a/server/services/runtimeVerification.test.js b/server/services/runtimeVerification.test.js
index 2263bda924..033ccca9dd 100644
--- a/server/services/runtimeVerification.test.js
+++ b/server/services/runtimeVerification.test.js
@@ -13,7 +13,7 @@ vi.mock('./cosState.js', async () => ({
}));
vi.mock('./cosAgentLifecycle.js', () => ({ getAgentRecord: vi.fn(async () => facts.owner) }));
vi.mock('./cosEvents.js', () => ({ emitLog: vi.fn(), cosEvents: { emit: vi.fn() } }));
-vi.mock('./settings.js', () => ({ getSettingsWithStatus: vi.fn(async () => ({ corrupt: false, settings: { autoUpdate: { enabled: false } } })) }));
+vi.mock('./settings.js', async original => ({ ...(await original()), getSettingsWithStatus: vi.fn(async () => ({ corrupt: false, settings: { autoUpdate: { enabled: false } } })) }));
vi.mock('./installState.js', () => ({ getBootCommit: () => facts.boot }));
vi.mock('../lib/gitRemote.js', () => ({ getOriginInfo: vi.fn(async () => ({ isGithub: true, host: 'github.com', fullName: 'example/PortOS' })) }));
vi.mock('./github.js', () => ({ execGh: vi.fn(async args => {