Skip to content

fix: title generation silent failure + titlebar session dropdown empty (#138) - #155

Merged
jeonghun-jj-lee merged 3 commits into
local/amicodefrom
fix/138-session-title-generation
Aug 9, 2026
Merged

fix: title generation silent failure + titlebar session dropdown empty (#138)#155
jeonghun-jj-lee merged 3 commits into
local/amicodefrom
fix/138-session-title-generation

Conversation

@jeonghun-jj-lee

Copy link
Copy Markdown
Contributor

Summary

Three fixes for session title generation and the titlebar chats dropdown.

1. Title generation dies silently when LLM call fails

Effect.orDie in the title function promoted provider errors into defects. The fork site used Effect.ignore, which only catches expected errors — defects bypass it, killing the fiber silently.

Additionally, getSmallModel resolved a cross-region Haiku model from Bedrock's catalog that wasn't actually accessible, causing the LLM call to hang indefinitely.

Fix:

  • Remove Effect.orDie — errors stay in the E channel
  • Replace Effect.ignore with Effect.ignoreCause({log: "Warn"}) — catches defects, logs on failure
  • Skip getSmallModel for title generation — use the session's proven model directly

2. setArchived typecheck error

get(sessionID) returns Effect<Info, NotFound> but the interface declares Effect<void>. Added .pipe(Effect.orDie).

3. Titlebar session chats dropdown empty

SessionChatsDropdown queried sessions from serverSync().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

…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.
@jeonghun-jj-lee
jeonghun-jj-lee merged commit 6c87af0 into local/amicode Aug 9, 2026
3 of 12 checks passed
@jeonghun-jj-lee
jeonghun-jj-lee deleted the fix/138-session-title-generation branch August 9, 2026 02:43
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.

BUG: All new sessions get default title "New session - []" — chat history is indiscernible

1 participant