mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-17 04:21:24 +01:00
fix(recovery): admit a fresh isolated continuation whose task lost its workspace binding
The fallback clears the task's workspace binding when it isolates a continuation, and the run then prepares a new workspace (create_new). The admission preflight still required that binding for an isolated task with no project, so it refused the continuation wake as workspace_worktree_requires_project every 15 s, re-blocked the task and added a comment each time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ade7e0643f
commit
a89e7918d9
3 files changed
+20
-1
No files matched your search
@@ -94,7 +94,11 @@ export function isUnrunnableWorktreeCombo(input: {
|
||||
resolvedStrategy: string | null | undefined;
|
||||
reusableExecutionWorkspaceAvailable?: boolean | null;
|
||||
hasResolvablePriorSessionWorkspace?: boolean | null;
|
||||
/** The wake continues a cut-off run in a new isolated workspace that the run
|
||||
* prepares itself (`create_new`); it never needs the task's old binding. */
|
||||
freshIsolatedContinuation?: boolean | null;
|
||||
}): boolean {
|
||||
if (input.freshIsolatedContinuation === true) return false;
|
||||
if (input.resolvedMode !== "isolated_workspace" && input.resolvedMode !== "operator_branch") return false;
|
||||
if (input.resolvedStrategy !== "git_worktree") return false;
|
||||
if (input.issue.projectId || input.issue.projectWorkspaceId) return false;
|
||||
|
||||
@@ -305,6 +305,19 @@ export async function readFreshContinuationReadiness(db: Db, run: Pick<typeof he
|
||||
return { mode: "fresh_isolated_workspace" as const, retryIntentId: recordId, sourceRunId, retainedSourceIds: [] as string[] };
|
||||
}
|
||||
|
||||
/**
|
||||
* True when a wake continues a cut-off run in a new isolated workspace. The
|
||||
* fallback cleared the task's workspace binding on purpose, and the run
|
||||
* prepares a new workspace itself, so admission must not refuse the wake for
|
||||
* lacking that binding (it would refuse it forever).
|
||||
*/
|
||||
export async function isFreshIsolatedContinuationWake(db: Db, input: { companyId: string; issueId: string;
|
||||
contextSnapshot: Record<string, unknown> | null | undefined }) {
|
||||
if (typeof object(input.contextSnapshot).freshContinuationIsolation !== "string") return false;
|
||||
return (await readFreshContinuationReadiness(db, { id: "", companyId: input.companyId,
|
||||
contextSnapshot: input.contextSnapshot ?? {} }, input.issueId)) !== null;
|
||||
}
|
||||
|
||||
export async function ensureFreshContinuation(db: Db, input: Input): Promise<FreshContinuationResult> {
|
||||
return db.transaction(tx => continueFreshInTransaction(tx as unknown as Db, input));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { connectionIntentService } from "../connection-intents.js";
|
||||
import { verifyBlockerStallWake } from "../recovery/blocker-stall-wakeups.js";
|
||||
import { CONTEXT_COMPACTION_WAKE_REASON, ContextCompactionError, isContextCompactionRun, readContextCompactionRequest } from "../context-compaction.js";
|
||||
import { isProcessRunAdmissionClosed } from "./run-admission.js";
|
||||
import { continueFreshInTransaction, hasPendingFreshContinuation, settleCoalescedFreshContinuationHolds } from "../fresh-continuation-fallback.js";
|
||||
import { continueFreshInTransaction, hasPendingFreshContinuation, isFreshIsolatedContinuationWake, settleCoalescedFreshContinuationHolds } from "../fresh-continuation-fallback.js";
|
||||
import { refreshRunStartYieldIfStale } from "../run-start-handover.js";
|
||||
import { deliveredQueuedCommentIds } from "../queued-comment-delivery.js";
|
||||
import { hasAutomaticInteractionDeliveryHold, INTERACTION_DELIVERY_DENIED, recheckQueuedRunInteractions, withInteractionDeliveryOrigin } from "../agent-interaction-delivery.js";
|
||||
@@ -4273,6 +4273,8 @@ export function createHeartbeatQueue(db: Db, dependencies: HeartbeatQueueDepende
|
||||
reusableExecutionWorkspaceAvailable:
|
||||
reuseRequest.existingExecutionWorkspaceAvailable,
|
||||
hasResolvablePriorSessionWorkspace,
|
||||
freshIsolatedContinuation: await isFreshIsolatedContinuationWake(tx as unknown as Db, {
|
||||
companyId: issue.companyId, issueId: issue.id, contextSnapshot: enrichedContextSnapshot }),
|
||||
})
|
||||
) {
|
||||
if (caseRequest) waitForCaseAdmission(WORKSPACE_WORKTREE_REQUIRES_PROJECT_CODE, WORKSPACE_WORKTREE_REQUIRES_PROJECT_MESSAGE);
|
||||
|
||||
Reference in new issue
Block a user