Skip to content

Pin model to conversation lifetime #396

@sentry-junior

Description

@sentry-junior

Mid-conversation config deploys can change the model between turns. The model is resolved once at module load from env vars (botConfig.modelId) and every turn reads it from that singleton — but if the Vercel function instance recycles between turns in the same thread, the new instance picks up updated env vars and switches models.

  • readChatConfig() runs once at module load, stored in a module-level chatConfig const (packages/junior/src/chat/config.ts)
  • Every turn references botConfig.modelId directly with no per-session override
  • A config deploy that changes AI_MODEL will affect in-flight conversations on their next turn if the function cold-starts

The model should be captured at conversation start and reused for every subsequent turn in that conversation, so a config change only affects new conversations.

Action taken on behalf of David Cramer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels
    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