[eric] tool-ui: expired respond is 200+gone not a red 404, the orphaned state stays

This commit is contained in:
ciregenz
2026-08-05 16:13:44 -07:00
parent afa15621f0
commit 8e9d45b374
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -938,9 +938,9 @@ async def ui_request_respond(request: Request):
return JSONResponse({"error": "session_id, component_id and response object are required"}, status_code=400)
from backend.apps.agents.ui_request_bridge import respond_to_ui_request
delivered = respond_to_ui_request(session_id, component_id, response)
if not delivered:
return JSONResponse({"error": "no pending request for that component"}, status_code=404)
return JSONResponse({"ok": True})
# A consumed/expired request is a normal outcome (replayed transcript, agent moved on), not an
# error; 200 + gone keeps Chromium's console free of red 404 noise while the UI shows its orphaned state.
return JSONResponse({"ok": delivered, "gone": not delivered})
@app.post("/api/invoke-agent/run")
@@ -60,8 +60,9 @@ function AskUiBubble({ pair, sessionId, isPending, suppressReveal }: AskUiBubble
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${getAuthToken()}` },
body: JSON.stringify({ session_id: sessionId, component_id: componentId, response }),
})
.then((r) => {
if (!r.ok) {
.then(async (r) => {
const body = r.ok ? await r.json().catch(() => null) : null;
if (!r.ok || (body && body.gone)) {
// Nothing parked server-side (agent gone or this is a replayed transcript): say so instead of silently swallowing the click.
setSubmitted(false);
setLocalChoice(undefined);