Skip to content

Conversation

@delner
Copy link
Collaborator

@delner delner commented Dec 25, 2025

Problem

Running bundle exec appraisal openai rake test produced intermittent WebMock errors:

#<Thread:... /app/lib/braintrust/state.rb:151 run> terminated with exception
WebMock::NetConnectNotAllowedError: Real HTTP connections are disabled

Cause

test_login_in_thread_retries_on_failure created State.new before setting up WebMock stubs. Since State.new immediately spawns a background login thread when no org_id is provided, the thread attempted HTTP requests before stubs were ready.

Solution

Reorder the test to set up stubs before creating State.new, ensuring the background thread spawns with stubs already in place. This follows the same pattern as PR #65.

@delner delner requested review from clutchski and realark December 25, 2025 20:36
@delner delner self-assigned this Dec 25, 2025
@delner delner added the bug Something isn't working label Dec 25, 2025
@delner delner force-pushed the fix/login_thread_leak_2 branch from c284a72 to d8aa193 Compare December 27, 2025 01:18
@delner delner force-pushed the fix/login_thread_leak_2 branch from d8aa193 to 4da1432 Compare December 29, 2025 06:55
@delner delner merged commit 3c6f940 into main Dec 29, 2025
7 checks passed
@delner delner deleted the fix/login_thread_leak_2 branch December 29, 2025 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants