Skip to content

agentctl launch opencode defaults to OpenAI-backed build model and exits when OPENAI_API_KEY is unset #159

@c-h-

Description

@c-h-

Summary

In the Kindo mono workflow, agentctl launch opencode can exit immediately even though the workspace default opencode model is Kimi via Ohm. The launch log shows it selecting build · gpt-5.4 and failing with OpenAI API key is missing, so no agent work actually starts.

Repro

Environment:

  • workspace: /Users/ms/code/mono-conversation-compaction
  • opencode config default model: ohm/moonshotai/Kimi-K2.5 (~/.config/opencode/opencode.json)
  • no OPENAI_API_KEY in the launch environment

Command:

agentctl launch opencode \
  --cwd /Users/ms/code/mono-conversation-compaction \
  --callback-session agent:kindo:main \
  --callback-agent kindo \
  -p "any prompt"

Observed launch log (~/.agentctl/opencode-sessions/launch-*.log):

> build · gpt-5.4
Error: OpenAI API key is missing. Pass it using the 'apiKey' parameter or the OPENAI_API_KEY environment variable.\n```\n\nThe generated session exits immediately (exit file written, no code changes land).\n\n## Expected\n`agentctl launch opencode` should either:\n1. respect the workspace/default opencode model for the actual run, or\n2. fail clearly before launch with a message explaining that the selected build model requires an unavailable provider key.\n\nIt should not silently route onto an OpenAI-backed build path in a mono workspace that is supposed to use Kimi/Ohm by default.\n\n## Workaround\nExplicitly passing the model works:\n```bash\nagentctl launch opencode --model ohm/moonshotai/Kimi-K2.5 ...\n```\n\nOnce I did that, the session launched successfully (`> build · moonshotai/Kimi-K2.5`).\n\n## Notes\nThis was especially confusing because `agentctl launch` itself reported a launched session id, so the failure only became obvious after checking the opencode session logs and seeing that the PR branch had not changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions