fix: address all Cubic P2 review issues
- session-utils: log SDK errors instead of silent swallow - opencode-message-dir: fix indentation, improve error log format - storage: use session.list for sessionExists (handles empty sessions) - storage.test: use resetStorageClient for proper SDK client cleanup - todo-sync: add content-based fallback for id-less todo removal
This commit is contained in:
@@ -141,9 +141,9 @@ export function getMessageDir(sessionID: string): string | null {
|
||||
export async function sessionExists(sessionID: string): Promise<boolean> {
|
||||
if (isSqliteBackend() && sdkClient) {
|
||||
try {
|
||||
const response = await sdkClient.session.messages({ path: { id: sessionID } })
|
||||
const messages = response.data as unknown[] | undefined
|
||||
return Array.isArray(messages) && messages.length > 0
|
||||
const response = await sdkClient.session.list()
|
||||
const sessions = (response.data || []) as Array<{ id?: string }>
|
||||
return sessions.some((s) => s.id === sessionID)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user