Skip to content

fix: title generator always uses Claude regardless of task adapter #2446

@Basit-Balogun10

Description

@Basit-Balogun10

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:

  1. Requiring both API keys when only one provider is needed
  2. Unnecessary cross-provider calls even when both keys are present

Steps to reproduce

  1. Configure the (localhost) LLM gateway with only OPENAI_API_KEY set (no Anthropic key)
  2. Start PostHog Code and create a task using a Codex model
  3. Task runs successfully through OpenAI
  4. Title generation fails with 401 authentication error
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions