Repository navigation
fix(decopilot): stop dropping the auto-title on fast runs - #4446
Merged
Merged
Conversation
The durable projector closed its chunk stream the moment it saw the assistant `finish` chunk. Background title generation emits its transient `data-title-result` chunk *after* `finish` on fast runs (the title LLM resolves later than a short response), so the projector closed and dropped it before `interceptTitleChunkStream` could persist it — the thread stayed on "New chat". Slower runs happened to resolve the title before `finish`, which is why the bug looked intermittent. Terminate only on the fenced `done` marker instead. The producer assigns the title chunk a seq and the done's `finalSeq` already covers it, so reading through to `done` picks the title up; the existing idle-timeout remains the backstop for a producer that dies before publishing its done. This also restores live title updates for teammates' threads in the sidebar "All" view: persisting the title fires `onTitleUpdated`, which emits the org-wide `decopilot.thread.status` SSE the sidebar already consumes.
pedrofrxncx
enabled auto-merge (squash)
July 11, 2026 00:39
decocms Bot
pushed a commit
that referenced
this pull request
Jul 11, 2026
PR: #4446 fix(decopilot): stop dropping the auto-title on fast runs Bump type: patch - decocms (apps/mesh/package.json): 4.5.0 -> 4.5.1 Deploy-Scope: server
tlgimenes
pushed a commit
that referenced
this pull request
Jul 16, 2026
…TS.md (#4475) Mined ~300 merged PRs for the delta between the first PR proposal and the work added before merge. The dominant shape: a first draft ships the happy path, then a hardening pass (often a different engineer who takes over the branch and merges — the vibecoder→engineer handoff) adds the same categories every time. Encoded those 9 categories as an actionable first-pass checklist, each citing a real PR (#4008, #4230, #4365, #4409, #4426, #4445, #4357, #4355, #4449, #4350, #4373, #4416, #4446, #4461, #4134, #4469). Covers: variant/edge-case handling, tenant/permission scoping, concurrency & silent-data-loss, test-per-fix + invert-bug-tests + real-PG, dead-code/knip, lifecycle symmetry + state reset, kill-switch/GC/git-exclude for risky infra, input validation vs over-engineering, compile-time type-safety. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
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
Chat threads were stuck on "New chat" on fast turns (e.g. sending "hi"), even with the OpenRouter provider. Root cause: the durable projector closed its chunk stream the instant it saw the assistant
finishchunk.Background title generation (
genTitle) runs the title LLM in parallel and emits its transientdata-title-resultchunk after the mainfinishchunk whenever the assistant response finishes first — which is exactly what happens on short turns. The projector's early close (if (ev.chunk.type === "finish") { … controller.close() }, added in #4179) dropped that trailing chunk beforeinterceptTitleChunkStreamcould persist it. Slower/longer turns resolved the title beforefinish, so the bug looked intermittent (older threads got titles, recent short ones didn't).Fix
Terminate the projector stream only on the fenced
donemarker, never onfinish. The producer (ingestRun) assigns every chunk a seq — including the post-finishtitle chunk — and publishesdonewithfinalSeqcovering it, so reading through todonepicks the title up cleanly. The existingStreamIdleTimeoutErrorremains the backstop for a producer that dies before publishing its done.One line changed in
nats-chunk-source.ts(removed thefinish-triggered close); thefinish-close was the sole cause.Sidebar "All" view (second ask)
This same fix restores live title updates for teammates' threads in the sidebar's "All" view. Persisting the title fires
onTitleUpdated(app.ts), which emits the org-widedecopilot.thread.statusSSE event carrying the title — already consumed bythread-manager-storeand applied to any thread in the list. The path was fully wired; it was starved only because the title chunk never reached the projector. No sidebar code change needed.Testing
projector-chunk-stream.test.ts: the projector now reads pastfinishto the fenceddone, and a trailingdata-title-resultchunk survives. Adjusted two idle-window tests that relied on the oldfinish-close terminal.start → text → finish → data-title-result → done) piped through the real projector stream into the realinterceptTitleChunkStream:persistTitlenow fires with the generated title. Pre-fix, the chunk was dropped and no title was persisted.🤖 Generated with Claude Code
Summary by cubic
Stops dropping auto-generated chat titles on fast runs by keeping the projector stream open until the fenced
doneinstead of closing onfinish. Restores live title updates in the sidebar "All" view.done, preserving post-finishdata-title-resultchunks.finalSeq; idle-timeout remains the safety net for stuck producers.nats-chunk-sourceand projector streams to read pastfinish, include fenceddone, and ignore legacy unfenced done.Written for commit 455ff21. Summary will update on new commits.