Skip to content

Interview doesn't exit when done: LLM not setting all boolean fields to false #70

@jhs

Description

@jhs

Bug Description

The Chatfield server doesn't automatically exit when the interview should be complete. The _done property returns False because several fields remain None even though the conversation appears finished and the user said "Done".

Root Cause

When using multiple .as_bool() fields for mutually exclusive checkboxes (like W-9 federal tax classification), the LLM only sets the field(s) that should be True and leaves the others as None. This causes _done to return False since it checks all(field is not None for field in fields).

Reproduction

Using the W-9 form with this interview definition:

.field("topmostSubform[0].Page1[0].Boxes3a-b_ReadOrder[0].c1_1[0]")
    .desc("Are you an Individual or sole proprietor for federal tax purposes?")
    .as_bool()
.field("topmostSubform[0].Page1[0].Boxes3a-b_ReadOrder[0].c1_1[1]")
    .desc("Are you a C Corporation for federal tax purposes?")
    .as_bool()
# ... 5 more similar boolean checkbox fields

When the user says "I am filing as an Individual/sole proprietor", the LLM only sets:

  • c1_1[0] = True (Individual)
  • Leaves c1_1[1] through c1_1[6] as None

Expected Behavior

One of:

  1. LLM should set all boolean fields: When a boolean field is not mentioned or implicitly false, the LLM should call the update tool with False or "" for that field
  2. Alice trait should work for booleans: The trait "records optional fields as empty string when user indicates or implies no answer" should apply to boolean fields
  3. _done should be smarter: Consider boolean fields with None as implicitly False if other mutually exclusive booleans in the same group are set

Actual Behavior

Fields remain None and the interview never exits automatically:

  topmostSubform[0].Page1[0].Boxes3a-b_ReadOrder[0].c1_1[0]: 'Yes'
    as_bool                  : True
  topmostSubform[0].Page1[0].Boxes3a-b_ReadOrder[0].c1_1[1]: None  # Should be False
  topmostSubform[0].Page1[0].Boxes3a-b_ReadOrder[0].c1_1[2]: None  # Should be False
  topmostSubform[0].Page1[0].Boxes3a-b_ReadOrder[0].c1_1[3]: None  # Should be False
  # ... etc

Conversation Example

Alice: Could you please tell me your full legal name as it appears on your tax return?
Bob: I am filing as an Individual/sole proprietor. [provides other info]
Alice: Great! I've recorded the information. Could you please confirm your full legal name?
Bob: Jason Smith
Alice: Is there anything else you'd like to add or change?
Bob: Done
Alice: All set! Your W-9 form is complete.
# Server continues running instead of exiting

Workaround

The interview designer should use .as_one() for mutually exclusive options instead of multiple .as_bool() fields:

.field("federal_tax_classification")
    .desc("What is your federal tax classification?")
    .as_one("Individual/sole proprietor", "C Corporation", "S Corporation", 
            "Partnership", "Trust/estate", "LLC", "Other")

However, this doesn't match the PDF structure where each checkbox is a separate field.

Design Question

Should multiple boolean fields representing mutually exclusive checkboxes be:

  1. Separate .as_bool() fields (current approach, but breaks _done)
  2. A single .as_one() field (works, but doesn't match PDF field structure)
  3. Separate .as_bool() fields with smarter default handling

Related Files

  • Python: Python/chatfield/interviewer.py - _done property
  • Python: Python/chatfield/interview.py - Field value storage
  • PDF Skill: .claude/skills/pdf/forms.md - Documentation for PDF form workflow

Environment

  • Chatfield Python v0.2.0
  • LangGraph 1.0.0a3+
  • Using W-9 PDF form with 23 fields including 9 boolean checkboxes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions