Skip to content

fix: recover completed plan work through explicit acceptance - #1911

Merged
santoshkumarradha merged 12 commits into
devfrom
fix/completed-plan-recovery
Oct 23, 2026
Merged

santoshkumarradha merged 12 commits into
devfrom
fix/completed-plan-recovery

Conversation

@santoshkumarradha

@santoshkumarradha santoshkumarradha commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

A plan that finished before its engine restarted could reopen as interrupted, with saved files but no working acceptance door. Recovery now restores the existing explicit accept/refute decision, preserving its copy, crew, completion time and full worker/checker cost. It does not rerun finished work or automatically merge it, including with unattended approvals enabled.

Acceptance uses the existing landing path and records the actual commit. Conversation ownership, saved-branch checks and Stop admission remain enforced. Missing copies and failed checkpoint/page-receipt writes report actionable, truthful outcomes. If the last checkpoint predates the final charge, its price is restored from the existing ledger without charging again.

Validation with fictional data:

  • Real terminal and engine: complete a worker/checker task, interrupt before landing, reconnect the same window, inspect preserved files, explicitly accept the restored card, and independently rerun the saved check in the landed checkout. The receipt's commit must be an ancestor of the resulting project HEAD.
  • Live OpenRouter run: PASS in 21.38 s; all 24 recorded model receipts used exactly deepseek/deepseek-v4.1-flash, including auxiliary roles. Full task ledger and recovered/accepted receipt stayed at $0.007849236. Restart and acceptance added no model calls or charges.
  • Scripted-provider real-engine run: PASS in 14.77 s; worker plus checker ledger, recovered/accepted receipt and displayed task price all matched $0.04. This is a separate deterministic test, not live-model evidence.
  • Focused and race checks cover repeated restart, explicit acceptance/refusal, worker scope, Stop ordering, missing copies, changed branches, archived plans beside newer work, foreign conversations, receipt failures and cost restoration. make pr-ready passed. Its classifier reproduced the unrelated TestLowCreditReadSwapsOnlyAnUntouchedImplicitConversation failure on unchanged dev; that existing failure is not claimed fixed here.

Reproduce after make build:

go test -tags e2e ./internal/e2e -run '^TestCompletedPlanRecoversAndAcceptsOnTheRealEngine$' -count=1 -v -timeout 5m
CODEAF_E2E_MODEL=deepseek/deepseek-v4.1-flash go test -tags e2e ./internal/e2e -run '^TestCompletedPlanRecoveryLiveWorkflow$' -count=1 -v -timeout 5m

The live command requires a configured OpenRouter key; every role must remain on the recorded model.

Closes #1657.

@santoshkumarradha
santoshkumarradha marked this pull request as ready for review October 23, 2026 05:21
@santoshkumarradha
santoshkumarradha merged commit b14ddcd into dev Oct 23, 2026
8 checks passed
@santoshkumarradha
santoshkumarradha deleted the fix/completed-plan-recovery branch October 23, 2026 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A task whose plan finished just before an engine restart reads interrupted and cannot be landed

1 participant