mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 14:20:22 +00:00
fix(gateway+acp): thread stopReason through final event to ACP bridge (#24867)
Complete the stop reason propagation chain so ACP clients can distinguish end_turn from max_tokens: - server-chat.ts: emitChatFinal accepts optional stopReason param, includes it in the final payload, reads it from lifecycle event data - translator.ts: read stopReason from the final payload instead of hardcoding end_turn Chain: LLM API → run.ts (meta.stopReason) → agent.ts (lifecycle event) → server-chat.ts (final payload) → ACP translator (PromptResponse)
This commit is contained in:
@@ -423,7 +423,9 @@ export class AcpGatewayAgent implements Agent {
|
||||
}
|
||||
|
||||
if (state === "final") {
|
||||
this.finishPrompt(pending.sessionId, pending, "end_turn");
|
||||
const rawStopReason = payload.stopReason as string | undefined;
|
||||
const stopReason: StopReason = rawStopReason === "max_tokens" ? "max_tokens" : "end_turn";
|
||||
this.finishPrompt(pending.sessionId, pending, stopReason);
|
||||
return;
|
||||
}
|
||||
if (state === "aborted") {
|
||||
|
||||
Reference in New Issue
Block a user