mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-09 05:24:49 +09:00
pollOnce was clearing c.caps and c.sysInfo *before* postJSON ran, so any failed /poll request (tunnel reconnect, transient 5xx, timeout) silently lost the buffered payload. The agent's periodic resend would only repopulate it 5 seconds later, and if the panel was checking just before that tick the capability map looked empty. Plus the very first /poll after auth happens before the connectionWatcher's 1Hz tick gets a chance to fire sendCapabilities, so /poll #1 had nothing to ship. Fix: don't clear the buffers on /poll. The agent re-populates them on every 5–60s tick, the panel's update_capabilities is a pure overwrite, and re-sending the same payload twice is free. This trades a few unnecessary writes for "your capabilities never go missing because of a flaky network." Also harden update_system_info: only overwrite a column when the new value is truthy. Previously a single probe failure (Docker briefly unreachable, gopsutil WMI hiccup) would wipe a healthy value to empty/0 and leave it that way until the next successful probe — see the regression where Docker Version went 27.3.1 → N/A across builds. And: log the top-level keys + inner caps count + sudo mode in update_capabilities so we can diagnose the "panel says empty" failure mode from the panel logs without instrumenting further. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>