Problem
The title generator always calls the Anthropic /v1/messages endpoint to generate task titles and summaries, regardless of which adapter ran the task. If the Anthropic API key is unavailable or the task ran through Codex/OpenAI, title generation fails with:
LLM gateway request failed {
status: 401,
errorType: 'internal_error',
errorMessage: '{"type":"error","error":{"type":"authentication_error","message":"x-api-key header is required"}}'
}
Impact: When running PostHog Code locally with only an OpenAI API key (no Anthropic key), tasks run successfully through Codex but never get auto-generated titles.
Expected behavior
The title generator should use the same provider/adapter that ran the task:
- If task used Codex → call
/v1/responses with a small GPT model (e.g., gpt-5.4)
- If task used Claude → call
/v1/messages with a small Claude model
This avoids:
- Requiring both API keys when only one provider is needed
- Unnecessary cross-provider calls even when both keys are present
Steps to reproduce
- Configure the (localhost) LLM gateway with only
OPENAI_API_KEY set (no Anthropic key)
- Start PostHog Code and create a task using a Codex model
- Task runs successfully through OpenAI
- Title generation fails with 401 authentication error
- Task appears with user's input as title instead of generated summary
Suggested fix
In the title generator service, check which adapter the task session is using and route to the matching provider endpoint. Alternatively, add fallback logic: if the primary provider fails with auth error, try the task's adapter provider.
Problem
The title generator always calls the Anthropic
/v1/messagesendpoint to generate task titles and summaries, regardless of which adapter ran the task. If the Anthropic API key is unavailable or the task ran through Codex/OpenAI, title generation fails with:Impact: When running PostHog Code locally with only an OpenAI API key (no Anthropic key), tasks run successfully through Codex but never get auto-generated titles.
Expected behavior
The title generator should use the same provider/adapter that ran the task:
/v1/responseswith a small GPT model (e.g.,gpt-5.4)/v1/messageswith a small Claude modelThis avoids:
Steps to reproduce
OPENAI_API_KEYset (no Anthropic key)Suggested fix
In the title generator service, check which adapter the task session is using and route to the matching provider endpoint. Alternatively, add fallback logic: if the primary provider fails with auth error, try the task's adapter provider.