Skip to content

fix(context-cli): finish task rollbacks with an unfinished production stage - #107

Merged
qiansc merged 1 commit into
mainfrom
fix/task-rollback-unfinished-production
Nov 13, 2026
Merged

qiansc merged 1 commit into
mainfrom
fix/task-rollback-unfinished-production

Conversation

@qiansc

@qiansc qiansc commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary

context task rollback could deadlock when the workspace had an unfinished production stage, and its cleanup could remove production that the rollback did not cover.

  • Deadlock: the rollback Route asks for context close, but close still required the unfinished production stage to be complete (production-not-complete), while that stage is only removed by the rollback cleanup that runs after close and build.
  • Scope: abandoning a page revision that interrupted production (files: []) ended by deleting the whole production stage, although such a revision normally retires only its own pointer and lets production resume.
  • Partial delivery: with a partial delivery selected and its article rolled back, build kept checking the stale selection ("No reviewed articles can be delivered"), so the rollback could not finish.
  • Disclosure: the rollback preview listed candidates and ledger tasks only; it did not say that the production stage, its unfinished tasks and its working directory would be deleted.

Changes

  • close accepts an active task rollback for the required-article check; the rollback already discards its draft candidates.
  • A rollback records whether it discards the current production stage (whole task) or only the page revision that interrupted it. Finishing a revision-only rollback removes just its pointer and production resumes unchanged; a stage that changed after the rollback was applied is refused instead of deleted.
  • The preview adds production with effect (discard-whole-task / keep), unfinished_tasks and deleted_working_directory; the knowledge-updates guide asks the Agent to state it before applying.
  • While a rollback is active, build neither checks nor finishes a partial-delivery selection; the rollback cleanup settles it.
  • Lifecycle cleanup removes production before the revision/rollback pointer, so a failed cleanup can be retried.
  • CHANGELOG: Unreleased entry.

Tests

  • Rollback with an unfinished production stage (with approved articles and on a cold start) closes, builds and clears the stage; the preview discloses the stage.
  • Abandoning a revision that interrupted production keeps production unchanged (fails before this change: the stage was deleted).
  • Rolling back the only article selected for a partial delivery no longer blocks build (fails before this change).
  • 46 related test files (rollback, close, build, production, revision, maintenance, delivery, knowledge updates) pass.

Compatibility

Rollback states written before this change have no production record; finishing them discards the current stage as before.

🤖 Generated with Claude Code

… stage

Close and build accept an active task rollback; the rollback records whether it
discards the current production stage or only a page revision that interrupted
it, discloses that in the preview, skips a stale partial-delivery selection
during build, and removes production before its own pointer at cleanup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qiansc
qiansc merged commit 6493a05 into main Nov 13, 2026
2 checks passed
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.

1 participant