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;