Skip to content

deploy/sbx tests: the host agent's startSeconds check no longer flakes on a slow run - #957

Merged
webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/host-agent-start-flake
Nov 20, 2026
Merged

webchang merged 1 commit into
rossoctl:mainfrom
webchang:pr/host-agent-start-flake

Conversation

@webchang

Copy link
Copy Markdown
Member

Summary

deploy/sbx/tests/host-agent.test.sh's start-limit block was timing-sensitive: it fails on unmodified main when the machine is loaded.

What changes

The block stamps worker sbx_s4's start 40 s in the past, runs the agent, and checked for "startSeconds":4[0-2] in its output and for 40-42 in the next inventory. The agent measures against its own clock when it runs (start_book in host-agent.sh: now - t), so the value is 40 plus however long the test took between writing the stamp and the agent's read; past 2 s (seen at 44 on a loaded machine) the check failed. Now the test:

  • reads the value the agent reported for sbx_s4;
  • requires it to be at least 40 and at most the wall time measured around that run (date before the stamp, after the agent returns);
  • requires the next inventory's limits.startSeconds to equal it.

Test only; host-agent.sh is unchanged.

Tests

Run Before After
host-agent.test.sh, 5 runs in a row flaky under load 5/5 pass
the same, with a 4 s pause injected between the stamp and the agent's run (to simulate load) fails: "the done start is not said" passes

Assisted-By: Claude Code

…un's own wall time

The start-limit block stamps a worker's start 40 s in the past and expects the agent to
report startSeconds 40-42. The agent measures against its own clock when it runs, so the
value is 40 plus however long the test took between the stamp and the agent's read: on a
loaded machine that passed 2 s and the check failed on unmodified main. The check now
takes the reported value, requires it between 40 and the wall time measured around the
run, and requires the next inventory's startSeconds to equal it.

Assisted-By: Claude Code
Signed-off-by: Rong Chang <[email protected]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Nov 20, 2026
@pdettori pdettori added this to the v0.11.1 milestone Nov 20, 2026
@pdettori pdettori added the bug Something isn't working label Nov 20, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review — deploy/sbx tests: the host agent's startSeconds check no longer flakes on a slow run

Right diagnosis — the value is 40 + however long the test took between stamping s4 and the agent's read — and the bound is computed the only way that is both tight and safe: T_MAX = now - T40 after the run, so the allowed window is exactly what the wall clock permits, not a fixed 40–42.

  • The extraction is numeric-only ([0-9][0-9]*), so a missing or malformed line fails the -n test and then the range check, as it should.
  • The inventory assertion is safe to make exact here: section 17 empties start-seconds before the run, only s4 completes in it (s1–s3 are starting, s5 is what starts), so the mean-of-one that limits.startSeconds reports is s4's own value; the old 40–42 range was the sloppy part.

Checks 16/16 green. Author: webchang (MEMBER — maintainer). One commit, signed off.

@webchang
webchang merged commit 39aa27e into rossoctl:main Nov 20, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants