Slice 4 hardening: bounded resolver, terminal states, reconciliation #21

Merged
puter merged 1 commits from t3code/review-slices-sandbox-next into master 2026-07-27 18:39:09 +00:00
Owner

Closes review findings on the Slices 2-4 work so Slice 5 can build on a sound resolver contract.

Resolver primitives

  • resolveOutcome decides retry-within-budget vs terminal; removed the no-op isTerminalClassification.
  • WORK_STATUS_FOR_OUTCOME preserves the real terminal Work status instead of collapsing everything back to ready.
  • Lifecycle: completed is terminal, cancelled reopens only to ready, invalid reopenings removed.

Execution

  • finishAttempt replaces completeAttempt: auto-retries within the kit budget and settles Work at the real classification (Succeeded->completed, PermanentFailure/BudgetExhausted->failed, NeedsInput->needs-input, Blocked->blocked).
  • startSimulatedExecution validates sliceId against the approved Design and advances slice status.
  • retrySimulatedExecution is now an explicit, guarded restart.
  • reconcileExpiredAttempts is bounded; crons.ts sweeps every 30s.

Planning

  • saveDefinition/saveDesign reject revision during execution.
  • submitQuestion persists durable questions; design revision invalidates approvals.

Verification

Primitives 69 tests (+4); backend 22 tests (+10). Root typecheck, web+agents build, and Ultracite gate pass.

Closes review findings on the Slices 2-4 work so Slice 5 can build on a sound resolver contract. ## Resolver primitives - `resolveOutcome` decides retry-within-budget vs terminal; removed the no-op `isTerminalClassification`. - `WORK_STATUS_FOR_OUTCOME` preserves the real terminal Work status instead of collapsing everything back to `ready`. - Lifecycle: `completed` is terminal, `cancelled` reopens only to `ready`, invalid reopenings removed. ## Execution - `finishAttempt` replaces `completeAttempt`: auto-retries within the kit budget and settles Work at the real classification (`Succeeded`->`completed`, `PermanentFailure`/`BudgetExhausted`->`failed`, `NeedsInput`->`needs-input`, `Blocked`->`blocked`). - `startSimulatedExecution` validates `sliceId` against the approved Design and advances slice status. - `retrySimulatedExecution` is now an explicit, guarded restart. - `reconcileExpiredAttempts` is bounded; `crons.ts` sweeps every 30s. ## Planning - `saveDefinition`/`saveDesign` reject revision during execution. - `submitQuestion` persists durable questions; design revision invalidates approvals. ## Verification Primitives 69 tests (+4); backend 22 tests (+10). Root typecheck, web+agents build, and Ultracite gate pass.
puter added 1 commit 2026-07-27 18:38:52 +00:00
Addresses review findings before Slice 5 sandbox work.

Resolver primitives:
- resolveOutcome maps an attempt outcome to retry-or-terminal; removed the
  no-op isTerminalClassification.
- WORK_STATUS_FOR_OUTCOME preserves real terminal Work status instead of
  collapsing everything back to ready.
- Lifecycle: completed is terminal, cancelled reopens only to ready, and the
  invalid awaiting-design-approval -> awaiting-definition-approval reopening
  is gone.

Execution (workExecution.ts):
- finishAttempt replaces completeAttempt: auto-retries within the kit budget
  and settles Work at the real classification (Succeeded->completed,
  PermanentFailure/BudgetExhausted->failed, NeedsInput->needs-input,
  Blocked->blocked). No Work stays silently runnable after a failure.
- startSimulatedExecution validates sliceId against the current approved
  Design (foreign ids rejected; defaults to the first slice) and advances
  slice status running -> completed/ready.
- retrySimulatedExecution is now an explicit user restart with a retryable-
  state guard, not the automatic resolver path.
- reconcileExpiredAttempts is bounded: a dead lease terminates as Blocked,
  resumes within budget or settles the Run/Work so nothing runs forever.
- crons.ts runs the reconciler every 30s, string-referenced so it does not
  depend on the stale codegen.

Planning (workPlanning.ts):
- saveDefinition/saveDesign reject revision while a Run is executing.
- submitQuestion validates and persists a durable workQuestions row instead
  of discarding planner questions.
- Design revision invalidates active design approvals.

Verification: primitives 69 tests (+4), backend 22 tests (+10) covering
retry/cancel/failure/restart, slice validation, reconciliation, the
revision guard, and question persistence. Root typecheck, web+agents build,
and the configured Ultracite gate (53 files) all pass.

package.json: the recurring check gate now covers workExecution, workPlanning,
crons, resolver, and work-lifecycle.
puter merged commit 0e32c35515 into master 2026-07-27 18:39:09 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: puter/zopu-code#21
No description provided.