tractor/ai/prompt-io/opencode/20260812T012324Z_06c4af17_p...

1.4 KiB

After opening draft Tractor PR 490, the user requested an iterative pass over additional broadcast subsystem findings. The first item was to correct BroadcastState.statistics() queued counts and its deprecated Trio event truthiness check, then stop for a complete commit plan.

git diff HEAD~1..HEAD -- tractor/trionics/_broadcast.py

Changed queued_len_by_task from raw deque cursor indexes to retained, receivable counts. Caught-up -1 reports zero, valid indexes report index plus one, and lagged cursors clamp to the current retained queue length. Replaced trio.Event truthiness with an explicit is not None branch.

git diff HEAD~1..HEAD -- tests/test_task_broadcasting.py

Added a deterministic statistics regression using actual sends and receives. It verifies caught-up and one-queued states, drives a root receiver beyond a three-slot retention window to prove clamping, and installs a real trio.Event while treating deprecations as errors.

Verification output:

...........                                                              [100%]
11 passed in 5.76s

Python compilation and git diff --check passed. Initial adversarial review caught unclamped lagged cursors and an ineffective event test; both were fixed. Final review found no actionable issues.