Skip to content

Auto session title generation fails for opencode provider models (smallOptions missing provider config) #30662

Closed as not planned

Description

@beenotung

Description

When using an opencode provider model (e.g., big-pickle), the auto session title generation silently fails — the title stays as the default "New session - ...". With other providers like minimax, the title is auto-generated correctly.

Root Cause

The title agent calls llm.stream() with small: true (src/session/prompt.ts:277), which triggers smallOptions() in src/provider/transform.ts:1149. The smallOptions() function has no special handling for the opencode provider — it only handles openai, openrouter/llmgateway, and venice. For opencode models, it returns an empty {}.

Meanwhile, the normal options() function (line 1126-1130) does set opencode-specific parameters:

if (input.model.providerID.startsWith("opencode")) {
  result["promptCacheKey"] = input.sessionID
  result["include"] = INCLUDE_ENCRYPTED_REASONING
  result["reasoningSummary"] = "auto"
}

Without these, the API request likely fails or returns unexpected output. The error is silently swallowed by Effect.ignore at line 1300 in prompt.ts.

Expected Behavior

smallOptions() should include the same promptCacheKey, include, and reasoningSummary for opencode provider models that options() provides, so the title agent works correctly with opencode provider models.

Affected Code

  • src/provider/transform.ts — smallOptions() function (line 1149), missing opencode provider case
  • src/session/prompt.ts — ensureTitle() calls llm.stream({ small: true, ... }) (line 277)

Activity

  1. github-actions commented on Jun 4, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    These all share the core symptom (title stays as "New session - ...") but with different root causes. If the fix in #30662 is distinct (adding opencode provider config to smallOptions()), it may still be worth tracking separately. Please review and confirm whether this overlaps with any of the above.

  2. beenotung commented on Jun 4, 2026

    @beenotung
    Author

    This is distinct from the three issues mentioned:

    This issue (#30662) is specifically about smallOptions() in transform.ts lacking opencode provider handling. The options() function sets promptCacheKey, include (INCLUDE_ENCRYPTED_REASONING), and reasoningSummary for opencode models, but smallOptions() returns an empty {}. This is a separate, concrete code gap that affects all opencode provider models regardless of variants or model resolution.

    All four are valid bugs that compound — fixing all four would give robust title generation.

  3. kagura-chen commented on Jun 4, 2026

    @kagura-chen
    Contributor

    I'd like to work on this. The root cause analysis in the description is clear — smallOptions() needs the same opencode provider handling that options() already has. I'll add the missing provider config and submit a PR.

  4. itallovidal commented on Jun 10, 2026

    @itallovidal

    yes! im having this issue right now

  5. itallovidal commented on Jun 10, 2026

    @itallovidal

    any updates @kagura-agent ?

  6. kagura-chen commented on Jun 10, 2026

    @kagura-chen
    Contributor

    Hey @itallovidal! Thanks for the nudge. I haven't gotten to the PR yet — will work on it soon. The fix should be straightforward (adding provider config to smallOptions()).

  7. kagura-chen commented on Jun 10, 2026

    @kagura-chen
    Contributor

    Hi @itallovidal — sorry for the delay! I haven't submitted a PR yet. I'll get to it and update here once the PR is up. Thanks for the nudge.

  8. beenotung commented on Jun 11, 2026

    @beenotung
    Author

    PR #31092 (fix(provider): respect configured small_model and add opencode handling to smallOptions) will also fix this issue once merged. It addresses the same root cause - smallOptions() missing opencode provider handling.

  9. kagura-chen commented on Jun 11, 2026

    @kagura-chen
    Contributor

    Thanks @beenotung! Glad to see PR #31092 covering this. I was too slow getting to it — appreciate you stepping in. 🙏

  10. Jackdrakes commented on Jul 5, 2026

    @Jackdrakes

    Still failing on opencode Zen API routing — still facing this issue on v1.17.13 with the opencode provider (big-pickle). smallOptions() in src/provider/transform.ts still lacks the opencode case. @itallovidal can i work on this fix ?

  11. kagura-chen commented on Jul 5, 2026

    @kagura-chen
    Contributor

    Hey @Jackdrakes — heads up, there's already an open PR for this: #31092 (by @beenotung) which adds the opencode case to smallOptions(). It just hasn't been merged yet. You might want to check if that PR is still active before starting fresh work, or coordinate with the author. 👍

  12. Jackdrakes commented on Jul 5, 2026

    @Jackdrakes

    Thanks for the heads-up! I hadn't noticed the existing PR. I'll keep an eye on #31092 and won't duplicate the work while it's under review. If it ends up going stale or needs additional help, I'd be happy to contribute then. Thanks!

  13. joaomj commented on Jul 14, 2026

    @joaomj

    Additional reproduction metadata:

    • Affected session: ses_09fa61b72ffezk4fTmfhQkRqAw
    • Named comparison session: ses_09fa380d2ffeeSQlMzKoext2pI
    • OS: macOS
    • OpenCode versions tested: 1.17.18 and 1.17.20
    • Provider: OpenCode Zen
    • Configured small model: opencode/deepseek-v4-flash-free
    • Affected agent: title
    • Log fields observed: providerID=opencode modelID=deepseek-v4-flash-free small=true agent=title
    • Result: title generation starts but produces no response or logged error; the session remains New session - <timestamp>

    The configured model works for regular requests. The failure appears specific to the title-agent small-model request path. Errors are not visible because the title-generation failure is swallowed by Effect.ignore.

  14. beenotung commented on Aug 22, 2026

    @beenotung
    Author

    Confirmed still reproducible on v1.18.19 (current release), but I found a working local workaround — no code change needed.

    Workaround (tested working)

    Pin small_model to a model that works. This is my config — I tested it in a fresh session and the title agent auto-generates titles correctly.

    Add small_model to your global opencode config at ~/.config/opencode/opencode.json (i.e. the opencode.json under the .config/opencode/ folder in your home directory):

    "small_model": "ollama-cloud/deepseek-v4-flash:0731"

    Provider.getSmallModel checks cfg.small_model first (provider.ts:1917) and returns that model regardless of the session's provider, so even with the opencode provider (e.g. big-pickle, which otherwise resolves to gpt-5.4-nano and fails) the title agent now works.

    Note: after editing, open a new session to test — existing sessions keep their already-failed New session - <timestamp> title.

    For others who don't use ollama-cloud

    If you don't use ollama-cloud, opencode/big-pickle is a free model on the opencode provider you can use instead:

    "small_model": "opencode/big-pickle"

    Caveat: big-pickle sits on the same opencode provider that smallOptions() in src/provider/transform.ts still lacks a case for, so it may not be bulletproof for everyone. If you hit the free-tier quota or it still fails, just point small_model at any other model/provider you prefer.

    Alternative: a local lm-studio model

    If you run lm-studio locally, you can point small_model at a small local model (e.g. lm-studio/nvidia-nemotron-3-nano-4b). It's free, private, and not subject to cloud quotas:

    "small_model": "lm-studio/nvidia-nemotron-3-nano-4b"

    A small/fast local model is ideal for title generation, which only needs a short summary of the first message. Just make sure the local model is loaded in lm-studio when you start an opencode session.

    Status of the actual fix

    Still not fixed in source — smallOptions() has no opencode branch (only openai, openrouter/llmgateway, venice), while the normal options() does set promptCacheKey/include/reasoningSummary for providerID.startsWith("opencode"). Both prior fix PRs (#31760, #31092) closed without merging. Would be great to re-land one of them.

  15. kagura-chen commented on Aug 23, 2026

    @kagura-chen
    Contributor

    Thanks @beenotung for the detailed writeup and for keeping at this — I took this on back in June and never landed it, so appreciate you driving #31092. Sorry to see both fix PRs (#31092, #31760) closed without merging; the smallOptions() gap is clearly still real on v1.18.19.

    If you re-land the fix, I'm happy to test the opencode provider path and confirm the title agent works. The small_model pin is a solid stopgap in the meantime — thanks for documenting it with exact config.

  16. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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