fix: default missing status field to OPEN in question formatting
Fix question extraction bug where AI-generated questions were being
filtered out due to missing 'status' field.
**Root Cause:**
The AI agents module returns questions without a 'status' field:
{'participant': 'Bob', 'question': 'text', 'line': 'original'}
But format_questions_section() filtered for status == "OPEN":
open_questions = [q for q in questions if q.get("status") == "OPEN"]
Since AI questions had no status, q.get("status") returned None,
which didn't match "OPEN", so questions were filtered out.
**Fix:**
Default missing status to "OPEN" in the filter:
open_questions = [q for q in questions if q.get("status", "OPEN") == "OPEN"]
This makes the function defensive - questions without explicit status
are treated as OPEN, which matches the basic extraction behavior.
**Impact:**
- Questions extracted by AI agents now appear in summaries
- Maintains backward compatibility with basic extraction (has status)
- All 18 tests now pass (was 17/18)
**Testing:**
- Verified with test_run_status_updates_summary_sections
- Question "What is the rollout plan?" now correctly appears in summary
- No regressions in other tests
Resolves test failure identified in comprehensive project review.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
6135d42bc0
commit
f6ce763a49
|
|
@ -85,7 +85,8 @@ def format_questions_section(questions: list[dict[str, Any]]) -> str:
|
||||||
|
|
||||||
# Split questions by status so OPEN items stay at the top and partial answers
|
# Split questions by status so OPEN items stay at the top and partial answers
|
||||||
# can be rendered with their follow-up context.
|
# can be rendered with their follow-up context.
|
||||||
open_questions = [q for q in questions if q.get("status") == "OPEN"]
|
# Default to "OPEN" if status field is missing (for AI-extracted questions)
|
||||||
|
open_questions = [q for q in questions if q.get("status", "OPEN") == "OPEN"]
|
||||||
partial_questions = [q for q in questions if q.get("status") == "PARTIAL"]
|
partial_questions = [q for q in questions if q.get("status") == "PARTIAL"]
|
||||||
|
|
||||||
if open_questions:
|
if open_questions:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue