fix: surface reviewer response failures

This commit is contained in:
2026-08-14 12:06:25 +02:00
parent 25b2835e73
commit db1a81cfa6
8 changed files with 166 additions and 3 deletions
+24
View File
@@ -105,6 +105,30 @@ test("assistant provider errors are sanitized and leave the turn failed", () =>
expect(JSON.stringify(seen)).not.toContain("DO_NOT_LEAK");
});
test("subscription model errors become a safe actionable client message", () => {
const { rpc, fire } = fakeRpc();
const bridge = new SessionBridge(rpc);
const seen: any[] = [];
bridge.onClientEvent((event) => seen.push(event));
fire({
type: "message_end",
message: {
role: "assistant",
stopReason: "error",
errorMessage: "429: {\"code\":\"1311\",\"message\":\"Your current subscription plan does not yet include access to GLM-5.3\",\"secret\":\"DO_NOT_LEAK\"}",
},
});
expect(seen).toContainEqual({
type: "info",
level: "error",
text: "The selected model is unavailable for the current subscription. Choose another model and start a new session.",
});
expect(JSON.stringify(seen)).not.toContain("GLM-5.3");
expect(JSON.stringify(seen)).not.toContain("DO_NOT_LEAK");
});
test("markFailed records backend-detected failure without emitting raw detail", () => {
const { rpc } = fakeRpc();
const bridge = new SessionBridge(rpc);