Opus 4.7 returns HTTP 400 for the legacy ``thinking.type=enabled`` +
``budget_tokens`` request shape ("Use thinking.type.adaptive and
output_config.effort to control thinking behavior"), breaking every
LLM_CHAT_COMPLETE task that set ``thinkingTokenLimit`` against the model.
Translate the budget into ``thinking.type=adaptive`` + ``output_config.effort``
whenever the model id targets Opus 4.7; legacy ``enabled`` + ``budget_tokens``
is preserved on Sonnet/Opus 4.6 and earlier. Also forwards ``reasoningEffort``
from ChatCompletion through to ``output_config.effort`` on all Anthropic
models so callers can tune token spend independent of thinking.
Why: production failure when a customer workflow with Opus 4.7 +
thinkingTokenLimit hit the LLM_CHAT_COMPLETE worker. The error message itself
told us the new request shape; this lands the rewrite plus a regression
matrix that exercises both shapes against the live API and through the full
Conductor task pipeline.
Coverage:
- Adapter: in-module live tests against Anthropic (Opus 4.7 + thinking, Opus
4.7 + effort-only, Sonnet 4.6 legacy thinking shape).
- LLMHelper / LLMWorkers: 27 new unit tests covering reasoning + responseId
extraction, tool-call assembly, finishReason mapping, JSON-output parsing,
the GENERATE_VIDEO state machine, and the textCompletion field mapping
(lifts ``ai`` package 16->45 % line, ``tasks.worker`` 15->40 %).
- e2e: 14-test live matrix against the in-tree server covering single chat,
multi-turn history, function tools, JSON output, reasoning models,
previousResponseId chaining (including inside DO_WHILE), the Opus 4.7 +
thinking LLM-in-loop regression, and an agentic Opus 4.7 + thinking
DO_WHILE that threads working state via a SET_VARIABLE sibling.
Docker compose forwards ANTHROPIC_API_KEY / OPENAI_API_KEY into the
conductor-server container so the e2e tests run consistently when keys are
set on the host.