fix(session): type turn/end error as one structured failure
TurnEndReasonMap.error now carries a single `error: LlmFailure` field: an LlmError keeps its structured facts, any other error flattens to errorChain text under the UNKNOWN code. Consumers read message/code directly instead of defending against an unknown union — this also fixes errorChain() rendering structured failures as '[object Object]' in the TUI and ACP error paths. Document the turn-stopping contract: a concludesTurn result never short-circuits already-submitted next-step work (same-step additionalContexts or racing steering still runs), data decides.
This commit is contained in:
@@ -829,8 +829,6 @@ export class Session implements SessionFace {
|
||||
&& !this.derivedNodes.some(node => node.kind === 'model-retry' && node.turn === event.data.turn)
|
||||
) {
|
||||
const failure = event.data.reason.error
|
||||
const code = failure !== null && typeof failure === 'object' && 'code' in failure
|
||||
&& typeof failure.code === 'string' ? failure.code : undefined
|
||||
this.derivedNodes.push({
|
||||
kind: 'turn-error',
|
||||
seq: event.seq,
|
||||
@@ -838,7 +836,7 @@ export class Session implements SessionFace {
|
||||
turn: event.data.turn,
|
||||
step: event.data.step,
|
||||
message: displayFailureMessage(failure),
|
||||
...(code === undefined ? {} : { code }),
|
||||
code: failure.code,
|
||||
})
|
||||
this.derivedRev++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user