Adapt heartbeat/task-runner/turn-context to lockMode=none first-class path

- heartbeat.ts and task-runner.ts now share a single ResolveWorkspaceFn
  signature exported from run-dispatch.ts. Callers handle
  WorkspaceConfigurationError explicitly:
    * heartbeat: release the task lease and skip with new
      workspace_unresolved reason (task re-enters pool next heartbeat)
    * task-runner: release the lease and return WORKSPACE_UNRESOLVED
      to the caller
  No silent fallback to a random shared workspace.
- crash-recovery.ts imports WorkspaceConfigurationError for clean
  catch-branch attribution; the outer try already rolls back the
  queued run on any resolve failure.
- run-dispatch.ts exposes ResolveWorkspaceFn so downstream modules
  type their injected resolver against the same shape (single source
  of truth).
- HeartbeatSkipReason gains workspace_unresolved to keep the closed
  enum honest about all heartbeat exit paths.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-20 15:32:55 -04:00
1 parent 28cdf7c56f
commit 2dd62e5338
4 files changed
+71 -15

No files matched your search

+4 -1
View File
@@ -1,5 +1,8 @@
import type { WorkerServiceDependencies } from "./types";
import { resolveWorkspaceWithLockMode } from "../../orchestration/resolve-workspace";
import {
resolveWorkspaceWithLockMode,
WorkspaceConfigurationError,
} from "../../orchestration/resolve-workspace";
export function handleWorkerExit(
code: number | null,