From f74e9e9e8f689cd4c305ba4f7e46299afd99d6e5 Mon Sep 17 00:00:00 2001 From: Hermes Date: Tue, 17 Nov 2026 08:23:11 +0000 Subject: [PATCH] no_endpoint: ctx_tokens in Antwort und Log MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wenn alle Ziele am Kontext scheitern, war bisher nur need_tokens sichtbar. Die 503-Antwort und die Logzeile nennen jetzt auch die Prompt-Schätzung, damit "context context context" nicht mehr raten lässt, wie groß der Request war. --- src/junction.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/junction.c b/src/junction.c index 70a7e3e..863a6e6 100644 --- a/src/junction.c +++ b/src/junction.c @@ -3725,15 +3725,17 @@ static void handle_client(j_conn *client) if (head_sent) { /* the caller holds a 200 by now, so the failure has to be an event */ char msg[512]; - snprintf(msg, sizeof msg, "no endpoint available (need=%ld, rule line %d, tried:%s)", - need, rule->line, attempts[0] ? attempts : " none"); + snprintf(msg, sizeof msg, "no endpoint available (need=%ld, ctx=%ld, rule line %d, tried:%s)", + need, ctx, rule->line, attempts[0] ? attempts : " none"); sse_error(client, 503, msg); - jlog("no_endpoint", "path=%s attempts=%s", rq.path, attempts[0] ? attempts + 1 : "none"); + jlog("no_endpoint", "path=%s need=%ld ctx=%ld attempts=%s", rq.path, need, ctx, + attempts[0] ? attempts + 1 : "none"); } else { char body[1024]; snprintf(body, sizeof body, - "{\"error\":\"no_endpoint_available\",\"need_tokens\":%ld,\"rule_line\":%d,\"attempts\":\"%s\"}", - need, rule->line, attempts[0] ? attempts + 1 : "none"); + "{\"error\":\"no_endpoint_available\",\"need_tokens\":%ld,\"ctx_tokens\":%ld," + "\"rule_line\":%d,\"attempts\":\"%s\"}", + need, ctx, rule->line, attempts[0] ? attempts + 1 : "none"); send_simple(client, 503, "Service Unavailable", body); }