Skip to content

Fix 9 failing live integration tests (memory leaks + missing status check) #121

Description

@tomjnsn

Problem

9 live integration tests fail consistently due to memory leaks detected by testing.allocator (GPA) and a missing HTTP status check.

Failing Tests

# Test Root Cause
1 Azure streamText Missing defer deinit in test
2 Anthropic streamText Missing defer + provider leaks streaming IDs
3 Google streamText Missing defer + provider leaks text copies
4 OpenAI generateObject generateObject passes base allocator to doGenerate
5 Anthropic generateObject Same as #4
6 Google generateObject Same as #4
7 Google streamObject streamObject passes base allocator to doStream
8 Google embed No HTTP status code check → parses error body as response
9 Google embedMany Same as #8

Fix Summary

  1. Add missing defer http_client.deinit() and defer provider.deinit() to all streamText tests
  2. Anthropic streaming: use stream_allocator for ephemeral IDs instead of result_allocator
  3. Google streaming: use request_allocator for text/function call copies instead of result_allocator
  4. generateObject: pass arena_allocator to doGenerate, dupe result strings to base allocator
  5. streamObject: pass arena_allocator to doStream
  6. Google embedding: add HTTP status code check before parsing response body

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions