fix(reactive): forward actor options block in ToolCallingLLMCaller._resolve_llm
CI / push-validation (pull_request) Successful in 35s
CI / helm (pull_request) Successful in 42s
CI / build (pull_request) Successful in 47s
CI / lint (pull_request) Successful in 1m10s
CI / typecheck (pull_request) Successful in 1m11s
CI / quality (pull_request) Successful in 1m10s
CI / security (pull_request) Successful in 1m37s
CI / integration_tests (pull_request) Failing after 4m9s
CI / unit_tests (pull_request) Successful in 4m59s
CI / docker (pull_request) Successful in 1m25s
CI / coverage (pull_request) Successful in 11m7s
CI / status-check (pull_request) Failing after 3s

Port the options-block merging logic from SimpleLLMAgent._resolve_llm()
(stream_router.py, added in PR #11225 / commit b3851693) to the parallel
resolution path ToolCallingLLMCaller._resolve_llm() in tool_caller.py.

Without this fix, running an actor with --skill would ignore the options
block in the actor YAML, causing openai_api_base and openai_api_key to be
silently dropped.  The provider registry then fell back to OPENAI_API_KEY
from the environment, routing requests to api.openai.com instead of the
configured local llama-swap/llama.cpp backend (HTTP 401).

Changes:
- tool_caller.ToolCallingLLMCaller._resolve_llm: read actor_config.options;
  extract openai_api_key -> __api_key_sentinel; forward allowed keys
  (openai_api_base, timeout, top_p, frequency_penalty, presence_penalty);
  reject reserved keys (provider_type, model_id) and unknown keys with
  logger.warning, matching SimpleLLMAgent behaviour exactly.
- features/actor_run_tool_calling.feature: add five BDD regression
  scenarios (section V, tagged @tdd_issue @tdd_issue_11243) covering
  api_base+key forwarding, allowed extra keys, reserved key rejection,
  unknown key rejection, and top-level precedence over options.
- features/steps/actor_run_tool_calling_steps.py: add corresponding step
  definitions for all five scenarios.

All nox quality gates pass (lint, typecheck, unit_tests 15822/0 fail,
integration_tests 1999/0 fail, coverage_report 97%).

ISSUES CLOSED: #11243
This commit is contained in:
2026-05-18 14:28:55 +00:00
committed by Forgejo
parent d0136e941a
commit 91691750ed
3 changed files with 256 additions and 0 deletions
+33
View File
@@ -272,3 +272,36 @@ Feature: Actor run tool-calling via ToolCallingRuntime
Given a ToolCallingLLMCaller with an actor config without system_prompt
When invoke is called and the LLM returns a response with encoded tool call names
Then the LLMResponse contains the decoded tool calls
# ---------- V: ToolCallingLLMCaller options block forwarding (#11243) ----------
@tdd_issue @tdd_issue_11243
Scenario: ToolCallingLLMCaller forwards openai_api_base and openai_api_key from options block
Given a ToolCallingLLMCaller with actor config options containing openai_api_base and openai_api_key
When _resolve_llm is called on the ToolCallingLLMCaller with empty tool_schemas
Then create_llm was called with openai_api_base forwarded from options
And create_llm was called with __api_key_sentinel extracted from options openai_api_key
@tdd_issue @tdd_issue_11243
Scenario: ToolCallingLLMCaller forwards allowed options keys to create_llm
Given a ToolCallingLLMCaller with actor config options containing allowed extra keys
When _resolve_llm is called on the ToolCallingLLMCaller with empty tool_schemas
Then create_llm was called with the allowed options keys forwarded
@tdd_issue @tdd_issue_11243
Scenario: ToolCallingLLMCaller rejects reserved keys in options block with a warning
Given a ToolCallingLLMCaller with actor config options containing reserved key provider_type
When _resolve_llm is called on the ToolCallingLLMCaller with empty tool_schemas
Then create_llm was NOT called with the reserved key provider_type
@tdd_issue @tdd_issue_11243
Scenario: ToolCallingLLMCaller rejects unknown keys in options block with a warning
Given a ToolCallingLLMCaller with actor config options containing unknown key foo_bar
When _resolve_llm is called on the ToolCallingLLMCaller with empty tool_schemas
Then create_llm was NOT called with the unknown key foo_bar
@tdd_issue @tdd_issue_11243
Scenario: ToolCallingLLMCaller top-level config takes precedence over options block
Given a ToolCallingLLMCaller with actor config with top-level temperature and options temperature
When _resolve_llm is called on the ToolCallingLLMCaller with empty tool_schemas
Then create_llm was called with the top-level temperature value