Skip to content

refactor(prompt-session): own bundle outcome behind resolve()#91

Merged
derek-palmer merged 1 commit into
mainfrom
feat/prompt-session-resolve-outcome
May 30, 2026
Merged

refactor(prompt-session): own bundle outcome behind resolve()#91
derek-palmer merged 1 commit into
mainfrom
feat/prompt-session-resolve-outcome

Conversation

@derek-palmer
Copy link
Copy Markdown
Owner

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 closed Outcome (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_for try/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 sets scan_called on an allowed scan call. Only the rule is unified, not the signal.

Behavior

  • CLI rc 0/1/2 unchanged (pinned by test_cli.py).
  • MCP -32602/-32000/-32603 unchanged (pinned by test_mcp_server.py).
  • cmd_refresh no longer builds a synthetic argparse.Namespace.

Tests

291 passed (pytest) + 11 pass (node --test).

Closes #82

🤖 Generated with Claude Code

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>
@derek-palmer derek-palmer merged commit f9dd50b into main May 30, 2026
12 checks passed
@derek-palmer derek-palmer deleted the feat/prompt-session-resolve-outcome branch May 30, 2026 14:42
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.

Unify bundle outcome → surface-error mapping behind the Prompt Session

1 participant