feat(btw): keep the inherited thread as reference, not an active plan
`/btw` forks the session, so the model receives the parent's whole conversation — including whatever plan was in flight when the user typed the command. Nothing tells it that this history is context rather than its own task, so the fork frequently carries on with the parent's work instead of answering the side question, which is the opposite of what `/btw` is for. Send a boundary instruction as a synthetic part with every message in a btw session: with the first question in `startBtwSession`, and with each later send while the panel is expanded and the composer is talking to the fork. The wording is deliberately position-independent — it names the history inherited from the parent thread rather than "everything before this boundary". The instruction rides along with each send instead of being pinned once at fork time, so a positional phrasing would be re-anchored every turn and would end up telling the model to disregard the btw session's own earlier turns. The part is synthetic, so it is filtered out of the rendered transcript whenever the message also carries user text — which is always the case here. No visual change.
This commit is contained in:
@@ -35,7 +35,7 @@ import {
|
||||
import { ReviewFlowDialog, type ReviewFlowExecution } from '@/components/session/ReviewFlowDialog';
|
||||
import { BtwPanel } from './btw/BtwPanel';
|
||||
import { useBtwPanelState } from './btw/useBtwPanelState';
|
||||
import { destroyBtwSession, startBtwSession, type BtwSessionRef } from '@/lib/btw';
|
||||
import { BTW_BOUNDARY_INSTRUCTION, destroyBtwSession, startBtwSession, type BtwSessionRef } from '@/lib/btw';
|
||||
import { AttachedFilesList, AttachedVSCodeFileChips, ActiveEditorFileSuggestion } from './FileAttachment';
|
||||
import { lazyWithChunkRecovery } from '@/lib/chunkLoadRecovery';
|
||||
import type { ToolPopupContent } from './message/types';
|
||||
@@ -1126,7 +1126,13 @@ const ChatInputComponent: React.FC<ChatInputProps> = ({
|
||||
composerText: !queuedOnly && inputSnapshot.hasContent ? inputSnapshot.message : null,
|
||||
composerAttachments: attachedFiles,
|
||||
inlineComments: drafts,
|
||||
syntheticTexts: syntheticParts?.map((part) => part.text) ?? [],
|
||||
// btw mode: the boundary rides with every send, not just the
|
||||
// first one, so the inherited transcript stays reference material
|
||||
// for the whole side conversation.
|
||||
syntheticTexts: [
|
||||
...(isBtwActive ? [BTW_BOUNDARY_INSTRUCTION] : []),
|
||||
...(syntheticParts?.map((part) => part.text) ?? []),
|
||||
],
|
||||
linkedIssue: linkedIssue
|
||||
? { number: linkedIssue.number, title: linkedIssue.title, url: linkedIssue.url, contextText: linkedIssue.contextText }
|
||||
: null,
|
||||
|
||||
Reference in New Issue
Block a user