Skip to content

feat(casework): fill missing_details from the description call - #441

Open
gaurav-karki wants to merge 3 commits into
mainfrom
feat/casework-missing-details
Open

feat(casework): fill missing_details from the description call#441
gaurav-karki wants to merge 3 commits into
mainfrom
feat/casework-missing-details

Conversation

@gaurav-karki

@gaurav-karki gaurav-karki commented Aug 8, 2026

Copy link
Copy Markdown
Member

User description

casework: fill missing_details from the description call

Case.missing_details — the "what we still don't hold" section on every case page — had no
writer. Nothing in the pipeline filled it. This adds one, riding in the LLM call that
already reads the verdict.

What it produces

For a case holding a press release and a Special Court verdict:

क) अख्तियार दुरुपयोग अनुसन्धान आयोगले दायर गरेको अभियोगपत्र
ख) हदम्याद भित्र वादी वा प्रतिवादीले सर्वोच्च अदालतमा पुनरावेदन गरे नगरेको ब्याहोरा
ग) मिति २०७५।११।१७ को बिड बण्ड फिर्ता दिने नगर कार्यपालिका बैठकको निर्णयको प्रतिलिपि
घ) साक्षी रामु खनाल समेतको मिति २०७९।०९।२६ र २०७९।०९।२८ का बकपत्र
ङ) अनुसन्धान अधिकृत शम्भु मिश्राले पेश गरेको अनुसन्धान प्रतिवेदन

क and ख are deterministic from what is bound. The rest are documents the verdict cites
that our evidence lacks — found by the model, then filtered.

Two fields, one call

enrich_description already bills 1 + N premium calls per case, where N is the verdict's
chunk count: summarize_verdict pays one request per 150,000 chars because the ठहर sits at
the end of a फैसला. Batch verdicts run to a 141,000-char median. A standalone stage would
re-read the same document from scratch, roughly doubling the batch's premium spend, so this
adds one output key instead.

Derivation stays independent — missing_details comes from which materials are bound plus
what the sources cite, never from the finished narrative. casework/common/missing_details.py
holds that logic with no LLM and no API dependency.

The gates differ: description needs press release or verdict, missing_details needs the
verdict specifically. So STAGES["description"].provides is the one conditional entry in
that table — read it as "can provide".

The model proposes, the rules dispose

held_summary prints our bound evidence into the prompt, so the model computes a difference
instead of guessing at absence. That also makes one grounding rule checkable in code rather
than trusted: a claimed-missing document we demonstrably hold is rejected, with the rule
named in the run log.

Rejections are logged with their reason, never silently dropped — a dropped item and a model
that found nothing need opposite follow-up (prompt problem vs sourcing problem).

Verified against production, read-only

Three cases dry-run 2026-08-08 through a GET-only proxy (every write verb 405s), no --apply:

Case Verdict Output
078-CR-0111 49,952 → summarised 6 items, 437 chars
079-CR-0047 148,140 → summarised 6 items, 477 chars
078-CR-0118 141,059 → summarised 6 items, 448 chars

~$1.74 per case, 2 calls each.

Guards worth knowing about

  • This stage only writes into an empty missing_details, and --force does not override
    that.
    The importer's truncation guard puts ACCUSED LIST INCOMPLETE in the same field
    and the 61 published values are hand-written; the floor items cannot serve as a "we wrote
    this" signature because they were copied verbatim from those hand-written cases.

  • patch_fields, not two patch_field calls — the second call's ETag would already be
    stale, so a loop cannot stay conditional.

  • MAX_LLM_ITEMS is the binding limit, not the char cap. A character cap always cuts the
    last item, which is always the most specific one, because specificity is long. Measured
    twice on real output before the cap was demoted to a sanity guard.

  • A partial fetch falls back to the floor. has_verdict reads bindings, so a case whose
    court order returns a 500 still reports True and the prompt still claims we hold the
    verdict. The model would then be diffing against an inventory it could not read, so its items
    are dropped and only the deterministic floor is written.

  • The idempotency check is per field. A description-only check skipped every already-
    described case before missing_details was computed — so the ~188 production cases carrying
    a description could never get the new field, while provides claimed they were complete.
    Those cases are now processed, and only the empty field is patched: the description is never
    rewritten without --force.

Two known limits, documented rather than papered over

Neither is fixable in this module. Both are in the spec.

  • Nothing detects "a sentence, not a document name." The prompt's own Bad example,
    अदालतले पर्याप्त प्रमाण मूल्याङ्कन गरेको छैन।, passes every code rule — 47 chars, no filler
    phrase, head noun matches no held document. So a criticism of the court could publish.
    Catching it means recognising Nepali verb endings, a different kind of rule than the rest.
  • We cannot tell which court a judgment came from. COURT_TYPES has one entry, so a
    Supreme Court ruling bound as court_order is indistinguishable from a Special Court
    verdict. Needs a distinct material type upstream.

Review history

Four rounds of /code-review (medium, medium, high, xhigh) found 32 findings; 30 are fixed,
each with a test using the reviewer's own repro input. The two above are the exceptions.

Worth knowing what the later rounds caught, because the tests alone would not have:

  • The held-document rule originally used a len(word)/len(item) >= 0.5 ratio. The prompt
    demands specificity, every qualifier drives that ratio down, so the rule stopped firing on
    exactly the items it was written for — विशेष अदालत काठमाडौंको फैसला (०८१-CR-००९१) passed at
    0.13 while the bare form was caught. Replaced with a head-noun test (Nepali is head-final).
  • The charge-sheet rule kept the old substring test after that change, and so dropped
    अभियोगपत्रमा उल्लेखित संलग्न अनुसूची — an annex the charge sheet references — on 24 of 25
    cases.
  • --force appending to this field grew it without bound across runs. Withdrawn entirely.

Tests

1,391 pass in tests/casework/. ruff, ty (repo-wide) and pre-commit clean.

Design: docs/superpowers/specs/2026-08-07-missing-details-enricher-design.md in the
meta-repo.


🤖 Generated with Claude Code


PR Type

Enhancement, Tests


Description

  • Add missing_details generation

  • Share description LLM call

  • Add deterministic document rules

  • Cover parsing, gating, writes


Diagram Walkthrough

flowchart LR
  A["Description enricher"] -- "requests" --> B["LLM JSON"]
  B -- "returns" --> C["description"]
  B -- "returns" --> D["missing_documents"]
  D -- "filters" --> E["missing_details rules"]
  C -- "writes with ETag" --> F["Case API"]
  E -- "writes with ETag" --> F
Loading

File Walkthrough

Relevant files
Enhancement
2 files
enrich_description.py
Generate missing details with descriptions                             
+299/-61
missing_details.py
Add missing details rule engine                                                   
+359/-0 
Configuration changes
1 files
pipeline.py
Register conditional missing details provider                       
+16/-22 
Documentation
1 files
enrich_allegations.py
Document allegations field ownership                                         
+3/-28   
Tests
3 files
test_enrich_description.py
Cover dual-field description enrichment                                   
+465/-24
test_missing_details.py
Test missing details pure rules                                                   
+525/-0 
test_enrich_allegations.py
Clarify allegations missing details boundary                         
+4/-13   


🛠️ Relevant configurations:


These are the relevant configurations for this tool:

[config]

custom_model_max_tokens: 200000
git_provider: github
output_relevant_configurations: True
model: openai/cx/gpt-5.5
ENABLE_AUTO_APPROVAL: True
custom_reasoning_model: False
fallback_models: ['openai/cx/gpt-5.4-mini']
is_auto_command: True
publish_output: True
publish_output_progress: True
progress_gif_url: 
progress_gif_width: 48
verbosity_level: 0
use_extra_bad_extensions: False
log_level: DEBUG
use_wiki_settings_file: True
use_repo_settings_file: True
use_global_settings_file: True
extra_config_url: 
disable_auto_feedback: False
ai_timeout: 120
response_language: en-US
repo_context_files: ['AGENTS.md']
repo_context_from_default_branch: True
repo_context_max_lines: 500
max_description_tokens: 500
max_commits_tokens: 500
max_model_tokens: 32000
model_token_count_estimate_factor: 0.3
patch_extension_skip_types: ['.md', '.txt']
allow_dynamic_context: True
max_extra_lines_before_dynamic_context: 10
patch_extra_lines_before: 5
patch_extra_lines_after: 1
cli_mode: False
large_patch_policy: clip
duplicate_prompt_examples: False
seed: -1
temperature: 0.2
ignore_pr_title: ['^\\[Auto\\]', '^Auto', '^Bump ', '^chore\\(deps\\)']
ignore_pr_target_branches: []
ignore_pr_source_branches: []
ignore_pr_labels: []
ignore_pr_authors: []
ignore_repositories: []
ignore_language_framework: []
restricted_mode: False
enable_ai_metadata: False
reasoning_effort: medium
enable_claude_extended_thinking: False
extended_thinking_budget_tokens: 2048
extended_thinking_max_output_tokens: 4096
claude_extended_thinking_models_override: []
extract_issue_from_branch: True
branch_issue_regex: 
enable_custom_labels: False

[pr_description]

publish_labels: False
add_original_user_description: True
generate_ai_title: False
use_bullet_points: True
extra_instructions: 
enable_pr_type: True
final_update_message: True
enable_help_text: False
enable_help_comment: False
enable_pr_diagram: True
publish_description_as_comment: False
publish_description_as_comment_persistent: True
enable_semantic_files_types: True
collapsible_file_list: adaptive
collapsible_file_list_threshold: 6
inline_file_summary: False
use_description_markers: False
enable_large_pr_handling: True
include_generated_by_header: True
max_ai_calls: 4
async_ai_calls: True

Summary by CodeRabbit

  • New Features

    • Added missing-document details to case descriptions, including charge sheets and Supreme Court appeal references when supported by available evidence.
    • Displays concise, Nepali-numbered lists with normalized wording and summaries of held materials.
    • Combines description and missing-document information in a single enrichment update.
  • Bug Fixes

    • Filters duplicate, unsupported, filler, malformed, and oversized document entries.
    • Prevents misleading output when required case evidence or verdict information is unavailable.
    • Preserves existing description and valid missing-details content during updates.

`Case.missing_details` -- the "what we still don't hold" section on every case
page -- had no writer. This adds one, riding in the LLM call that already reads
the verdict.

Two parts make up the value. A DETERMINISTIC floor from what is bound (the
charge sheet, and whether an appeal was lodged), which is verifiable and never
guesses. Then up to 4 specific documents the model found the sources CITE but
our evidence lacks -- named with their dates, dispatch numbers and parties.

WHY IT RIDES IN THE DESCRIPTION CALL. `enrich_description` already bills 1+N
premium calls per case, where N is the verdict's 150,000-char chunk count.
Batch verdicts run to a 141,000-char median, so a standalone stage would
re-read the same फैसला from scratch and roughly double the batch's premium
spend. Derivation stays independent: the field comes from which materials are
bound plus what the sources cite, never from the finished narrative.

The gates differ -- `description` needs press release OR verdict,
`missing_details` needs the verdict -- so `STAGES["description"].provides` is
the one CONDITIONAL entry in that table. Read it as "can provide".

The model proposes and the rules dispose. `held_summary` prints our bound
evidence into the prompt so the model computes a difference rather than
guessing at absence, which also makes the grounding rule checkable in code:
a claimed-missing document we demonstrably hold is rejected, with the rule
named in the run log. Rejections are never silent -- a dropped item and a model
that found nothing need opposite follow-up.

Guards worth knowing about:
  - This stage only writes into an EMPTY `missing_details`, and --force does not
    override that. The importer's truncation guard puts `ACCUSED LIST
    INCOMPLETE` in the same field and the 61 published values are hand-written;
    the floor items cannot serve as a "we wrote this" signature because they
    were copied verbatim FROM those hand-written cases.
  - `patch_fields`, not two `patch_field` calls -- the second call's ETag would
    already be stale, so a loop cannot stay conditional.
  - `MAX_LLM_ITEMS` is the binding limit, not the char cap. A character cap
    always cuts the LAST item, which is always the most specific one, because
    specificity is long. Measured twice on real output before the cap was
    demoted to a sanity guard.
  - A partial fetch falls back to the floor. `has_verdict` reads bindings, so a
    case whose court order 500s still reports True while the model never saw it.

Verified read-only against production on 2026-08-08 for three cases through a
GET-only proxy, no --apply: 078-CR-0111, 079-CR-0047, 078-CR-0118. Each
produced 6 items, ~$1.74 per case.

Two known limits are documented in the spec rather than papered over: nothing
detects "a sentence, not a document name", and `COURT_TYPES` cannot tell a
Supreme Court ruling from a Special Court verdict.

Design: docs/superpowers/specs/2026-08-07-missing-details-enricher-design.md
in the meta-repo.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

@claude claude 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.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, push a new commit or reopen this pull request to trigger a review.

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@gaurav-karki, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 27 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 47bde375-2c53-43c7-94a4-f490935e98c4

📥 Commits

Reviewing files that changed from the base of the PR and between bf9906f and b819977.

📒 Files selected for processing (2)
  • casework/common/missing_details.py
  • tests/casework/test_enrich_description.py
📝 Walkthrough

Walkthrough

The description stage now generates description and missing_details together. New validation logic combines deterministic floor items with accepted model findings, applies evidence and output limits, and conditionally stores both fields.

Changes

Missing Details Generation

Layer / File(s) Summary
Missing-detail assembly and validation
casework/common/missing_details.py, tests/casework/test_missing_details.py
The new module detects evidence, creates verdict-gated floor items, filters model candidates, and renders bounded Nepali output. Tests cover evidence detection, rejection rules, duplicates, limits, and rendering.
Description-stage generation and parsing
casework/enrich_description.py, tests/casework/test_enrich_description.py
The enricher requests description and missing_documents, supplies held-document context, and normalizes model responses before validation.
Independent completion and conditional persistence
casework/enrich_description.py, tests/casework/test_enrich_description.py
The enricher evaluates both fields independently, preserves existing values, records outcomes, and uses one conditional multi-field PATCH request.
Stage contract and boundary documentation
casework/common/pipeline.py, casework/enrich_allegations.py, tests/casework/test_enrich_allegations.py
The pipeline declares conditional missing_details output. Documentation assigns its handling to the description stage.

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

Sequence Diagram(s)

sequenceDiagram
  participant CaseworkPipeline
  participant enrich_description
  participant LLM
  participant missing_details
  participant CaseworkAPI
  CaseworkPipeline->>enrich_description: run description stage
  enrich_description->>LLM: request description and missing_documents
  LLM-->>enrich_description: return parsed candidates
  enrich_description->>missing_details: validate candidates and build output
  missing_details-->>enrich_description: rendered missing_details or None
  enrich_description->>CaseworkAPI: conditional patch_fields update
Loading

Possibly related PRs

Suggested reviewers: jawafdehi-pr-agent

Poem

A rabbit checks each missing page,
Nepali marks line up the stage.
The model offers; rules decide,
Two fields travel side by side.
“Hop!” says the patch, both values bright.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.25% 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
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: populating missing_details during the existing description call.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/casework-missing-details

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@jawafdehi-pr-agent

jawafdehi-pr-agent Bot commented Aug 8, 2026

Copy link
Copy Markdown

PR Reviewer Guide 🔍

(Review updated until commit b819977)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected

🛠️ Relevant configurations:


These are the relevant configurations for this tool:

[config]

enable_ai_metadata: False
custom_model_max_tokens: 200000
git_provider: github
output_relevant_configurations: True
model: openai/cx/gpt-5.5
ENABLE_AUTO_APPROVAL: True
custom_reasoning_model: False
fallback_models: ['openai/cx/gpt-5.4-mini']
is_auto_command: True
publish_output: True
publish_output_progress: True
progress_gif_url: 
progress_gif_width: 48
verbosity_level: 0
use_extra_bad_extensions: False
log_level: DEBUG
use_wiki_settings_file: True
use_repo_settings_file: True
use_global_settings_file: True
extra_config_url: 
disable_auto_feedback: False
ai_timeout: 120
response_language: en-US
repo_context_files: ['AGENTS.md']
repo_context_from_default_branch: True
repo_context_max_lines: 500
max_description_tokens: 500
max_commits_tokens: 500
max_model_tokens: 32000
model_token_count_estimate_factor: 0.3
patch_extension_skip_types: ['.md', '.txt']
allow_dynamic_context: True
max_extra_lines_before_dynamic_context: 10
patch_extra_lines_before: 5
patch_extra_lines_after: 1
cli_mode: False
large_patch_policy: clip
duplicate_prompt_examples: False
seed: -1
temperature: 0.2
ignore_pr_title: ['^\\[Auto\\]', '^Auto', '^Bump ', '^chore\\(deps\\)']
ignore_pr_target_branches: []
ignore_pr_source_branches: []
ignore_pr_labels: []
ignore_pr_authors: []
ignore_repositories: []
ignore_language_framework: []
restricted_mode: False
reasoning_effort: medium
enable_claude_extended_thinking: False
extended_thinking_budget_tokens: 2048
extended_thinking_max_output_tokens: 4096
claude_extended_thinking_models_override: []
extract_issue_from_branch: True
branch_issue_regex: 
enable_custom_labels: False

[pr_reviewer]

require_ticket_analysis_review: False
require_score_review: False
require_tests_review: True
require_estimate_effort_to_review: True
require_can_be_split_review: False
require_security_review: True
require_estimate_contribution_time_cost: False
require_todo_scan: False
publish_output_no_suggestions: True
persistent_comment: True
extra_instructions: Focus on: logic errors and edge cases; security/authz regressions; missing error handling;
Django/DRF correctness (migrations, N+1 queries, transaction/atomicity, serializer & permission gaps).
Do NOT comment on formatting, import order, or naming — ruff handles those in CI.

num_max_findings: 3
final_update_message: True
enable_review_labels_security: True
enable_review_labels_effort: True
require_all_thresholds_for_incremental_review: False
minimal_commits_for_incremental_review: 0
minimal_minutes_for_incremental_review: 0
enable_intro_text: True
enable_help_text: False

@jawafdehi-pr-agent

Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Handle scalar model output

proposed string iterates character-by-character. A malformed model reply can publish
single Nepali letters as document names. Normalize one string to one item, or reject
it before iteration.

casework/common/missing_details.py [323-326]

+if isinstance(proposed, str):
+    proposed = [proposed]
 for item in list(proposed or []):
     if not isinstance(item, str):
         rejected.append((repr(item), "not a string"))
         continue
Suggestion importance[1-10]: 7

__

Why: Valid bug: scalar proposed becomes per-character items. Fix prevents malformed model output publishing junk.

Medium
General
Prevent enumerator overflow

render indexes LETTERS without a local cap. Any direct caller passing more than
eight items raises IndexError. Clamp or fail safely inside render.

casework/common/missing_details.py [179]

+items = items[:len(LETTERS)]
 return "\n".join(f"{LETTERS[i]}) {t}" for i, t in enumerate(items))
Suggestion importance[1-10]: 4

__

Why: Valid defensive fix: render can overflow LETTERS for direct callers. Lower impact because build caps via MAX_ITEMS.

Low

🛠️ Relevant configurations:


These are the relevant configurations for this tool:

[config]

enable_ai_metadata: False
custom_model_max_tokens: 200000
git_provider: github
output_relevant_configurations: True
model: openai/cx/gpt-5.5
ENABLE_AUTO_APPROVAL: True
custom_reasoning_model: False
fallback_models: ['openai/cx/gpt-5.4-mini']
is_auto_command: True
publish_output: True
publish_output_progress: True
progress_gif_url: 
progress_gif_width: 48
verbosity_level: 0
use_extra_bad_extensions: False
log_level: DEBUG
use_wiki_settings_file: True
use_repo_settings_file: True
use_global_settings_file: True
extra_config_url: 
disable_auto_feedback: False
ai_timeout: 120
response_language: en-US
repo_context_files: ['AGENTS.md']
repo_context_from_default_branch: True
repo_context_max_lines: 500
max_description_tokens: 500
max_commits_tokens: 500
max_model_tokens: 32000
model_token_count_estimate_factor: 0.3
patch_extension_skip_types: ['.md', '.txt']
allow_dynamic_context: True
max_extra_lines_before_dynamic_context: 10
patch_extra_lines_before: 5
patch_extra_lines_after: 1
cli_mode: False
large_patch_policy: clip
duplicate_prompt_examples: False
seed: -1
temperature: 0.2
ignore_pr_title: ['^\\[Auto\\]', '^Auto', '^Bump ', '^chore\\(deps\\)']
ignore_pr_target_branches: []
ignore_pr_source_branches: []
ignore_pr_labels: []
ignore_pr_authors: []
ignore_repositories: []
ignore_language_framework: []
restricted_mode: False
reasoning_effort: medium
enable_claude_extended_thinking: False
extended_thinking_budget_tokens: 2048
extended_thinking_max_output_tokens: 4096
claude_extended_thinking_models_override: []
extract_issue_from_branch: True
branch_issue_regex: 
enable_custom_labels: False

[pr_code_suggestions]

commitable_code_suggestions: False
dual_publishing_score_threshold: -1
focus_only_on_problems: True
extra_instructions: Prefer a few high-impact, project-specific suggestions over many generic ones.
Skip style/formatting (ruff-enforced) and changes under cases/migrations/.

enable_help_text: False
enable_chat_text: False
persistent_comment: True
max_history_len: 4
publish_output_no_suggestions: True
suggestions_score_threshold: 0
new_score_mechanism: True
new_score_mechanism_th_high: 9
new_score_mechanism_th_medium: 7
auto_extended_mode: True
num_code_suggestions_per_chunk: 3
max_number_of_calls: 3
parallel_calls: True
final_clip_factor: 0.8
decouple_hunks: False
demand_code_suggestions_self_review: False
code_suggestions_self_review_text: **Author self-review**: I have reviewed the PR code suggestions, and addressed the relevant ones.
approve_pr_on_self_review: False
fold_suggestions_on_self_review: True
num_code_suggestions: 4

@jawafdehi-pr-agent

Copy link
Copy Markdown

PR Agent Walkthrough 🤖

Welcome to the PR Agent, an AI-powered tool for automated pull request analysis, feedback, suggestions and more.

Here is a list of tools you can use to interact with the PR Agent:

ToolDescriptionTrigger Interactively 💎

DESCRIBE

Generates PR description - title, type, summary, code walkthrough and labels
  • Run

REVIEW

Adjustable feedback about the PR, possible issues, security concerns, review effort and more
  • Run

IMPROVE

Code suggestions for improving the PR
  • Run

UPDATE CHANGELOG

Automatically updates the changelog
  • Run

HELP DOCS

Answers a question regarding this repository, or a given one, based on given documentation path
  • Run

ADD DOCS

Generates documentation to methods/functions/classes that changed in the PR
  • Run

ASK

Answering free-text questions about the PR

[*]

GENERATE CUSTOM LABELS

Generates custom labels for the PR, based on specific guidelines defined by the user

[*]

(1) Note that each tool can be triggered automatically when a new PR is opened, or called manually by commenting on a PR.

(2) Tools marked with [*] require additional parameters to be passed. For example, to invoke the /ask tool, you need to comment on a PR: /ask "<question content>". See the relevant documentation for each tool for more details.

@jawafdehi-pr-agent

Copy link
Copy Markdown

Auto-approved PR

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
tests/casework/test_enrich_description.py (1)

1299-1566: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the “already, nothing left to write” path.

CASE_ALREADY has a substantial description and a court-order evidence item, but it lacks a charge-sheet evidence item. Derive a case from CASE_WITH_APPEAL plus charge-sheet evidence, then assert status == "already", reason == "nothing left to write", and no conditional PATCH request when both floor items are satisfied.

🤖 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 `@tests/casework/test_enrich_description.py` around lines 1299 - 1566, Add an
end-to-end test near the existing missing_details apply-path tests that derives
a case from CASE_WITH_APPEAL, adds charge-sheet evidence so both deterministic
floor items are satisfied, and supplies the corresponding model response. Assert
the report row has status "already" with reason "nothing left to write", and
verify the stub API recorded no conditional PATCH request.
🤖 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.

Nitpick comments:
In `@tests/casework/test_enrich_description.py`:
- Around line 1299-1566: Add an end-to-end test near the existing
missing_details apply-path tests that derives a case from CASE_WITH_APPEAL, adds
charge-sheet evidence so both deterministic floor items are satisfied, and
supplies the corresponding model response. Assert the report row has status
"already" with reason "nothing left to write", and verify the stub API recorded
no conditional PATCH request.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e5a1fb2d-aa08-4fd3-8e7c-5f9970445899

📥 Commits

Reviewing files that changed from the base of the PR and between 0800f44 and bf9906f.

📒 Files selected for processing (7)
  • casework/common/missing_details.py
  • casework/common/pipeline.py
  • casework/enrich_allegations.py
  • casework/enrich_description.py
  • tests/casework/test_enrich_allegations.py
  • tests/casework/test_enrich_description.py
  • tests/casework/test_missing_details.py

The design doc it referenced is not being kept. The rationale it held -- why
this rides in the description call, why the char cap is a sanity guard, why the
held-document rule matches a head noun rather than a length ratio, and the two
limits that are not fixed -- lives in the pull request description instead.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jawafdehi-pr-agent

Copy link
Copy Markdown

Persistent review updated to latest commit 9fdfa6d

The per-field idempotency gate admits an already-described case so its EMPTY
`missing_details` can be filled. If BOTH floor items are already satisfied --
charge sheet bound AND a Supreme reference on file -- and the model finds
nothing, there is nothing honest to say and no reason to rewrite the
description, which leaves an empty patch. That must not become a request.

The branch existed and was untested. Raised by CodeRabbit on #441.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@jawafdehi-pr-agent

Copy link
Copy Markdown

Persistent review updated to latest commit b819977

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@Jawafdehi Jawafdehi deleted a comment from coderabbitai Bot Aug 8, 2026
@gaurav-karki

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant