Skip to content

feat(review): orchestrator review prompts boundary isolation guardrails parity (#605) - #611

Merged
dan-petty merged 1 commit into
release/v0.2.23from
feat/605-orchestrator-prompt-boundary-isolation
Sep 25, 2026
Merged

dan-petty merged 1 commit into
release/v0.2.23from
feat/605-orchestrator-prompt-boundary-isolation

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

Delivers Part 1 (Parity, P0) of Issue #605: establishes prompt boundary isolation, untrusted preambles, and guardrail parity between ReviewPipelineOrchestrator and runner.py review workflows, while eliminating the misleading persona_title and {persona} placeholders.

Key Changes

  • Unified Persona System Prompts: Centralized _persona_system_prompt in src/devops_cli/ai/review/classification.py and applied it across all ReviewPipelineOrchestrator agents in _build_multi_persona_pipeline, embedding <project_conventions_context>, negative false-positive exemplars (render_negative_exemplars()), and prompt isolation guardrails (_GUARDRAILS_PROMPT) without circular imports.
  • Prompt XML Boundaries & Untrusted Preambles: Wrapped target review contents in <target_code_to_review> with _UNTRUSTED_CONTENT_PREAMBLE, and wrapped symbols, RAG, and contract context in <untrusted_related_files> with _UNTRUSTED_CONTEXT_PREAMBLE.
  • Persona Identity Cleanliness: Deleted persona_title and {persona} placeholders outright from task prompt templates (code_review_prompt.md, config_review_prompt.md, docs_review_prompt.md) and prompt builder build_context_review_prompt, eliminating persona identity collision where every persona reviewed as "DevSecOps Specialist".
  • Decomposed Helpers: Decomposed build_context_review_prompt into single-responsibility helpers (_format_untrusted_context, _resolve_review_task_and_label) to strictly maintain cyclomatic complexity $M \le 10$ and nesting depth $\le 5$.
  • FastMCP Prompt Rendering: Updated FastMCP code_review_prompt in src/devops_cli/ai/mcp/server.py to format targets cleanly while prepending persona headers when requested.
  • Comprehensive Test Coverage: Updated and added unit tests in tests/test_review_classification.py asserting boundary isolation, preambles, and that every _build_multi_persona_pipeline agent carries guardrails and exemplars using consolidated structural tuple equality assertions.

Verification

  • uv run pytest tests/test_review_classification.py -v: 18/18 passed
  • tests/test_review_pipeline.py & tests/test_review_page_line_numbers.py: passed
  • tests/test_architectural_invariants.py: passed (zero circular imports in ai/review)
  • FastMCP prompt rendering tests: passed
  • Complexity Analysis: src/devops_cli/ai/review/classification.py and tests/test_review_classification.py compliant ($M \le 10$, depth $\le 5$)
  • Gated CI Quality Gate (uv run devops ci): 100% passing across all 10 quality gates (5,796 tests passed, 0 failures, 90.74% coverage)

@dan-petty
dan-petty merged commit eef33b5 into release/v0.2.23 Sep 25, 2026
8 checks passed
@dan-petty
dan-petty deleted the feat/605-orchestrator-prompt-boundary-isolation branch September 25, 2026 21:14
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