fix(cli): prevent data-loss in TUI transcript copy/export on SDK error

Both the copy and export handlers now pass `{ throwOnError: true }` to
`sdk.client.session.messages()` and drop the `?? []` fallback, so a failed
fetch (404/400/network) throws into the existing catch block and surfaces an
error toast instead of silently writing/returning an empty transcript.
This commit is contained in:
Aarav Sharma
2026-05-22 16:43:58 -06:00
parent 8ba138def7
commit 27a4137496
@@ -980,8 +980,8 @@ export function Session() {
const sessionData = session()
if (!sessionData) return
// kilocode_change start - fetch all messages from server instead of truncated sync store
const allMessages = await sdk.client.session.messages({ sessionID: sessionData.id })
const sessionMessages = (allMessages.data ?? []).map((msg) => ({
const allMessages = await sdk.client.session.messages({ sessionID: sessionData.id }, { throwOnError: true })
const sessionMessages = allMessages.data.map((msg) => ({
info: msg.info,
parts: msg.parts,
}))
@@ -1031,8 +1031,8 @@ export function Session() {
if (options === null) return
// kilocode_change start - fetch all messages from server instead of truncated sync store
const allMessages = await sdk.client.session.messages({ sessionID: sessionData.id })
const sessionMessages = (allMessages.data ?? []).map((msg) => ({
const allMessages = await sdk.client.session.messages({ sessionID: sessionData.id }, { throwOnError: true })
const sessionMessages = allMessages.data.map((msg) => ({
info: msg.info,
parts: msg.parts,
}))