Files
cleveragents-core/features/openai_provider.feature
HAL9000 f808abff86 chore(ci): fix pre-commit hook failures
Fix JSON syntax errors in .devcontainer/devcontainer.json (removed
invalid JS-style // comments) and .devcontainer/opencode.json (removed
90+ trailing commas). Apply auto-fixes for end-of-file and trailing
whitespace issues across 100+ files. Fix SIM105 ruff violations in
benchmarks/core_circuit_breaker_bench.py (use contextlib.suppress).

Note: The security fix from issue #7478 (validate_path startswith bypass)
was already delivered to master in commit e18ac5f2. This PR as currently
structured is non-atomic (35 commits across 10+ issues) and needs
significant restructure before merge. This commit only addresses the
CI/pre-commit failures.

ISSUES CLOSED: #7478
2026-06-14 09:51:14 -04:00

67 lines
3.9 KiB
Gherkin

Feature: OpenAI chat provider coverage
As a maintainer integrating real provider adapters
I want unit-level Behave scenarios for the OpenAI chat provider
So that the placeholder implementation stays documented and regression tested
@unit @providers @openai
Scenario: OpenAI provider instantiates ChatOpenAI with provided credentials
Given I have sample provider domain inputs
When I create an OpenAI chat provider with API key "sk-unit-test" and model "gpt-4o-mini"
And I request plan generation from the OpenAI provider
Then the OpenAI provider should construct ChatOpenAI with api key "sk-unit-test" and model "gpt-4o-mini"
And the OpenAI provider metadata should report name "openai" and model "gpt-4o-mini"
@unit @providers @openai
Scenario: OpenAI provider stubbed response reports metadata
Given I have sample provider domain inputs
And I create an OpenAI chat provider with API key "sk-unit-test" and model "gpt-4o-mini"
When I request plan generation from the OpenAI provider
Then the OpenAI provider response should contain no generated changes
And the OpenAI provider response should report the requested model without errors
@unit @providers @openai
Scenario: OpenAI provider rejects missing API key
Given I have sample provider domain inputs
When I attempt to create an OpenAI chat provider without an API key
Then the OpenAI provider creation should fail with error "OpenAI API key is required"
@unit @providers @openai
Scenario: OpenAI provider forwards optional organization and kwargs
Given I have sample provider domain inputs
And I set the OpenAI provider organization "org-test-123"
And I set the OpenAI provider extra kwargs "temperature=0.35,max_tokens=256"
When I create an OpenAI chat provider with API key "sk-unit-test" and model "gpt-4o-mini"
And I request plan generation from the OpenAI provider
Then the OpenAI provider should construct ChatOpenAI with api key "sk-unit-test" and model "gpt-4o-mini"
And the OpenAI provider should include organization "org-test-123" in the ChatOpenAI call
And the OpenAI provider should include kwargs "temperature=0.35,max_tokens=256" in the ChatOpenAI call
@unit @providers @openai
Scenario: OpenAI provider reports runtime errors
Given I have sample provider domain inputs
And I create an OpenAI chat provider with API key "sk-unit-test" and model "gpt-4o-mini"
And the plan generation graph raises RuntimeError "deadline reached"
When I request plan generation from the OpenAI provider
Then the OpenAI provider response should report error "deadline reached"
And the OpenAI provider response should contain no generated changes
@unit @providers @openai
Scenario: OpenAI provider streaming yields workflow events
Given I have sample provider domain inputs
And the plan generation graph returns a generated change for "app/stream.py"
And the plan generation graph emits streaming nodes "load_context,analyze_requirements,generate_plan,validate"
And I create an OpenAI chat provider with API key "sk-unit-test" and model "gpt-4o-mini"
When I stream plan generation from the OpenAI provider
Then the OpenAI provider streaming events should include nodes "load_context,analyze_requirements,generate_plan,validate"
And the OpenAI provider streaming result should finish with a response containing 1 generated change
@unit @providers @openai
Scenario: OpenAI provider surfaces plan generation errors
Given I have sample provider domain inputs
And the plan generation graph raises ValueError "graph exploded"
And I create an OpenAI chat provider with API key "sk-unit-test" and model "gpt-4o-mini"
When I request plan generation from the OpenAI provider
Then the OpenAI provider response should report error "graph exploded"
And the OpenAI provider response should contain no generated changes