fix(investigation): reserve 1 token for message separator in max_tokens

The SDK needs 1 token for the space/message separator between thinking
and response. Set SPECIALIST_MAX_TOKENS values 1 token lower than
API limits to avoid rejection errors:

- root_cause: 127999 (API max: 128000)
- impact/fix_advisor/reproducer: 63999 (API max: 64000)

This fixes API errors like:
max_tokens: 128001 > 128000, which is the maximum allowed

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
This commit is contained in:
Sondre Engebråten
2026-02-16 18:42:52 +01:00
co-authored by Claude Sonnet 4.5
parent 39e108b7ac
commit d4f432224a
@@ -97,11 +97,12 @@ logger = logging.getLogger(__name__)
# Per-specialist max_tokens configuration (Opus 4.6 supports up to 128K)
# Root cause gets highest limit for deep analysis
# Note: Values are 1 token lower than API max to reserve space for message separator
SPECIALIST_MAX_TOKENS = {
"root_cause": 128000, # Maximum for complex multi-file tracing
"impact": 64000, # Standard for component mapping
"fix_advisor": 64000, # Standard for fix approaches
"reproducer": 64000, # Standard for test coverage analysis
"root_cause": 127999, # Maximum for complex multi-file tracing (API max: 128000)
"impact": 63999, # Standard for component mapping (API max: 64000)
"fix_advisor": 63999, # Standard for fix approaches (API max: 64000)
"reproducer": 63999, # Standard for test coverage analysis (API max: 64000)
}
# =============================================================================