Files
my-pal-mcp-server/pr_template_filled_simplified.md
Josh Vera a1451befd2 refactor: Clean up test files and simplify documentation
- Remove unused cassette files with incomplete recordings
- Delete broken respx test files (test_o3_pro_respx_simple.py, test_o3_pro_http_recording.py)
- Fix respx references in docstrings to mention HTTP transport recorder
- Simplify vcr-testing.md documentation (60% reduction, more task-oriented)
- Add simplified PR template with better test instructions
- Fix cassette path consistency in examples
- Add security note about reviewing cassettes before committing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-12 19:24:51 -06:00

1.7 KiB

PR Title

fix: Fix o3-pro empty response issue by using output_text field

Summary

Fixes o3-pro API calls returning empty responses due to incorrect response parsing. The code was trying to parse response.output.content[] array, but o3-pro provides output_text directly.

Changes

  • Fixed o3-pro response parsing to use output_text field
  • Added _safe_extract_output_text method with validation
  • Implemented HTTP transport recorder for testing expensive API calls
  • Added PII sanitization for test recordings
  • Added regression tests

No breaking changes - Internal fix only

Testing

source venv/bin/activate
./code_quality_checks.sh

# Run the new tests added in this PR
python -m pytest tests/test_o3_pro_output_text_fix.py -v
python -m pytest tests/test_pii_sanitizer.py -v

# Or run all new tests together
python -m pytest tests/test_o3_pro_output_text_fix.py tests/test_pii_sanitizer.py -v
  • All checks pass
  • Regression tests added:
    • test_o3_pro_output_text_fix.py - Validates o3-pro response parsing and HTTP transport recording
    • test_pii_sanitizer.py - Ensures API key sanitization

Code Example

Before:

# Incorrect - manual parsing
for content_item in response.output.content:
    if content_item.type == "output_text":
        content = content_item.text

After:

# Correct - direct field access
content = response.output_text

For Reviewers

  • Core fix: providers/openai_compatible.py - see _safe_extract_output_text() method
  • Response parsing: _generate_with_responses_endpoint() method now uses the direct field
  • Test infrastructure changes don't affect production code
  • All test recordings sanitized for security