fix(components): disable Side Chat until there is an assistant turn to fork - #14
Draft
pythonlearner1025 wants to merge 1 commit into
Draft
fix(components): disable Side Chat until there is an assistant turn to fork#14pythonlearner1025 wants to merge 1 commit into
pythonlearner1025 wants to merge 1 commit into
Conversation
…o fork In a session the agent has not answered yet, the Side Chat entry accepts a click and nothing visible happens. The launcher forks the active conversation, a fork needs a completed assistant turn, and with none `forkActiveConversation` returns after a `toast.error` — so the entry reads as broken rather than as refused. Say it before the click, the way the same launcher already says it for an offline machine: `disabled`. Hiding the entry is worse — a session that has not answered yet would look like one where Side Chat does not exist, and the option comes back a second later. The fork target has to be a value a render can read. `chatRefsMap` is a ref, so `getLastAssistantTurnId()` answers when somebody asks, which is right for a click and useless for a rendered state. `setChatTabRef` mirrors it into state on ATTACH; `useImperativeHandle` already carries `lastCompletedAssistantMessageId` in its dependency list, so React re-attaches the ref on the commit that first has a turn. The detach is ignored deliberately. Every render hands each chat surface a fresh ref arrow, so React calls it with null and then with the handle inside one commit; taking the null would queue a state change on every commit and the page would re-render for ever. Cost, against what it fixes: a session that HAS answered shows the launcher disabled for the moment its history takes to paint. That is a control nobody is looking at during a page load, and it replaces a control a member clicks that answers with an error. Fork semantics are untouched — what changes is whether the entry offers the click. Model: claude-opus-5[1m]
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.
In a session the agent has not answered yet, the Side Chat entry accepts a click
and nothing visible happens. The launcher forks the active conversation, a fork
needs a completed assistant turn, and with none
forkActiveConversationreturnsafter a
toast.error— so the entry reads as broken rather than as refused.Say it before the click, the way the same launcher already says it for an
offline machine:
disabled. Hiding the entry is worse — a session that has notanswered yet would look like one where Side Chat does not exist, and the option
comes back a second later.
The fork target has to be a value a render can read.
chatRefsMapis a ref, sogetLastAssistantTurnId()answers when somebody asks, which is right for aclick and useless for a rendered state.
setChatTabRefmirrors it into state onATTACH;
useImperativeHandlealready carrieslastCompletedAssistantMessageIdin its dependency list, so React re-attachesthe ref on the commit that first has a turn.
The detach is ignored deliberately. Every render hands each chat surface a fresh
ref arrow, so React calls it with null and then with the handle inside one
commit; taking the null would queue a state change on every commit and the page
would re-render for ever.
Cost, against what it fixes: a session that HAS answered shows the launcher
disabled for the moment its history takes to paint. That is a control nobody is
looking at during a page load, and it replaces a control a member clicks that
answers with an error. Fork semantics are untouched — what changes is whether
the entry offers the click.
Compatibility
Every change is additive at its default. With the new prop, parameter or flag
absent, the touched components render and behave exactly as they do today, and
no existing call site in this repository passes one.
Testing
packages/componentstypecheck and the full vitest suite pass. No new test:SessionDetailneeds a workspace runtime.Notes for the reviewer
Submitted UNCONDITIONAL. The vendored version of this change is behind an opt-in prop, only because that tree's rule is that no in-vendor edit may change default behaviour. "Disable Side Chat when there is nothing to fork" is not a host opinion, so it is offered here without the prop. If you would rather have it opt-in, the prop version is a two-line change on top.
Review metadata
BlitzOS fork only. Delete this section before sending the PR to
LodyAI/Lody.blitz/seam-6-side-chat-requires-assistant-turnf3474894 (the pinned upstream commit)