Repository navigation
deploy/sbx tests: the host agent's startSeconds check no longer flakes on a slow run - #957
Merged
Merged
Conversation
…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]>
ingpaolodettori-dev
approved these changes
Nov 20, 2026
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
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-ntest and then the range check, as it should. - The inventory assertion is safe to make exact here: section 17 empties
start-secondsbefore the run, only s4 completes in it (s1–s3 arestarting, s5 is what starts), so the mean-of-one thatlimits.startSecondsreports 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_bookinhost-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:sbx_s4;datebefore the stamp, after the agent returns);limits.startSecondsto equal it.Test only;
host-agent.shis unchanged.Tests
host-agent.test.sh, 5 runs in a rowAssisted-By: Claude Code