refactor(prompt-session): own bundle outcome behind resolve()#91
Merged
Conversation
Both adapters re-derived the gate→bundle branch order and the bundle-resolution try/except. Move it into PromptSession.resolve(), which returns a closed Outcome (ALLOWED/UNKNOWN_TASK/SCAN_REQUIRED/ MISSING); CLI and MCP now only encode that into exit codes / JSON-RPC. Scan-state signal sourcing stays per-adapter (ADR-0001): each still injects scan_satisfied and MCP sets scan_called on an allowed scan. CLI rc 0/1/2 and MCP -32602/-32000/-32603 unchanged. Closes #82 Co-Authored-By: Claude Opus 4.8 <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.
What
Move the gate→bundle branch order and bundle-resolution try/except out of the CLI and MCP adapters into
PromptSession.resolve(), which returns a closedOutcome(ALLOWED/UNKNOWN_TASK/SCAN_REQUIRED/MISSING). Adapters now only encode that Outcome into their surface — exit codes for CLI, JSON-RPC for MCP.Why
Both adapters previously re-derived the same branch order and the same
bundle_fortry/except. That duplicated logic is the deepening opportunity from the architecture review (#82): one deep seam, two thin encoders.Boundary preserved (ADR-0001)
Scan-state signal sourcing stays per-adapter: each injects its own
scan_satisfied, and MCP still setsscan_calledon an allowedscancall. Only the rule is unified, not the signal.Behavior
0/1/2unchanged (pinned bytest_cli.py).-32602/-32000/-32603unchanged (pinned bytest_mcp_server.py).cmd_refreshno longer builds a syntheticargparse.Namespace.Tests
291 passed(pytest) +11 pass(node --test).Closes #82
🤖 Generated with Claude Code