fix(host_agent): the server writes all five samples an agent post carries (#5181)

MAX_SAMPLES_PER_INGEST was 2 while agent 1.10 drains a backlog five samples a
post, so the server dropped the oldest three of every such post. Posts now
answer in 0.4-1.3 s on dev, including the boot cleanup window, so five fit
the agent's 10 s. A test holds the server cap at or above the agent's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 21:05:22 -04:00
co-authored by Claude Opus 5.5
parent 326a9cd254
commit 2f208a84fb
2 changed files with 12 additions and 3 deletions
@@ -73,3 +73,11 @@ def test_a_full_backlog_is_cut_to_its_newest_samples():
def test_a_small_post_is_left_alone():
posted = [_s(3), _s(1)]
assert routes.newest_samples(posted, 5) == (posted, 0)
def test_the_server_writes_every_sample_an_agent_post_carries():
# An agent drains its backlog MAX_SAMPLES_PER_POST at a time; a server cap
# below that drops the oldest of every such post (#5181).
from plugins.host_agent import agent
assert routes.MAX_SAMPLES_PER_INGEST >= agent.MAX_SAMPLES_PER_POST