Skip to content

fix(opencode): stop silent session title generation failures - #36356

Closed
1837620622 wants to merge 0 commit into
anomalyco:devfrom
1837620622:fix/session-auto-title-failure-handling
Closed

fix(opencode): stop silent session title generation failures#36356
1837620622 wants to merge 0 commit into
anomalyco:devfrom
1837620622:fix/session-auto-title-failure-handling

Conversation

@1837620622

@18376206221837620622 commented Jul 11, 2026

Copy link
Copy Markdown

Issue for this PR

Closes#13710

Related (not closed by this PR):

Type of change

  • Bug fix

What does this PR do?

Session auto-naming (SessionPrompt.ensureTitle) can fail without useful logs, leaving sessions stuck as New session - <timestamp>.

Root causes on current dev:

PathWhat happensWhy silent
Model resolutiongetModel → typed ModelNotFoundError (Effect<Model, ModelNotFoundError>)Call site used Effect.ignore → Fail discarded, zero log
Title LLM streamllm.stream is Stream<LLMEvent, unknown> + Effect.orDieFail promoted to Die; Effect.ignore does not recover Die → fiber dies, no title
Residual defectse.g. toModelMessagesEffect uses Effect.promise (rejections → Die)No local handler; previously no fork-site log for Die

Minimal fix (no retry policy change; keep small: true):

BeforeAfter
unguarded getModel / getSmallModelEffect.option + tapError warning (typed Fail only; defects still propagate)
Effect.orDie on streamEffect.catchAll → log + empty text (notcatchCause — avoids labeling Interrupt as LLM failure)
Effect.ignore on forkEffect.catchCause → log residual Fail/Die; skip interrupt-only scope teardown
small: truekept (preserves smallOptions, avoids #20269 / #20323)

Why this shape (Effect semantics)

  • Effect.option is correct for getModel: only maps typed failureOption.none, does not hide defects
  • Stream errors are typed (unknown Fail channel) → catchAll is the right dual of removing orDie
  • Fork catchCause is the safety net for toModelMessagesEffect defects and any remaining Die
  • Interrupt-only causes are ignored at the fork so scope close does not spam warnings

Out of scope (on purpose)

How did you verify your code works?

  • Diff-reviewed against upstream ensureTitle on dev
  • Failure chain confirmed: typed Fail + orDie Die + Effect.ignore ⇒ silent skip / no title
  • Single-file change only (packages/opencode/src/session/prompt.ts)

Author

  • GitHub: @1837620622 (传康Kk)
  • Commit email: 35034498+1837620622@users.noreply.github.com (GitHub-verified noreply — required for Contributors graph)

Checklist

  • Linked issue (Closes #13710)
  • No unrelated changes
  • No speculative retry / model-policy change

@1837620622

Copy link
Copy Markdown
Author

Ready for review 🔍

Minimal, confirmed fix for intermittent silent auto-title failures reported in #13710.

Why safe:

  • Only hardens error handling in ensureTitle — no model/cost policy change
  • Keeps small: true (does not reintroduce variant/effort leakage)
  • ~30 lines, no speculative retry loop
  • Failures become logged instead of disappearing

Would appreciate a maintainer review when you have a moment. Happy to address nits quickly.

— 传康Kk (@1837620622)

@1837620622

Copy link
Copy Markdown
Author

Friendly ping for maintainers 🙏

This is a minimal confirmed fix for #13710 (silent auto-title failures):

  • Effect.option for model resolution
  • Effect.catchAll instead of orDie on the title stream
  • Effect.catchCause instead of ignore at the fork
  • small: true kept (no cost/policy regression)

Single file, ~30 lines. Would love a review when you have a moment.

@1837620622

Sign up for freeto 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.

OpenCode Desktop Session Name is no longer written with AI at times

2 participants

@1837620622@adamdotdevin