Skip to content

fix(opencode): add fallback models for session title generation#29735

Closed
BenSharir wants to merge 1 commit into
anomalyco:devfrom
BenSharir:fix/title-generation-fallback-v2
Closed

fix(opencode): add fallback models for session title generation#29735
BenSharir wants to merge 1 commit into
anomalyco:devfrom
BenSharir:fix/title-generation-fallback-v2

Conversation

@BenSharir
Copy link
Copy Markdown

@BenSharir BenSharir commented May 28, 2026

Issue for this PR

Closes #29734

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When ensureTitle fails (rate limit, model not found, proxy error), the error was silently swallowed via Effect.ignore. This made title generation failures impossible to diagnose.

Changes:

  1. Extract generateTitle helper (reused for primary + fallbacks)
  2. On primary failure, iterate through all configured providers' small models
  3. Replace Effect.ignore with Effect.catchCause + warning log

The fallback works because provider.list() returns all configured providers, and getSmallModel() returns each provider's best small model. If one provider's model is down/exhausted, another provider's model can generate the title.

How did you verify your code works?

  • bun typecheck passes (0 errors in prompt.ts)
  • Code review of Effect patterns matches existing codebase style

Screenshots / recordings

N/A - no UI changes

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

When the primary small model fails, iterate through all configured
providers' small models before giving up. Replace Effect.ignore at the
call site with a warning log so failures are visible.

Fixes anomalyco#29734
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search results, I found one potentially related PR:

PR #27939: feat(session): add configurable fallback model chain
#27939

This PR appears related because it also addresses fallback model chains for session functionality, which is similar in scope to PR #29735's focus on adding fallback models for session title generation. You may want to review this PR to ensure there's no overlap in approach or existing implementation.

The other PRs found (Kiro provider, per-model temperature) are less directly related to the fallback mechanism for session title generation.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label May 28, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@BenSharir
Copy link
Copy Markdown
Author

Note on PR #27939: That PR adds a more comprehensive configurable fallback chain for all LLM calls (including title generation). If #27939 is merged first, this PR may become redundant or could be simplified to just the logging change (replacing Effect.ignore with warning logs).

This PR is a simpler, targeted fix that:

  • Only affects title generation
  • Automatically tries all providers' small models (no config needed)
  • Adds warning logs for failures

Happy to close this if maintainers prefer to wait for #27939, or keep it as an interim fix.

@BenSharir
Copy link
Copy Markdown
Author

Correction on PR #27939 overlap: After reviewing the diff, #27939 does NOT fully address this issue:

  1. feat(session): add configurable fallback model chain #27939 requires user config - title fallbacks only work if user sets agent.title.fallbacks explicitly
  2. feat(session): add configurable fallback model chain #27939 keeps Effect.ignore - the call site still silently swallows failures
  3. No logging added - failures remain invisible

This PR (#29735) provides:

  1. Automatic fallback - tries all providers' small models without config
  2. Visibility - replaces Effect.ignore with warning logs

The two PRs are complementary rather than redundant. This one could land independently or be adapted to work with #27939's infrastructure.

@BenSharir
Copy link
Copy Markdown
Author

Closing in favor of #29737 (minimal logging-only fix). The automatic fallback logic from this PR would overlap with #27939's configurable fallback chain - better to let that PR handle fallback infrastructure while this logging fix can land independently.

@BenSharir BenSharir closed this May 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Session title generation silently fails with no fallback or logging

1 participant