Repository navigation
test(protocol): the agent clock test's earlier status predates the config it's checked against - #774
Closed
earakely-scale wants to merge 1 commit into
Closed
earakely-scale wants to merge 1 commit into
earakely-scale wants to merge 1 commit into
Conversation
…nfig it's checked against The test wrote the follower's earlier status and then had sync_time write the new config, which a status must postdate (by st_mtime_ns) to count. On a kernel whose file timestamps advance in coarse ticks, the two writes can share an mtime, and the earlier status of the same gateway and name then passed for the new config: once in CodeBuild's last 200 runs. The earlier status is now a second older, as a follower's earlier status is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
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.
What
test_a2a_agent_clock.py::test_what_the_follower_showed_of_its_config_before_never_passes_for_the_new_one[before1]failed CodeBuild's Integration Tests on #761 (assert 200 == 404), unrelated to that PR. It's a timing flake in the test.Cause.
sync_timetakes a follower status as this config's only when the status file'sst_mtime_nspostdates the config it just wrote (written < since_nsis stale). The test wrote the follower's earlier status and then, a client startup later, hadsync_timewrite the config. On a kernel whose file timestamps advance in coarse ticks (a few milliseconds), the two writes can share an mtime; the[before1]case (same gateway and name, so only the time tells them apart) then took the earlier status for the new config and answered 200.[before0]names another gateway, so it's always stale and never flaked.Fix. The earlier status is written a second before the config (
_status_from_before,os.utime), as a follower's earlier status is. The product code is unchanged.Verified
os.utimeto now + 1 s), the unchanged test fails exactly as CodeBuild did,[before1]assert 200 == 404, and[before0]passes: the failure is a status mtime that doesn't predate the config.Not changed
A real follower's status written within one timestamp tick of core's new config, for the same gateway and name, would also count as this config's; it only matters when the follower writes its status in that same tick, and it then reads the new config within a quarter second anyway. Using
<=instead would refuse a status the follower writes in the same tick after reading the new config, andsync_timewould wait it out, which is worse. Left as is; a config id the follower echoes in its status would settle it, if it ever matters.🤖 Generated with Claude Code


Confidence Score: 5/5
This PR appears safe to merge.Summary
This PR fixes a timing flake by making the test's earlier follower status clearly older than the new config. Product behavior is unchanged.
Reviews (1) · Last reviewed commit: "test(protocol): the agent clock test's e..." · Reviewed by Greptile