fix(native-chat): keep known sessions loading until flush (#11032)
This commit is contained in:
parent
dbbeae3512
commit
e4b113b11d
|
|
@ -36,7 +36,7 @@ export type NativeChatLiveMergeInput = {
|
|||
* provider lifecycle records reconcile a dropped final hook.
|
||||
*
|
||||
* Precedence:
|
||||
* - errors win outright; live work wins over transcript loading.
|
||||
* - errors win outright; known sessions stay loading until transcript content resolves.
|
||||
* - hook 'working' stays authoritative until the hook exits that state OR an
|
||||
* explicit terminal marker for this turn lands.
|
||||
* - design is hook-first: lifecycle is a terminal suppressor for dropped
|
||||
|
|
@ -65,7 +65,7 @@ export function mergeNativeChatLiveSession(input: NativeChatLiveMergeInput): Nat
|
|||
transcriptLifecycle,
|
||||
hookHasWorkingSubagents ?? false
|
||||
)
|
||||
if (loading && status !== 'working') {
|
||||
if (loading && (sessionId !== null || status !== 'working')) {
|
||||
return assembleNativeChatSession({ sources, sessionId, agent, status: 'loading' })
|
||||
}
|
||||
return assembleNativeChatSession({
|
||||
|
|
|
|||
|
|
@ -256,6 +256,15 @@ describe('mergeNativeChatLiveSession', () => {
|
|||
loading: true
|
||||
}).status
|
||||
).toBe('working')
|
||||
expect(
|
||||
mergeNativeChatLiveSession({
|
||||
sources: { transcript: [] },
|
||||
sessionId: 'sess',
|
||||
agent: 'claude',
|
||||
hookState: 'working',
|
||||
loading: true
|
||||
}).status
|
||||
).toBe('loading')
|
||||
|
||||
const errored = mergeNativeChatLiveSession({
|
||||
sources: { transcript: [] },
|
||||
|
|
|
|||
Loading…
Reference in New Issue