Skip to content

fix(review): gracefully invalidate contradictory polarity findings and eliminate escape sequence syntax warnings #635

Closed

Description

@dan-petty

Problem Description

During branch review execution (devops ai review branch --persona devsecops release/v0.2.23), two runtime issues were encountered:

  1. Pipeline Output Schema Validation Failures:
Failed to validate pipeline output schema: 1 validation error for ReviewResult
findings.1
  Value error, observed_value and expected_value cannot be identical: '...'

and

Value error, Both observed_value and expected_value must be provided when asserting a concrete value

When the LLM output generates a finding where observed_value == expected_value (or produces an asymmetric polarity assertion where only one of the values is set), Finding._validate_polarity raises a ValueError. This causes ReviewResult.model_validate in MultiAgentPipeline to raise a ValidationError, logging Failed to validate pipeline output schema and discarding the entire file's review results.

Under the polarity invariant architecture, identical polarity assertions represent contradictory or hallucinated findings that must be gracefully marked as status="INVALIDATED" with by="deterministic:verdict_polarity" and reportable=False, rather than crashing Pydantic deserialization of the file review. Similarly, single-sided polarity assertions should be gracefully handled or invalidated without crashing the pipeline.

  1. SyntaxWarning for Invalid Escape Sequences:
<unknown>:1: SyntaxWarning: "\/" is an invalid escape sequence. Such sequences will not work in the future. Did you mean "\\/"? A raw string is also an option.

In src/devops_cli/ai/review_schema.py:95 (_parse_stringified_collection), stringified collections from model output are evaluated via (ast.literal_eval, json.loads). Because JSON uses \/ as a valid escape for / (RFC 8259), running ast.literal_eval first on JSON strings produces a Python AST compiler SyntaxWarning.

Expected Behavior

  • Model output findings with identical observed_value and expected_value should deserialize into Finding instances with status="INVALIDATED", verified=False, reportable=False, and invalidation_reason="Observed value is identical to expected value (no defect polarity)", preserving the review pipeline.
  • Single-sided polarity assertions should not crash deserialization.
  • _parse_stringified_collection should try json.loads first, and suppress/catch SyntaxWarning when falling back to ast.literal_eval.

Activity

  1. added this to the v0.2.23 milestone on Sep 27, 2026
  2. added
    type/bug
    scope/review
    priority/p1-high
    on Sep 27, 2026
  3. dan-petty commented on Sep 27, 2026

    @dan-petty
    OwnerAuthor

    Closed by #636, merged into release/v0.2.23.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/reviewtype/bug

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions