mirror of
https://github.com/Gitlawb/openclaude.git
synced 2026-08-24 10:14:19 -05:00
fix(grpc): relay non-success result as error so failures aren't swallowed
The gRPC server only reads `result.success` and emits an empty `done` on every other result subtype (timeout, max-turns, auth failure, etc). Clients see a long silent SSE stream then a blank assistant bubble. Surface the result detail via console.error + an error message so the bridge can SSE it through to the UI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
892c0545ed
commit
25f64f4b00
@@ -187,6 +187,21 @@ export class GrpcServer {
|
||||
}
|
||||
promptTokens = msg.usage?.input_tokens ?? 0
|
||||
completionTokens = msg.usage?.output_tokens ?? 0
|
||||
} else {
|
||||
// Agent loop ended without success (timeout, max turns,
|
||||
// upstream auth error, etc). Without surfacing this the
|
||||
// gRPC stream just emits empty `done` and the user sees
|
||||
// a frozen UI / empty bubble. Log the full result + emit
|
||||
// an error message so the bridge can SSE it through.
|
||||
const detail: any = msg as any
|
||||
const summary = detail.error ?? detail.message ?? detail.reason ?? `subtype=${detail.subtype}`
|
||||
console.error(`[grpc] non-success result subtype=${detail.subtype} detail=${JSON.stringify(detail).slice(0, 500)}`)
|
||||
call.write({
|
||||
error: {
|
||||
message: typeof summary === 'string' ? summary : JSON.stringify(summary).slice(0, 500),
|
||||
code: 'AGENT_NON_SUCCESS',
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user