Imports the previously untracked working tree as-is so that the review changes that follow (requirements -> design -> implementation) can be reviewed as diffs and reverted if needed. No content changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
WishForge durable worker contracts
Run four separate roles: coordinator (wishforge-runs), deployer
(wishforge-deliveries), and isolated per-run executor/verifier workers. Executor and
verifier queues include tenant ID, run ID and execution generation:
wishforge-{executor|verifier}-{tenantId}-{runId}-{generation}. Their signed service
tokens and WF_SANDBOX_GENERATION must agree with the current control-plane run.
A user-authorized resume creates a new generation and invalidates the old one.
The Temporal workflow does not automatically repeat model, verification/build or release activities after an unknown result. These activities have one attempt and a five-minute schedule-to-start timeout. Executor and verifier heartbeats detect a lost worker in 45 seconds. A failure records one of:
worker_unavailable: the assigned task queue had no worker within five minutes.ambiguous_execution: the activity started but no confirmed result is available.
The workflow remains durable and waits for an explicit resume. Only idempotent
recordWaiting state synchronization retries automatically, including waiting for a
previous lease to expire; it does not invoke a provider, build or release. A new
generation cancels obsolete activities and prevents old waiting records from
clobbering the newly queued run. Duplicate old-generation signals are ignored.
Normal workflow cancellation propagates to Temporal as cancellation.
Resumption examines persisted artifacts first. A checkpoint at verification or
later skips the builder. Existing verification/build evidence is reused to request
its release. An existing release is reconciled rather than rebuilt or resubmitted.
Only the control plane's independently accepted succeeded state is interpreted as
completed delivery. Builder output and successful activity execution are not delivery.
verifyRun restores the portable Git checkpoint into its own volume. Executor paths
are never used as verifier input. Both verification and build evidence carry the
current verifier fencing token. Provider metering IDs include that lease token, so
retry/repair events with restarted sequence numbers do not silently disappear.
Validation
Unit contracts: npx vitest run apps/worker/test/recovery.test.ts.
Real Temporal history/replay with explicit fixture activities:
WF_TEMPORAL_INTEGRATION=1 npx vitest run tests/integration/temporal.test.ts
Add WF_TEMPORAL_TIMEOUT_ACCEPTANCE=1 to exercise the actual five-minute unstaffed
queue timeout (the test intentionally takes at least five minutes). These tests use
the separate wishforge-contract-tests namespace and unique run/generation IDs.
They stop and recreate real SDK workers, replay persisted histories, check failure
handling, cancel obsolete generations, and verify releases are not duplicated.
Run this fixture suite serially: its coordinator/delivery queues are shared within
that test namespace. No API keys, real models, production deployments, or relaxed
sandbox settings are used. Workflow contract acceptance does not establish live
provider or Kata-cluster acceptance.
Production also requires an independent acceptance profile. The verifier checks its root-owned scripts and pinned digests outside the source tree; repository tests remain supplemental. Profile replacement invalidates old evidence, build authorization and release approval.