From bd71a587ef4c752d606f30b656bd888b6f7cb6e4 Mon Sep 17 00:00:00 2001 From: yetone Date: Tue, 29 Sep 2026 14:08:03 +0800 Subject: [PATCH] =?UTF-8?q?routing:=20a=20failed=20try=20shows=20what=20it?= =?UTF-8?q?s=20vendor=20said,=20and=20the=20errors=20count=20opens=20the?= =?UTF-8?q?=20newest=20failed=20request=20(Discord:=20=E8=93=9D=E7=8C=AB,?= =?UTF-8?q?=20Devin=20502=20=E2=80=94=20Agent=20=E6=94=B6=E5=88=B0?= =?UTF-8?q?=E7=9A=84=E9=94=99=E8=AF=AF=20did=20nothing=20when=20clicked)?= =?UTF-8?q?=20=E2=80=94=20the=20trace=20kept=20each=20try's=20error=20word?= =?UTF-8?q?=20for=20word,=20but=20the=20page=20only=20told=20magpie's=20re?= =?UTF-8?q?ading=20of=20it=20(403=20=C2=B7=20failed),=20so=20the=20vendor'?= =?UTF-8?q?s=20own=20reason=20was=20nowhere=20to=20be=20seen.=20Now=20it?= =?UTF-8?q?=20is=20under=20that=20try,=20and=20clicking=20the=20errors=20c?= =?UTF-8?q?ount=20picks=20the=20latest=20request=20whose=20agent=20got=20a?= =?UTF-8?q?n=20error.=20Checked=20in=20a=20sandbox=20magpie=20web=20with?= =?UTF-8?q?=20a=20fake=20vendor=20answering=20403?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/gui/assets/i18n.js | 2 ++ internal/gui/assets/routing.css | 3 +++ internal/gui/assets/routing.js | 15 ++++++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/internal/gui/assets/i18n.js b/internal/gui/assets/i18n.js index eddc584f5..04b85fdab 100644 --- a/internal/gui/assets/i18n.js +++ b/internal/gui/assets/i18n.js @@ -943,6 +943,8 @@ const I18N = { "requests": "请求", "rerouted": "改道", "errors your agent saw": "Agent 收到的错误", + "It said: {error}": "原话:{error}", + "Show the latest request that failed": "查看最近一个失败的请求", "rate limited": "限流", "out of credit": "余额不足", "quota used up": "额度用尽", diff --git a/internal/gui/assets/routing.css b/internal/gui/assets/routing.css index 4b00548c8..fbbcdb1d3 100644 --- a/internal/gui/assets/routing.css +++ b/internal/gui/assets/routing.css @@ -103,6 +103,9 @@ .rt-steps li.why { color: var(--fg); } .rt-steps li.why::before { background: var(--fg); } .rt-steps li.aside { color: var(--muted); } +.rt-steps li.said { font-family: var(--mono, ui-monospace, monospace); font-size: 11.5px; overflow-wrap: anywhere; white-space: pre-wrap; } +.rt-stats > span.rt-errs { cursor: pointer; } +.rt-stats > span.rt-errs:hover b { color: var(--red); } .rt-steps li.aside::before { background: none; border: 1px solid var(--muted); width: 4px; height: 4px; } .rt-steps li.ok::before { background: var(--green); } .rt-steps li.bad::before { background: var(--red); } diff --git a/internal/gui/assets/routing.js b/internal/gui/assets/routing.js index 49d761411..b6e6286a0 100644 --- a/internal/gui/assets/routing.js +++ b/internal/gui/assets/routing.js @@ -54,6 +54,15 @@ const s = el("span"), b = el("b", "", "0"); s.append(b, el("span", "", k)); s.dataset.label = k; + if (k === "errors your agent saw") { + // the newest request whose agent got an error, to see what it got + s.classList.add("rt-errs"); + s.title = t("Show the latest request that failed"); + s.addEventListener("click", (e) => { + const r = listed().find((x) => x.done && x.status >= 400); + if (r) pick(r, e); + }); + } statB.push(b); stats.append(s); } @@ -887,7 +896,11 @@ items.push([affWhy(r, true) || ruleWhy(r, true) || firstWhy(r), "why"]); for (const s of nestedWhy(r)) items.push([s, "why"]); for (const a of asides(r)) items.push([a, "aside"]); - r.tries.forEach((_, i) => items.push([tryWhy(r, i), r.tries[i].done ? (r.tries[i].status < 400 ? "ok" : "bad") : "wait"])); + r.tries.forEach((tr, i) => { + items.push([tryWhy(r, i), tr.done ? (tr.status < 400 ? "ok" : "bad") : "wait"]); + // what the vendor said, word for word: the why above is magpie's reading of it + if (tr.done && tr.status >= 400 && tr.error) items.push([t("It said: {error}", { error: tr.error.length > 600 ? tr.error.slice(0, 600) + "…" : tr.error }), "aside said"]); + }); if (r.done && !r.tries.length) items.push([t("Nothing was tried: {error}", { error: r.error || r.status }), "bad"]); steps.replaceChildren(...items.map(([s, c]) => el("li", c, s))); }