Skip to content

feat: add verified industry reference examples - #224

Open
svonava wants to merge 4 commits into
mainfrom
feat/verified-industry-examples
Open

feat: add verified industry reference examples#224
svonava wants to merge 4 commits into
mainfrom
feat/verified-industry-examples

Conversation

@svonava

@svonava svonava commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add runnable financial filing, prior authorization, and maintenance triage examples
  • include checked evidence from real component calls against public SIE main at 4b5ea9c
  • preserve each source, parsed output, raw model response, mapped record, review, manifest, and evaluation
  • define narrow decision boundaries for financial, healthcare, and industrial evidence

Evidence and provenance

  • Finance reads original values from the original Form 10-Q, reads restated values from the Form 10-K/A, and cross-checks the amended filing's previously reported column.
  • CMS keeps each submitted document as a distinct source fragment and reproduces the published one-month documentation gap without making a coverage or medical decision.
  • Maintenance reconstructs the NTSB detector sequence without adding a causal claim or control action. A saved structured-output probe includes its exact request, response, input hash, runtime commit, and narrow interpretation.
  • Public configs use docling-project/docling. Manifests show the internal docling ID used by the direct local server during verification.

Verification

Live NVIDIA L4 runs:

  • Finance: 8/8 evaluation checks, 2026-07-25T02:28:01.848776+00:00
  • CMS: 10/10 evaluation checks, 2026-07-25T02:35:39.667778+00:00
  • Maintenance: 8/8 evaluation checks, 2026-07-25T02:35:45.228957+00:00

Local package checks:

  • Finance: 12 tests
  • CMS: 18 tests
  • Maintenance: 12 tests
  • Ruff format and lint pass in all three packages
  • every manifest artifact hash and diagnostic-fixture hash matches
  • adversarial review found no remaining blocker, secret, unrelated file, stale artifact name, or chronological run path

Summary by CodeRabbit

  • New Features
    • Added three runnable example agents (financial filing, maintenance triage, prior-authorization), including expanded gallery entries.
    • Each example can generate source-grounded reviews and write reproducible run artifacts, with evaluation CLIs that report pass/fail checks.
  • Documentation
    • Added/expanded READMEs and example configurations (including required environment variables) for running and inspecting outputs.
  • Tests
    • Added end-to-end and fail-closed test coverage validating evidence mapping, extracted results, evaluation outcomes, and deterministic artifact hashes.

@svonava

svonava commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@svonava

svonava commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

Review update:\n\n- Removed the endpoint-specific Docling identifier translation.\n- All new runs now use the canonical SIE model ID, docling, on local and Cloud endpoints.\n- Preserved the acquisition-time configured identifier in each verified manifest and documented why it differs from the canonical model actually served.\n- Reran 42 locked offline tests plus Ruff lint and format across all three packages.\n\nThis keeps the examples compatible with PR #222 and avoids client-side model naming rules.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Three runnable SIE examples were added: financial filing review, maintenance triage, and prior authorization review. Each includes an end-to-end pipeline, deterministic validation, artifact manifests, CLI commands, configuration, documentation, and tests.

Changes

Financial Filing Review

Layer / File(s) Summary
Example setup and configuration
examples/README.md, examples/financial-filing-agent/...
Adds documentation, SIE settings, packaging, environment defaults, ignore rules, package initialization, and gallery registration.
Review pipeline
examples/financial-filing-agent/financial_filing/review.py
Adds parsing, retrieval, reranking, entity/span validation, cross-filing table checks, review construction, artifact manifests, and a CLI.
Evaluation and tests
examples/financial-filing-agent/financial_filing/evaluate.py, examples/financial-filing-agent/tests/test_review.py
Adds evaluation checks, manifest updates, CLI failure handling, and validation tests for calculations, evidence, fail-closed behavior, and hashes.

Maintenance Triage Review

Layer / File(s) Summary
Example setup and configuration
examples/maintenance-triage-agent/...
Adds documentation, SIE settings, packaging, environment defaults, ignore rules, and package initialization.
Review pipeline
examples/maintenance-triage-agent/maintenance_triage/review.py
Adds source retrieval, detector and outcome extraction, evidence gating, exact field mapping, validation, review artifacts, manifests, and a CLI.
Evaluation and tests
examples/maintenance-triage-agent/maintenance_triage/evaluate.py, examples/maintenance-triage-agent/tests/test_review.py
Adds evaluation checks and tests for source mapping, schema preservation, trend reconstruction, fail-closed validation, and artifact hashes.

Prior Authorization Review

Layer / File(s) Summary
Example setup and configuration
examples/prior-authorization-review-agent/...
Adds documentation, SIE settings, packaging, environment defaults, ignore rules, and package initialization.
Review pipeline
examples/prior-authorization-review-agent/prior_authorization/review.py
Adds CMS parsing, retrieval, reranking, entity extraction, source scoping, GLiNER2 validation, review construction, manifests, and a CLI.
Evaluation and tests
examples/prior-authorization-review-agent/prior_authorization/evaluate.py, examples/prior-authorization-review-agent/tests/test_review.py
Adds evaluation checks and tests for source scopes, field invariants, CMS constraints, manifest updates, and hashes.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Reviewer
  participant AgentCLI
  participant SIE
  participant Validator
  participant RunDirectory

  Reviewer->>AgentCLI: Start review with run ID
  AgentCLI->>SIE: Parse, retrieve, rerank, and extract evidence
  SIE-->>AgentCLI: Model outputs and ranked source chunks
  AgentCLI->>Validator: Gate evidence and construct review
  Validator-->>AgentCLI: Validated review or failure
  AgentCLI->>RunDirectory: Write review, evaluation, and manifest artifacts
  RunDirectory-->>Reviewer: Return evidence bundle
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the change set: it adds verified runnable reference examples across multiple industry domains.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/verified-industry-examples

Comment @coderabbitai help to get the list of available commands.

@svonava

svonava commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.


Your included review limit is currently reached under our Fair Usage Limits Policy. Your recent PR review activity is in the 95th percentile or higher among CodeRabbit users, so adaptive limits apply. This review may still proceed through usage-based billing if eligible. Your next included review will be available in 49 minutes.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (2)
examples/maintenance-triage-agent/tests/test_review.py (1)

214-221: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a failure test for the chunk-identity gate.

_require_ranked_evidence rejects evidence rows missing chunk_id or text (review.py lines 181-182), and _row_for_location rejects ambiguous location matches (review.py lines 227-228). Neither branch is exercised, yet both are provenance guarantees this example advertises.

🧪 Suggested addition
def test_review_fails_closed_on_evidence_without_chunk_identity() -> None:
    evidence = ranked_evidence()
    del evidence[0]["chunk_id"]
    try:
        build_review(structured_data(), evidence)
    except RuntimeError as exc:
        assert "chunk identity" in str(exc)
    else:
        raise AssertionError("build_review accepted evidence without a chunk id")

As per path instructions, "Check that commands match the implementation and that tests cover failure paths".

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/maintenance-triage-agent/tests/test_review.py` around lines 214 -
221, Add failure-path coverage in test_review.py for the chunk-identity gate
used by build_review: create valid ranked evidence, remove a row’s chunk_id (or
text), and assert RuntimeError with the expected “chunk identity” message; fail
explicitly if build_review accepts it. Also add coverage for _row_for_location
rejecting ambiguous location matches, preserving the advertised provenance
guarantees.

Source: Path instructions

examples/prior-authorization-review-agent/tests/test_review.py (1)

1-360: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add failure-path tests for the remaining fail-closed gates.

Coverage exists for build_review's field-mismatch gates, but not for _source_scope (no matching fragment), _require_ranked_evidence (missing/malformed reranked rows), _chunks (no usable chunks), or the "not overdue" branch in build_review. These are part of the same deterministic fail-closed contract the README highlights ("Missing, conflicting, or untraceable model output stops the run").

As per path instructions, "Check that commands match the implementation and that tests cover failure paths."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/tests/test_review.py` around lines
1 - 360, Add failure-path tests covering the remaining fail-closed gates: make
_source_scope reject evidence with no matching fragment, make
_require_ranked_evidence reject missing or malformed reranked rows, and make
_chunks reject input with no usable chunks. Add a build_review test for the
not-overdue encounter case, asserting the documented failure behavior. Reuse
existing fixtures/helpers and assert the expected RuntimeError messages.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/financial-filing-agent/financial_filing/review.py`:
- Around line 136-143: Update _require_entity_evidence so required_spans also
includes the restated diluted EPS source span "$1.34", preserving the existing
normalization, missing-span detection, and error behavior.

In `@examples/maintenance-triage-agent/maintenance_triage/__init__.py`:
- Line 1: Update the module docstring in maintenance_triage to describe that the
example performs read-only maintenance triage using the published NTSB SPC-24-06
page spread, removing the inaccurate reference to synthetic plant records.

In `@examples/maintenance-triage-agent/maintenance_triage/review.py`:
- Around line 478-480: Update the SIEClient construction in the maintenance flow
to pass the already-read timeout variable from
config["cluster"]["provision_timeout_s"] instead of the hardcoded 900, while
preserving the existing timeout forwarding for subsequent calls.
- Around line 452-462: Update the mapped-field and triage calculation flow to
derive both asserted values: add and validate east_palestine_time via
_source_match in _map_exact_source_fields, then compute
salem_to_east_palestine_minutes from the mapped times like
sebring_to_salem_minutes; also derive derailment.total_cars from the validated
derailment_statement as 1 hopper car plus 37 others, replacing the literal 38.

In `@examples/maintenance-triage-agent/README.md`:
- Around line 62-77: Update the evidence-bundle artifact list in the README to
include the per-stage GLiNER outputs written by run():
raw/entities-detector-{index}.json and raw/entities-outcome.json. Keep the
existing artifact entries unchanged and ensure the documented paths match the
implementation.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`:
- Around line 389-415: Update review.py lines 389-415 to populate
missing_documentation, review_conclusion, and payment_action from the validated
outcome fields rather than literals; update README.md lines 26-32 to accurately
describe verbatim versus canonical fields; update evaluate.py lines 50-60 to use
token/substring assertions matching _require_tokens instead of fixed-string
equality.

---

Nitpick comments:
In `@examples/maintenance-triage-agent/tests/test_review.py`:
- Around line 214-221: Add failure-path coverage in test_review.py for the
chunk-identity gate used by build_review: create valid ranked evidence, remove a
row’s chunk_id (or text), and assert RuntimeError with the expected “chunk
identity” message; fail explicitly if build_review accepts it. Also add coverage
for _row_for_location rejecting ambiguous location matches, preserving the
advertised provenance guarantees.

In `@examples/prior-authorization-review-agent/tests/test_review.py`:
- Around line 1-360: Add failure-path tests covering the remaining fail-closed
gates: make _source_scope reject evidence with no matching fragment, make
_require_ranked_evidence reject missing or malformed reranked rows, and make
_chunks reject input with no usable chunks. Add a build_review test for the
not-overdue encounter case, asserting the documented failure behavior. Reuse
existing fixtures/helpers and assert the expected RuntimeError messages.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 45314b75-564f-486d-8637-593b0866fab3

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5ea9c and beee131.

⛔ Files ignored due to path filters (66)
  • .coderabbit.yaml is excluded by none and included by none
  • examples/financial-filing-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/financial-filing-agent/fixtures/pathward-filing-packet.html is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/financial-filing-agent/fixtures/pathward-q3-fy2023.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/financial-filing-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/financial-filing-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/parsed.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities-original-10q.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities-restated-10ka.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities-status.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/gliner2-original-10q.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/gliner2-restated-10ka.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/gliner2-status.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/mapped.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/retrieve.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/maintenance-triage-agent/fixtures/STRUCTURED_OUTPUT_PROBE.md is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/east-palestine-bearing-spread.pdf is excluded by !**/*.pdf, !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/output-schema-probe-request.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/output-schema-probe-response.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/maintenance-triage-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/parsed.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-detector-0.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-detector-1.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-detector-2.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-outcome.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-cause.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-derailment.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-east-palestine.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-engineer.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-salem.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-sebring.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/mapped.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/retrieve.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/prior-authorization-review-agent/fixtures/cms-l1851-insufficient-documentation.html is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/prior-authorization-review-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/parsed.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-0.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-1.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-2.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-3.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-4.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-requirement-0.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/gliner2-outcome.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/gliner2-requirements.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/gliner2-submission.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/mapped.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/retrieve.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
📒 Files selected for processing (28)
  • examples/README.md
  • examples/financial-filing-agent/.env.example
  • examples/financial-filing-agent/.gitignore
  • examples/financial-filing-agent/README.md
  • examples/financial-filing-agent/config.yaml
  • examples/financial-filing-agent/financial_filing/__init__.py
  • examples/financial-filing-agent/financial_filing/evaluate.py
  • examples/financial-filing-agent/financial_filing/review.py
  • examples/financial-filing-agent/pyproject.toml
  • examples/financial-filing-agent/tests/test_review.py
  • examples/maintenance-triage-agent/.env.example
  • examples/maintenance-triage-agent/.gitignore
  • examples/maintenance-triage-agent/README.md
  • examples/maintenance-triage-agent/config.yaml
  • examples/maintenance-triage-agent/maintenance_triage/__init__.py
  • examples/maintenance-triage-agent/maintenance_triage/evaluate.py
  • examples/maintenance-triage-agent/maintenance_triage/review.py
  • examples/maintenance-triage-agent/pyproject.toml
  • examples/maintenance-triage-agent/tests/test_review.py
  • examples/prior-authorization-review-agent/.env.example
  • examples/prior-authorization-review-agent/.gitignore
  • examples/prior-authorization-review-agent/README.md
  • examples/prior-authorization-review-agent/config.yaml
  • examples/prior-authorization-review-agent/prior_authorization/__init__.py
  • examples/prior-authorization-review-agent/prior_authorization/evaluate.py
  • examples/prior-authorization-review-agent/prior_authorization/review.py
  • examples/prior-authorization-review-agent/pyproject.toml
  • examples/prior-authorization-review-agent/tests/test_review.py

Comment on lines +136 to +143
def _require_entity_evidence(result: dict[str, Any]) -> None:
observed = _normalize_source_text(" ".join(str(entity.get("text", "")) for entity in result.get("entities", [])))
required_spans = ("45,096", "36,080", "$1.68")
missing = sorted(span for span in required_spans if span.casefold() not in observed)
if missing:
raise RuntimeError(f"GLiNER omitted required source spans: {missing}")
if "pathward financial" not in observed or "june 30, 2023" not in observed:
raise RuntimeError("GLiNER omitted the company or reporting-period source span")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

GLiNER evidence gate is missing the restated diluted EPS span.

required_spans checks original income, restated income, and original diluted EPS, but never checks for the restated diluted EPS ("$1.34"). The downstream GLiNER2 gate (_require_gliner2_figure_spans) does check it, so the overall pipeline still fails closed today, but this specific gate doesn't fully match the "fails closed if either entity model omits a required source span" guarantee documented in the README.

🔧 Proposed fix
-    required_spans = ("45,096", "36,080", "$1.68")
+    required_spans = ("45,096", "36,080", "$1.68", "$1.34")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def _require_entity_evidence(result: dict[str, Any]) -> None:
observed = _normalize_source_text(" ".join(str(entity.get("text", "")) for entity in result.get("entities", [])))
required_spans = ("45,096", "36,080", "$1.68")
missing = sorted(span for span in required_spans if span.casefold() not in observed)
if missing:
raise RuntimeError(f"GLiNER omitted required source spans: {missing}")
if "pathward financial" not in observed or "june 30, 2023" not in observed:
raise RuntimeError("GLiNER omitted the company or reporting-period source span")
def _require_entity_evidence(result: dict[str, Any]) -> None:
observed = _normalize_source_text(" ".join(str(entity.get("text", "")) for entity in result.get("entities", [])))
required_spans = ("45,096", "36,080", "$1.68", "$1.34")
missing = sorted(span for span in required_spans if span.casefold() not in observed)
if missing:
raise RuntimeError(f"GLiNER omitted required source spans: {missing}")
if "pathward financial" not in observed or "june 30, 2023" not in observed:
raise RuntimeError("GLiNER omitted the company or reporting-period source span")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/financial-filing-agent/financial_filing/review.py` around lines 136
- 143, Update _require_entity_evidence so required_spans also includes the
restated diluted EPS source span "$1.34", preserving the existing normalization,
missing-span detection, and error behavior.

@@ -0,0 +1 @@
"""Read-only maintenance triage over synthetic plant records."""

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Docstring contradicts the example's actual input.

This example reads the published NTSB SPC-24-06 page spread, not synthetic plant records. Given the example's provenance claims, the wording is misleading.

📝 Proposed fix
-"""Read-only maintenance triage over synthetic plant records."""
+"""Read-only maintenance triage over the NTSB East Palestine bearing-detector spread."""

As per path instructions, "Flag client-side model-name translation and undocumented synthetic results".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"""Read-only maintenance triage over synthetic plant records."""
"""Read-only maintenance triage over the NTSB East Palestine bearing-detector spread."""
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/maintenance-triage-agent/maintenance_triage/__init__.py` at line 1,
Update the module docstring in maintenance_triage to describe that the example
performs read-only maintenance triage using the published NTSB SPC-24-06 page
spread, removing the inaccurate reference to synthetic plant records.

Source: Path instructions

Comment on lines +452 to +462
"trend": {
"successive_increases_degrees_f": detector_deltas,
"total_increase_degrees_f": temperatures[-1] - temperatures[0],
"sebring_to_salem_minutes": salem_minute - sebring_minute,
"salem_to_east_palestine_minutes": 39,
},
"engineer_action": "began slowing before 8:54 p.m.",
"derailment": {
"total_cars": 38,
"statement": "the hopper car and 37 others derailed as emergency braking activated",
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

salem_to_east_palestine_minutes: 39 and total_cars: 38 are asserted, not derived.

Every other trend number here is computed from validated mapped fields, but 39 is a literal and there is no east_palestine_time in MAPPED_FIELDS to validate it against (the 8:52 p.m. span is only checked indirectly via GLINER2_REQUIRED_SPANS["east_palestine"]). For an example whose claim is that all arithmetic is transparent and source-derived, map an east_palestine_time field and compute the delta the same way as sebring_to_salem_minutes.

total_cars: 38 has the same shape, though README lines 42-43 documents the 1 + 37 conversion; deriving it from derailment_statement would close the loop.

♻️ Sketch
+    east_palestine_minute = _minute_of_day(str(data["east_palestine_time"]))
...
-            "salem_to_east_palestine_minutes": 39,
+            "salem_to_east_palestine_minutes": east_palestine_minute - salem_minute,

Add "east_palestine_time" to MAPPED_FIELDS and map it in _map_exact_source_fields with _source_match(east_palestine_text, r"\b8:52\s+p\.m", "East Palestine time").

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/maintenance-triage-agent/maintenance_triage/review.py` around lines
452 - 462, Update the mapped-field and triage calculation flow to derive both
asserted values: add and validate east_palestine_time via _source_match in
_map_exact_source_fields, then compute salem_to_east_palestine_minutes from the
mapped times like sebring_to_salem_minutes; also derive derailment.total_cars
from the validated derailment_statement as 1 hopper car plus 37 others,
replacing the literal 38.

Comment on lines +478 to +480
timeout = config["cluster"]["provision_timeout_s"]

with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Client timeout hardcodes 900 instead of using the configured value.

config["cluster"]["provision_timeout_s"] is read into timeout and forwarded to each call, but SIEClient(..., timeout_s=900) ignores it, so editing config.yaml only half-applies.

🔧 Proposed fix
-    with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:
+    with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=timeout) as client:
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
timeout = config["cluster"]["provision_timeout_s"]
with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:
timeout = config["cluster"]["provision_timeout_s"]
with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=timeout) as client:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/maintenance-triage-agent/maintenance_triage/review.py` around lines
478 - 480, Update the SIEClient construction in the maintenance flow to pass the
already-read timeout variable from config["cluster"]["provision_timeout_s"]
instead of the hardcoded 900, while preserving the existing timeout forwarding
for subsequent calls.

Comment on lines +62 to +77
runs/<run-id>/manifest.json endpoint, model IDs, source hash, latency
runs/<run-id>/raw/parse.json complete Docling response
runs/<run-id>/raw/retrieve.json embeddings and cosine ranking
runs/<run-id>/raw/rerank.json complete reranker response
runs/<run-id>/raw/entities.json combined GLiNER entity spans
runs/<run-id>/raw/gliner2-sebring.json GLiNER2 Sebring spans
runs/<run-id>/raw/gliner2-salem.json GLiNER2 Salem spans
runs/<run-id>/raw/gliner2-east-palestine.json GLiNER2 East Palestine spans
runs/<run-id>/raw/gliner2-cause.json GLiNER2 bearing-failure span
runs/<run-id>/raw/gliner2-engineer.json GLiNER2 engineer-action spans
runs/<run-id>/raw/gliner2-derailment.json GLiNER2 derailed-railcar spans
runs/<run-id>/raw/mapped.json validated exact-fragment mapping
runs/<run-id>/parsed.md parsed NTSB spread used downstream
runs/<run-id>/review.json detector trend and explicit boundary
runs/<run-id>/evaluation.json deterministic checks
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Evidence bundle omits the per-stage GLiNER entity artifacts.

run() also writes raw/entities-detector-{index}.json (review.py line 597) and raw/entities-outcome.json (review.py line 615). Since the example's core claim is a complete artifact bundle, list them.

📄 Proposed doc addition
 runs/<run-id>/raw/rerank.json                complete reranker response
+runs/<run-id>/raw/entities-detector-0.json   GLiNER spans per detector paragraph
+runs/<run-id>/raw/entities-outcome.json      GLiNER spans for the outcome paragraphs
 runs/<run-id>/raw/entities.json              combined GLiNER entity spans

As per path instructions, "Check that commands match the implementation".

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
runs/<run-id>/manifest.json endpoint, model IDs, source hash, latency
runs/<run-id>/raw/parse.json complete Docling response
runs/<run-id>/raw/retrieve.json embeddings and cosine ranking
runs/<run-id>/raw/rerank.json complete reranker response
runs/<run-id>/raw/entities.json combined GLiNER entity spans
runs/<run-id>/raw/gliner2-sebring.json GLiNER2 Sebring spans
runs/<run-id>/raw/gliner2-salem.json GLiNER2 Salem spans
runs/<run-id>/raw/gliner2-east-palestine.json GLiNER2 East Palestine spans
runs/<run-id>/raw/gliner2-cause.json GLiNER2 bearing-failure span
runs/<run-id>/raw/gliner2-engineer.json GLiNER2 engineer-action spans
runs/<run-id>/raw/gliner2-derailment.json GLiNER2 derailed-railcar spans
runs/<run-id>/raw/mapped.json validated exact-fragment mapping
runs/<run-id>/parsed.md parsed NTSB spread used downstream
runs/<run-id>/review.json detector trend and explicit boundary
runs/<run-id>/evaluation.json deterministic checks
```
runs/<run-id>/manifest.json endpoint, model IDs, source hash, latency
runs/<run-id>/raw/parse.json complete Docling response
runs/<run-id>/raw/retrieve.json embeddings and cosine ranking
runs/<run-id>/raw/rerank.json complete reranker response
runs/<run-id>/raw/entities-detector-0.json GLiNER spans per detector paragraph
runs/<run-id>/raw/entities-outcome.json GLiNER spans for the outcome paragraphs
runs/<run-id>/raw/entities.json combined GLiNER entity spans
runs/<run-id>/raw/gliner2-sebring.json GLiNER2 Sebring spans
runs/<run-id>/raw/gliner2-salem.json GLiNER2 Salem spans
runs/<run-id>/raw/gliner2-east-palestine.json GLiNER2 East Palestine spans
runs/<run-id>/raw/gliner2-cause.json GLiNER2 bearing-failure span
runs/<run-id>/raw/gliner2-engineer.json GLiNER2 engineer-action spans
runs/<run-id>/raw/gliner2-derailment.json GLiNER2 derailed-railcar spans
runs/<run-id>/raw/mapped.json validated exact-fragment mapping
runs/<run-id>/parsed.md parsed NTSB spread used downstream
runs/<run-id>/review.json detector trend and explicit boundary
runs/<run-id>/evaluation.json deterministic checks
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/maintenance-triage-agent/README.md` around lines 62 - 77, Update the
evidence-bundle artifact list in the README to include the per-stage GLiNER
outputs written by run(): raw/entities-detector-{index}.json and
raw/entities-outcome.json. Keep the existing artifact entries unchanged and
ensure the documented paths match the implementation.

Source: Path instructions

Comment on lines +389 to +415
return {
"scope": "Reproduction of CMS's published L1851 insufficient-documentation example",
"route": "insufficient_documentation",
"headline": "The face-to-face encounter fell one month outside CMS's six-month window",
"hcpcs_code": code,
"required_face_to_face_within_months": required_months,
"documented_face_to_face_age_months": observed_months,
"overdue_by_months": overdue_by_months,
"submitted_documentation": {
"order": str(submission["submitted_order"]),
"medical_record": str(submission["submitted_medical_record"]),
"proof_of_delivery": str(submission["submitted_proof_of_delivery"]),
},
"missing_documentation": ["face-to-face encounter within 6 months of proof of delivery"],
"review_conclusion": "insufficient documentation error",
"payment_action": "MAC recoups payment",
"source": {
"publisher": "Centers for Medicare & Medicaid Services",
"title": "Lower Limb Orthoses",
"url": SOURCE_URL,
"page_last_modified": "2026-02-11",
},
"ranked_source_evidence": ranked,
"published_example": True,
"coverage_decision": None,
"medical_decision": None,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Three "outcome" review fields are canned literals, not the extracted evidence — contradicts the "exact fragments" documentation.

build_review validates outcome["missing_documentation"], outcome["review_conclusion"], and outcome["payment_action"] for required substrings via _require_tokens, but then discards that text and emits fixed literal strings in the returned review instead — unlike submitted_documentation, which genuinely echoes the extracted text. The README states that "Ordinary code then maps the exact ranked CMS fragments to the review fields," which is not true for these three fields, and evaluate.py's corresponding checks then compare against the same hardcoded literals, so they pass tautologically whenever build_review succeeds rather than verifying the model's actual output content.

  • examples/prior-authorization-review-agent/prior_authorization/review.py#L389-L415: populate missing_documentation, review_conclusion, and payment_action from outcome[...] (the validated extracted text) instead of literal strings, e.g. "review_conclusion": str(outcome["review_conclusion"]).
  • examples/prior-authorization-review-agent/README.md#L26-L32: if the literals are intentionally kept as normalized/canonical output, revise "maps the exact ranked CMS fragments to the review fields" to clarify which fields are verbatim extracted text vs. canonicalized conclusions.
  • examples/prior-authorization-review-agent/prior_authorization/evaluate.py#L50-L60: once the fields carry real extracted text, switch these checks to substring/token assertions (mirroring _require_tokens) instead of exact-equality against fixed strings, so they meaningfully verify model output.
📍 Affects 3 files
  • examples/prior-authorization-review-agent/prior_authorization/review.py#L389-L415 (this comment)
  • examples/prior-authorization-review-agent/README.md#L26-L32
  • examples/prior-authorization-review-agent/prior_authorization/evaluate.py#L50-L60
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`
around lines 389 - 415, Update review.py lines 389-415 to populate
missing_documentation, review_conclusion, and payment_action from the validated
outcome fields rather than literals; update README.md lines 26-32 to accurately
describe verbatim versus canonical fields; update evaluate.py lines 50-60 to use
token/substring assertions matching _require_tokens instead of fixed-string
equality.

Source: Path instructions

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (4)
examples/prior-authorization-review-agent/prior_authorization/review.py (1)

455-457: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Client timeout duplicates the configured value as a literal.

timeout is read from provision_timeout_s on Line 455, then Line 457 hardcodes timeout_s=900, so editing config.yaml silently leaves the socket timeout behind.

♻️ Proposed refactor
-    with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:
+    with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=timeout) as client:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`
around lines 455 - 457, Use the existing provision timeout value from
config["cluster"]["provision_timeout_s"] when constructing SIEClient in the
review flow, replacing the hardcoded timeout_s=900 while preserving the
surrounding client setup.
examples/prior-authorization-review-agent/README.md (1)

70-82: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Evidence bundle listing omits the per-row GLiNER artifacts.

review.py Line 598 writes raw/entities-requirement-<n>.json and raw/entities-case-<n>.json per ranked row, which aren't documented here. Readers comparing the run directory against this table will see unlisted files.

As per path instructions, "Review runnable source, tests, configuration, and documentation. Check that commands match the implementation".

📝 Proposed doc addition
 runs/<run-id>/raw/entities.json                combined GLiNER entity spans
+runs/<run-id>/raw/entities-requirement-*.json  per-passage GLiNER requirement spans
+runs/<run-id>/raw/entities-case-*.json         per-passage GLiNER case spans
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/README.md` around lines 70 - 82,
Update the evidence bundle listing in the README to include the per-ranked-row
artifacts written by review.py, specifically raw/entities-requirement-<n>.json
and raw/entities-case-<n>.json. Place them with the other raw GLiNER/entity
outputs and describe their per-row purpose accurately.

Source: Path instructions

examples/prior-authorization-review-agent/tests/test_review.py (1)

278-305: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

No test exercises the evaluator's failing path.

Every assertion here drives evaluate_review/evaluate_run to True; nothing covers a review that fails a check, so the fail rendering and the SystemExit(1) in main are untested.

As per path instructions, "Check that commands match the implementation and that tests cover failure paths".

💚 Proposed test
def test_evaluator_fails_on_a_mutated_review(tmp_path: Path) -> None:
    review = build_valid_review()
    review["overdue_by_months"] = 0
    (tmp_path / "review.json").write_text(json.dumps(review), encoding="utf-8")

    assert evaluate_run(tmp_path) is False

    evaluation = json.loads((tmp_path / "evaluation.json").read_text(encoding="utf-8"))
    assert evaluation["passed"] is False
    assert any(check["name"] == "one-month-gap" and not check["passed"] for check in evaluation["checks"])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/tests/test_review.py` around lines
278 - 305, Add a failure-path test alongside the existing evaluator tests, using
a mutated review with overdue_by_months set to 0. Assert evaluate_run returns
False, evaluation.json is written with passed set to False, and the
one-month-gap check is recorded as failed; also cover main’s SystemExit(1)
behavior if that entry point is exposed.

Source: Path instructions

examples/prior-authorization-review-agent/prior_authorization/evaluate.py (1)

105-106: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Unhelpful traceback when the run directory is wrong.

eval-pa on a missing or incomplete run dir raises a bare FileNotFoundError. A guarded message keeps the example approachable.

♻️ Proposed refactor
 def evaluate_run(run_dir: Path) -> bool:
-    review = json.loads((run_dir / "review.json").read_text(encoding="utf-8"))
+    review_path = run_dir / "review.json"
+    if not review_path.exists():
+        raise SystemExit(f"No review.json in {run_dir}. Run `uv run review-pa` first.")
+    review = json.loads(review_path.read_text(encoding="utf-8"))
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/prior_authorization/evaluate.py`
around lines 105 - 106, Update evaluate_run to guard loading review.json and
raise a clear, user-facing error when the run directory is missing or
incomplete, instead of exposing a bare FileNotFoundError. Preserve normal JSON
loading for valid run directories and include the expected review.json location
in the message.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@examples/financial-filing-agent/README.md`:
- Around line 60-75: Update the “Evidence bundle” artifact list in the README to
document the per-stage files written by review.py:
raw/entities-original-10q.json, raw/entities-restated-10ka.json, and
raw/entities-status.json, alongside the existing combined raw/entities.json
entry.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`:
- Around line 555-563: Update the evidence terms passed to _select_evidence_rows
in the outcome_rows selection so the face-to-face documentation phrase uses an
apostrophe-free substring that matches both straight and typographic
apostrophes. Leave the other outcome terms and selection behavior unchanged.
- Around line 448-457: Update run to handle FileExistsError from raw_dir.mkdir
when the fixed run_id already exists, and provide a clear user-facing message
instructing the user to choose a new run ID or delete the existing run
directory. Preserve the current behavior for new run IDs and keep the directory
non-overwriting.

---

Nitpick comments:
In `@examples/prior-authorization-review-agent/prior_authorization/evaluate.py`:
- Around line 105-106: Update evaluate_run to guard loading review.json and
raise a clear, user-facing error when the run directory is missing or
incomplete, instead of exposing a bare FileNotFoundError. Preserve normal JSON
loading for valid run directories and include the expected review.json location
in the message.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`:
- Around line 455-457: Use the existing provision timeout value from
config["cluster"]["provision_timeout_s"] when constructing SIEClient in the
review flow, replacing the hardcoded timeout_s=900 while preserving the
surrounding client setup.

In `@examples/prior-authorization-review-agent/README.md`:
- Around line 70-82: Update the evidence bundle listing in the README to include
the per-ranked-row artifacts written by review.py, specifically
raw/entities-requirement-<n>.json and raw/entities-case-<n>.json. Place them
with the other raw GLiNER/entity outputs and describe their per-row purpose
accurately.

In `@examples/prior-authorization-review-agent/tests/test_review.py`:
- Around line 278-305: Add a failure-path test alongside the existing evaluator
tests, using a mutated review with overdue_by_months set to 0. Assert
evaluate_run returns False, evaluation.json is written with passed set to False,
and the one-month-gap check is recorded as failed; also cover main’s
SystemExit(1) behavior if that entry point is exposed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 998e61b4-151c-4ea8-ab11-12532d8edcef

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5ea9c and beee131.

⛔ Files ignored due to path filters (66)
  • .coderabbit.yaml is excluded by none and included by none
  • examples/financial-filing-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/financial-filing-agent/fixtures/pathward-filing-packet.html is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/financial-filing-agent/fixtures/pathward-q3-fy2023.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/financial-filing-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/financial-filing-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/parsed.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities-original-10q.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities-restated-10ka.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities-status.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/entities.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/gliner2-original-10q.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/gliner2-restated-10ka.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/gliner2-status.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/mapped.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/raw/retrieve.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/financial-filing-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/maintenance-triage-agent/fixtures/STRUCTURED_OUTPUT_PROBE.md is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/east-palestine-bearing-spread.pdf is excluded by !**/*.pdf, !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/output-schema-probe-request.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/fixtures/output-schema-probe-response.json is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/maintenance-triage-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/maintenance-triage-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/parsed.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-detector-0.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-detector-1.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-detector-2.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities-outcome.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/entities.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-cause.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-derailment.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-east-palestine.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-engineer.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-salem.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/gliner2-sebring.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/mapped.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/raw/retrieve.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/maintenance-triage-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/fixtures/SOURCES.md is excluded by !examples/**/fixtures/** and included by examples/**, examples/**/fixtures/SOURCES.md
  • examples/prior-authorization-review-agent/fixtures/cms-l1851-insufficient-documentation.html is excluded by !examples/**/fixtures/** and included by examples/**
  • examples/prior-authorization-review-agent/uv.lock is excluded by !**/*.lock, !examples/**/uv.lock and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/evaluation.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/manifest.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/parsed.md is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-0.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-1.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-2.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-3.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-case-4.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities-requirement-0.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/entities.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/gliner2-outcome.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/gliner2-requirements.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/gliner2-submission.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/mapped.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/parse.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/rerank.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/raw/retrieve.json is excluded by !examples/**/verified-run/** and included by examples/**
  • examples/prior-authorization-review-agent/verified-run/review.json is excluded by !examples/**/verified-run/** and included by examples/**
📒 Files selected for processing (28)
  • examples/README.md
  • examples/financial-filing-agent/.env.example
  • examples/financial-filing-agent/.gitignore
  • examples/financial-filing-agent/README.md
  • examples/financial-filing-agent/config.yaml
  • examples/financial-filing-agent/financial_filing/__init__.py
  • examples/financial-filing-agent/financial_filing/evaluate.py
  • examples/financial-filing-agent/financial_filing/review.py
  • examples/financial-filing-agent/pyproject.toml
  • examples/financial-filing-agent/tests/test_review.py
  • examples/maintenance-triage-agent/.env.example
  • examples/maintenance-triage-agent/.gitignore
  • examples/maintenance-triage-agent/README.md
  • examples/maintenance-triage-agent/config.yaml
  • examples/maintenance-triage-agent/maintenance_triage/__init__.py
  • examples/maintenance-triage-agent/maintenance_triage/evaluate.py
  • examples/maintenance-triage-agent/maintenance_triage/review.py
  • examples/maintenance-triage-agent/pyproject.toml
  • examples/maintenance-triage-agent/tests/test_review.py
  • examples/prior-authorization-review-agent/.env.example
  • examples/prior-authorization-review-agent/.gitignore
  • examples/prior-authorization-review-agent/README.md
  • examples/prior-authorization-review-agent/config.yaml
  • examples/prior-authorization-review-agent/prior_authorization/__init__.py
  • examples/prior-authorization-review-agent/prior_authorization/evaluate.py
  • examples/prior-authorization-review-agent/prior_authorization/review.py
  • examples/prior-authorization-review-agent/pyproject.toml
  • examples/prior-authorization-review-agent/tests/test_review.py

Comment on lines +60 to +75
## Evidence bundle

Every run writes:

```text
runs/<run-id>/manifest.json endpoint, model IDs, fixture hashes, latency
runs/<run-id>/raw/parse.json complete Docling response
runs/<run-id>/raw/retrieve.json embeddings and cosine ranking
runs/<run-id>/raw/rerank.json complete reranker response
runs/<run-id>/raw/entities.json combined entity spans
runs/<run-id>/raw/gliner2-*.json raw GLiNER2 source-span responses
runs/<run-id>/raw/mapped.json validated record mapped from Docling table coordinates
runs/<run-id>/parsed.md parsed packet used downstream
runs/<run-id>/review.json source-versioned result and calculated delta
runs/<run-id>/evaluation.json deterministic checks
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Artifact bundle list omits per-stage entity extraction files.

review.py also writes raw/entities-original-10q.json, raw/entities-restated-10ka.json, and raw/entities-status.json (per-stage GLiNER responses) in addition to the combined raw/entities.json, but only the combined file is documented here.

📝 Proposed doc fix
-runs/<run-id>/raw/entities.json   combined entity spans
+runs/<run-id>/raw/entities.json   combined entity spans
+runs/<run-id>/raw/entities-*.json per-stage GLiNER responses (original 10-Q, restated 10-K/A, filing status)

As per path instructions, examples documentation should be checked so "commands match the implementation."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Evidence bundle
Every run writes:
```text
runs/<run-id>/manifest.json endpoint, model IDs, fixture hashes, latency
runs/<run-id>/raw/parse.json complete Docling response
runs/<run-id>/raw/retrieve.json embeddings and cosine ranking
runs/<run-id>/raw/rerank.json complete reranker response
runs/<run-id>/raw/entities.json combined entity spans
runs/<run-id>/raw/gliner2-*.json raw GLiNER2 source-span responses
runs/<run-id>/raw/mapped.json validated record mapped from Docling table coordinates
runs/<run-id>/parsed.md parsed packet used downstream
runs/<run-id>/review.json source-versioned result and calculated delta
runs/<run-id>/evaluation.json deterministic checks
```
## Evidence bundle
Every run writes:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/financial-filing-agent/README.md` around lines 60 - 75, Update the
“Evidence bundle” artifact list in the README to document the per-stage files
written by review.py: raw/entities-original-10q.json,
raw/entities-restated-10ka.json, and raw/entities-status.json, alongside the
existing combined raw/entities.json entry.

Source: Path instructions

Comment on lines +448 to +457
def run(run_id: str) -> Path:
config = load_config()
parse_model = str(config["models"]["parse"])
run_dir = RUNS_DIR / run_id
raw_dir = run_dir / "raw"
raw_dir.mkdir(parents=True, exist_ok=False)
calls: list[dict[str, Any]] = []
timeout = config["cluster"]["provision_timeout_s"]

with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Re-running the documented quickstart command fails with a raw FileExistsError.

The README instructs uv run review-pa --run-id local, a fixed id, but exist_ok=False makes the second run abort with an unhandled traceback rather than a clear message. Catch it and explain the choice (pick a new id or delete the directory).

As per path instructions, "Check that commands match the implementation".

🛠️ Proposed fix
     run_dir = RUNS_DIR / run_id
     raw_dir = run_dir / "raw"
-    raw_dir.mkdir(parents=True, exist_ok=False)
+    if run_dir.exists():
+        raise SystemExit(f"Run directory already exists: {run_dir}. Pass a new --run-id or remove it first.")
+    raw_dir.mkdir(parents=True, exist_ok=False)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
def run(run_id: str) -> Path:
config = load_config()
parse_model = str(config["models"]["parse"])
run_dir = RUNS_DIR / run_id
raw_dir = run_dir / "raw"
raw_dir.mkdir(parents=True, exist_ok=False)
calls: list[dict[str, Any]] = []
timeout = config["cluster"]["provision_timeout_s"]
with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:
run_dir = RUNS_DIR / run_id
raw_dir = run_dir / "raw"
if run_dir.exists():
raise SystemExit(f"Run directory already exists: {run_dir}. Pass a new --run-id or remove it first.")
raw_dir.mkdir(parents=True, exist_ok=False)
calls: list[dict[str, Any]] = []
timeout = config["cluster"]["provision_timeout_s"]
with SIEClient(config["cluster"]["url"], api_key=config["cluster"]["api_key"] or None, timeout_s=900) as client:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`
around lines 448 - 457, Update run to handle FileExistsError from raw_dir.mkdir
when the fixed run_id already exists, and provide a clear user-facing message
instructing the user to choose a new run ID or delete the existing run
directory. Preserve the current behavior for new run IDs and keep the directory
non-overwriting.

Source: Path instructions

Comment on lines +555 to +563
outcome_rows = _select_evidence_rows(
ranked,
(
"didn't document the face-to-face",
"insufficient documentation error",
"mac recoups",
),
"outcome",
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apostrophe mismatch: "didn't document the face-to-face" never matches the CMS fixture.

The fixture uses the typographic apostrophe — test_review.py Lines 179 and 263 assert "The doctor didn’t document the face-to-face encounter…". _select_evidence_rows compares raw casefolded text with no apostrophe normalization (unlike _normalized_source_text), so this term is dead. The stage still passes because the other two any(...) terms match, but the missing-documentation passage is silently dropped from the GLiNER case inputs.

Match on the apostrophe-free substring instead.

🐛 Proposed fix
         outcome_rows = _select_evidence_rows(
             ranked,
             (
-                "didn't document the face-to-face",
+                "document the face-to-face encounter within 6 months",
                 "insufficient documentation error",
                 "mac recoups",
             ),
             "outcome",
         )
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
outcome_rows = _select_evidence_rows(
ranked,
(
"didn't document the face-to-face",
"insufficient documentation error",
"mac recoups",
),
"outcome",
)
outcome_rows = _select_evidence_rows(
ranked,
(
"document the face-to-face encounter within 6 months",
"insufficient documentation error",
"mac recoups",
),
"outcome",
)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@examples/prior-authorization-review-agent/prior_authorization/review.py`
around lines 555 - 563, Update the evidence terms passed to
_select_evidence_rows in the outcome_rows selection so the face-to-face
documentation phrase uses an apostrophe-free substring that matches both
straight and typographic apostrophes. Leave the other outcome terms and
selection behavior unchanged.

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