feat: add reopen trigger and guard role changes in manage_items#59
Merged
feat: add reopen trigger and guard role changes in manage_items#59
Conversation
Close the last workflow bypass: manage_items(update) can no longer set role directly — all role changes must go through advance_item triggers. Add reopen trigger (TERMINAL → QUEUE) with cascade support: when a child reopens under a terminal parent, the parent auto-cascades to WORK. Changes: - RoleTransitionHandler: add resolveReopen + validation bypass for backward TERMINAL→QUEUE transition - CascadeDetector: add detectReopenCascades (immediate parent only) - AdvanceItemTool: wire reopen cascade, update description/triggers - ManageItemsTool: reject role field in update with clear error message - GetNextStatusTool: terminal message now mentions reopen option - Docs: api-reference.md and workflow-guide.md updated - Tests: reopen lifecycle, cascade, role guard, integration tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Extract applyCascadeEvents() helper in AdvanceItemTool to deduplicate Phase 4b (start cascade) and Phase 4c (reopen cascade) blocks - Remove dead newRole variable and redundant extractItemString call in ManageItemsTool role guard — use containsKey check instead Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Both test sections are additive: HEAD adds reopen trigger tests, origin/main adds guidancePointer + noteProgress tests. Keep both. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
advance_item(trigger="reopen")moves TERMINAL items back to QUEUE, clearing statusLabel and bypassing gate enforcement. Cascades parent from TERMINAL → WORK when a child reopens.manage_items(update)now rejects therolefield with a clear error directing users toadvance_item. This closes the last backdoor around the workflow engine.Test plan
./gradlew :current:test)reopenfrom TERMINAL resolves to QUEUEreopenfrom non-terminal returns errorreopenclears statusLabel (cancelled items)manage_items(update, role=...)rejected with clear errormanage_items(create, role=...)still works (regression)🤖 Generated with Claude Code