From 40498254c66fb140769cef8acd4c00295bf41d5d Mon Sep 17 00:00:00 2001 From: kisfenyo Date: Sun, 12 Jul 2026 10:21:34 +0200 Subject: [PATCH] fix-6: raise ring display cap to 5000 (viewer + Entries clamp); viewer default limit 1000 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_017CDMFpFx84pfviCTVuGGhf --- controller/internal/web/handler_debug.go | 3 ++- controller/internal/web/logbuffer.go | 6 +++++- controller/internal/web/templates/debug.html | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/controller/internal/web/handler_debug.go b/controller/internal/web/handler_debug.go index c73ecc2..9b0d6e8 100644 --- a/controller/internal/web/handler_debug.go +++ b/controller/internal/web/handler_debug.go @@ -513,7 +513,8 @@ func (s *Server) debugLogBuffer(w http.ResponseWriter, r *http.Request) { limit := 200 if v := r.URL.Query().Get("limit"); v != "" { - if n, err := strconv.Atoi(v); err == nil && n > 0 && n <= 1000 { + // fix-6: allow up to the ring capacity (5000) so the viewer can pull the full retained window. + if n, err := strconv.Atoi(v); err == nil && n > 0 && n <= 5000 { limit = n } } diff --git a/controller/internal/web/logbuffer.go b/controller/internal/web/logbuffer.go index a53bd6b..1d26a9a 100644 --- a/controller/internal/web/logbuffer.go +++ b/controller/internal/web/logbuffer.go @@ -79,8 +79,12 @@ func (lb *LogBuffer) Entries(minLevel string, limit int, after time.Time) ([]Log total = lb.pos } - if limit <= 0 || limit > 1000 { + // fix-6: clamp to the ring's own capacity, not a hardcoded 1000 — a larger ring is useless if the + // viewer can never request more than 1000 of it. A missing/invalid limit still defaults to 200. + if limit <= 0 { limit = 200 + } else if limit > lb.size { + limit = lb.size } levelOrder := levelPriority(minLevel) diff --git a/controller/internal/web/templates/debug.html b/controller/internal/web/templates/debug.html index 5873f86..edad6c0 100644 --- a/controller/internal/web/templates/debug.html +++ b/controller/internal/web/templates/debug.html @@ -620,7 +620,7 @@ function toggleLogAutoRefresh() { } function refreshLogs(append) { if (currentLogSource === 'agent') { refreshAgentLogs(); return; } - var url = '/api/debug/logs?level=' + currentLogLevel + '&limit=500'; + var url = '/api/debug/logs?level=' + currentLogLevel + '&limit=1000'; if (append && lastLogTimestamp) url += '&after=' + encodeURIComponent(lastLogTimestamp); fetch(url, {headers: csrfHeaders()}).then(function(r){return r.json()}).then(function(data) { if (!data.ok) return;