Skip to content

fix(probe): message ids no longer repeat within a clock tick - #140

Merged
fylorn merged 1 commit into
mainfrom
fix/probe-message-id
Sep 23, 2026
Merged

fylorn merged 1 commit into
mainfrom
fix/probe-message-id

Conversation

@fylorn

@fylorn fylorn commented Sep 23, 2026

Copy link
Copy Markdown
Contributor

Found while running the suite for another change: message_ids_look_like_anthropic_ids_and_do_not_repeat failed once with two identical ids.

message_id() seeded an xorshift with the current time in nanoseconds. The clock is coarser than a nanosecond, so two probe replies generated in the same tick carried the same msg_01… id. With the strengthened test, the old implementation yields 733 distinct ids out of 1000.

It now draws each character with rand::random_range, as tw-config's key generator already does; rand was already a dependency of tw-gateway. The test additionally generates 1000 ids and requires all to be distinct.

🤖 Generated with Claude Code

@fylorn
fylorn force-pushed the fix/probe-message-id branch from 8cb14c3 to 7b31249 Compare September 23, 2026 12:30
Probe replies got their id from an xorshift seeded with the current time
in nanoseconds. The clock is coarser than that, so two probes answered
at the same moment carried the same id; generating 1000 in a row gave
733 distinct ones. rand was already a dependency of this crate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fylorn
fylorn force-pushed the fix/probe-message-id branch from 7b31249 to 680f28b Compare September 23, 2026 12:44
@fylorn
fylorn merged commit 45f9b70 into main Sep 23, 2026
2 checks passed
@fylorn
fylorn deleted the fix/probe-message-id branch September 23, 2026 12:56
@fylorn fylorn mentioned this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant