fix: title generation silent failure + titlebar session dropdown empty (#138) - #155
Merged
Merged
Conversation
…ed retries (#138) Title generation fired at most once (gated on `step === 1`), but multiple code paths (silent-turn guard, prose-question guard) pre-increment `step` with `step++; continue` before the title trigger is reached. By the time the loop hits the trigger, step is already past 1 — permanently dead. Additionally, `title()` itself bailed if `userMessages.length !== 1`, so even a late retry after a second user message would never succeed. Fix: 1. Replace `step === 1` with a dedicated `titleAttempts` counter (max 3). Checked every loop pass via `Session.isDefaultTitle(session.title)` — stops retrying after success (no wasted API calls). 2. Relax the single-message guard from `!== 1` to `< 1` — allows retries to succeed even after a second user message arrives. Invariants preserved: - Effect.ignore stays (non-critical, silent on failure) - Model selection unchanged (getSmallModel → fallback) - Title generation remains forked (never blocks the main response) - The <think> tag stripping and 100-char truncation are untouched Fixes #138
Effect.orDie in the title function promoted provider errors (rate limit, auth, network) into defects. The fork site used Effect.ignore, which only catches expected errors — defects bypass it, killing the background fiber with no log and no title set. Fix: 1. Remove Effect.orDie from the title LLM stream — errors stay in the E channel where Effect.ignore handles them gracefully. On failure the function exits early (no title), retries on the next loop pass (up to 3). 2. Fix setArchived typecheck: get(sessionID) returns Effect<Info, NotFound> but the interface declares Effect<void> — add .pipe(Effect.orDie) since archiving a non-existent session is a programmer error. 3. Add integration test confirming title generation fires on a new session. Fixes #138
…#138) The titlebar SessionChatsDropdown queried sessions from serverSync().data.path.directory (the server's cwd), which is the opencode-project workspace dir — not where sessions live. The store for that directory was never populated, so the dropdown was always empty. Fix: source sessions from all registered project directories via globalCtx.ensureServerCtx (the same data path the dashboard uses). Archive/unarchive handlers now reload the specific session's directory instead of the stale cwd reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three fixes for session title generation and the titlebar chats dropdown.
1. Title generation dies silently when LLM call fails
Effect.orDiein the title function promoted provider errors into defects. The fork site usedEffect.ignore, which only catches expected errors — defects bypass it, killing the fiber silently.Additionally,
getSmallModelresolved a cross-region Haiku model from Bedrock's catalog that wasn't actually accessible, causing the LLM call to hang indefinitely.Fix:
Effect.orDie— errors stay in the E channelEffect.ignorewithEffect.ignoreCause({log: "Warn"})— catches defects, logs on failuregetSmallModelfor title generation — use the session's proven model directly2.
setArchivedtypecheck errorget(sessionID)returnsEffect<Info, NotFound>but the interface declaresEffect<void>. Added.pipe(Effect.orDie).3. Titlebar session chats dropdown empty
SessionChatsDropdownqueried sessions fromserverSync().data.path.directory(the server's cwd / opencode-project workspace dir) — not where sessions live. The store for that directory was never populated.Fix: Source sessions from all registered project directories via
globalCtx.ensureServerCtx(same data path the dashboard uses).Test
Added integration test confirming title generation fires on a new session with the default title.
Fixes #138