From 0a2aba1d7619a891d8cad0b397a6611474e9cc7e Mon Sep 17 00:00:00 2001 From: adham90 Date: Fri, 6 Mar 2026 17:45:07 +0200 Subject: [PATCH] Fix flaky tenant_auto_create_spec by explicitly setting track_executions The test relied on track_executions defaulting to true, but other specs (e.g., instrumentation_spec) could leave it as false via test pollution, causing the execution record query to return nil. Co-Authored-By: Claude Opus 4.6 --- spec/agents/tenant_auto_create_spec.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/agents/tenant_auto_create_spec.rb b/spec/agents/tenant_auto_create_spec.rb index 13603ba..3921cd1 100644 --- a/spec/agents/tenant_auto_create_spec.rb +++ b/spec/agents/tenant_auto_create_spec.rb @@ -78,14 +78,17 @@ def user_prompt Object.send(:remove_const, :AutoCreateTenantTestAgent) if Object.const_defined?(:AutoCreateTenantTestAgent) end - # Enable multi-tenancy so execution records include tenant_id + # Enable multi-tenancy and ensure tracking is on so execution records are created around do |example| original_multi_tenancy = RubyLLM::Agents.configuration.multi_tenancy_enabled + original_track_executions = RubyLLM::Agents.configuration.track_executions RubyLLM::Agents.configuration.multi_tenancy_enabled = true + RubyLLM::Agents.configuration.track_executions = true example.run ensure RubyLLM::Agents.configuration.multi_tenancy_enabled = original_multi_tenancy + RubyLLM::Agents.configuration.track_executions = original_track_executions end # Stub the LLM call so we don't hit real APIs