feat: review chat — ask the run why it concluded a finding
Docker Release / build-and-push (push) Successful in 1m45s
Docker Release / release (push) Skipped

Read-only Q&A on the review screen, per finding and per run, answered from
the job's own artifacts (evidence, cluster, extraction, verification, Brain
merge, sheet index, cover reconciliation, job.log). It never mutates findings,
decisions, or the report.

Turns are logged job-locally (review/chat_log.jsonl, transcript at
/jobs/{id}/review-chat/log) and to a cross-job feedback store
(REVIEW_FEEDBACK_DIR), which now also receives review decisions with their
category/severity corrections.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0115gGtrSxXE9DKvS9XPFSoT
This commit is contained in:
woogiandClaude Opus 5 committed 2026-09-14 10:35:18 -05:00
1 parent 46db871152
commit 23e19f53b2
15 files changed
+1598 -9

No files matched your search

+31
View File
@@ -85,3 +85,34 @@ def test_write_label_appends_json_lines(tmp_path):
with open(path, encoding="utf-8") as f:
lines = [json.loads(line) for line in f if line.strip()]
assert lines == [label1, label2]
def test_decision_label_carries_reviewer_corrections():
"""category/severity corrections reach the label instead of being dropped."""
decision = {"decision": "reject", "reason_code": "extraction_misread",
"category_correction": "power floor box",
"severity_correction": "low"}
label = decision_to_label(_queue_item(), decision, {"job_id": "abc123", "pipeline_mode": "agent",
"report": {"summary": {}}})
assert label["category_correction"] == "power floor box"
assert label["severity_correction"] == "low"
assert label["kind"] == "review_decision"
def test_write_label_also_lands_in_the_cross_job_store(tmp_path):
from backend import config
from backend.review.feedback import read_shared_feedback
label = decision_to_label(_queue_item(), {"decision": "reject",
"reason_code": "extraction_misread"},
{"job_id": "abc123", "pipeline_mode": "agent",
"report": {"summary": {}}})
write_label(str(tmp_path), label)
assert os.path.isfile(os.path.join(config.REVIEW_FEEDBACK_DIR, "decisions.jsonl"))
records = read_shared_feedback("review_decision")
assert len(records) == 1
assert records[0]["reason_code"] == "extraction_misread"
def test_shared_feedback_read_is_empty_when_nothing_written():
from backend.review.feedback import read_shared_feedback
assert read_shared_feedback("review_decision") == []