fix: address 8-domain Oracle review findings (C1, C2, M1-M4)
- C1: thinking-prepend unique part IDs per message (global PK collision) - C2: recover-thinking-disabled-violation try/catch guard on SDK call - M1: remove non-schema truncated/originalSize fields from SDK interfaces - M2: messageHasContentFromSDK treats thinking-only messages as non-empty - M3: syncAllTasksToTodos persists finalTodos + no-id rename dedup guard - M4: AbortSignal.timeout(30s) on HTTP fetch calls in opencode-http-api All 2739 tests pass, typecheck clean.
This commit is contained in:
@@ -19,8 +19,6 @@ interface SDKToolPart {
|
||||
error?: string
|
||||
time?: { start?: number; end?: number; compacted?: number }
|
||||
}
|
||||
truncated?: boolean
|
||||
originalSize?: number
|
||||
}
|
||||
|
||||
interface SDKMessage {
|
||||
@@ -42,7 +40,7 @@ export async function findToolResultsBySizeFromSDK(
|
||||
if (!messageID || !msg.parts) continue
|
||||
|
||||
for (const part of msg.parts) {
|
||||
if (part.type === "tool" && part.state?.output && !part.truncated && part.tool) {
|
||||
if (part.type === "tool" && part.state?.output && !part.state?.time?.compacted && part.tool) {
|
||||
results.push({
|
||||
partPath: "",
|
||||
partId: part.id,
|
||||
@@ -74,8 +72,6 @@ export async function truncateToolResultAsync(
|
||||
|
||||
const updatedPart: Record<string, unknown> = {
|
||||
...part,
|
||||
truncated: true,
|
||||
originalSize,
|
||||
state: {
|
||||
...part.state,
|
||||
output: TRUNCATION_MESSAGE,
|
||||
@@ -108,7 +104,7 @@ export async function countTruncatedResultsFromSDK(
|
||||
for (const msg of messages) {
|
||||
if (!msg.parts) continue
|
||||
for (const part of msg.parts) {
|
||||
if (part.truncated === true) count++
|
||||
if (part.state?.time?.compacted) count++
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user