Harden eight flaky core and broker tests, and fix the Devin host on macOS
Merged
KJ
9d ago+208+208+012345678901234567890123456789-48-48-01234567890123456789
Eight tests failed intermittently on GitHub runners while #2057 was in review, at commits that didn't touch them. Each one is fixed at its root cause: no #[ignore] and no retries. One of them was a real product bug.
| Test | Where it failed | Root cause | Fix |
|---|---|---|---|
devin::host::transport_tests::mock_acp_process_stays_idle_and_takes_a_second_turn_until_explicit_release | macOS, BrokenPipe at host.rs:479 | Product bug. On macOS an accepted socket inherits the listener's non-blocking mode, so the 1 s read timeout did nothing. A request the client hadn't written yet read as WouldBlock, and the host dropped the connection. | accept_control sets each accepted socket to blocking. The test now also sends one request from a client that waits 200 ms before writing. That request fails deterministically with the exact CI error on the old code and passes with the fix. |
history_flush::a_failing_receiver_ends_at_the_deadline_with_records_pending, a_slow_receiver_cannot_overrun_the_absolute_deadline | Every run on a Mac, right after a fresh link | macOS scans a newly linked executable on its first launch (7 s measured here, 0 s after). The wall-clock bounds counted that scan. | Sandbox::new runs the binary once (--version) before any test starts its clock. The in-process elapsed_ms deadline checks are unchanged. Before: fails on every cold run. After: 4/4 cold runs pass. |
relay_core::stopping_a_channel_whose_peer_stopped_reading_is_bounded | macOS, timed out waiting for Live | The fake replies to the 1 MB register and then stops reading. When the reply arrives after a heartbeat write has already wedged, the channel reads nothing while wedged, so Live never comes. That's expected for a dead peer and isn't what the test checks. | Wait for the fake to hold the node.register frame instead of for Live, then check that stop is bounded as before. |
relay_outbound::a_missing_accepted_handoff_settles_in_doubt_without_holding_back_later_handoffs | Linux, timed out at bridge.rs:498 | The two DMs were queued under separate locks. A delivery fetch could see only the first, and the injector's scripted outcomes (one global FIFO) then went to the wrong messages, so the end state the test waits for never came. | New FakeRelaycast::send_dms queues both under one lock. |
relay_agents::a_slow_initial_connect_poll_does_not_block_team_heartbeats_or_queues | macOS on main 05a130289, and earlier on Linux; timed out waiting for the team heartbeat | The test used the cohort with successful team queue reads. A successful read refreshes presence and makes the REST heartbeat redundant, as the helper's comment says, so when the read landed first no heartbeat was sent within the hour-long interval. | Use failing team queue reads, as the sibling heartbeat tests do. The queue-read assertion still holds, since failed reads are recorded. 25/25 runs pass, and the whole relay_agents suite passes. |
probe::inventory::tests::reading_a_provider_database_asks_for_no_pass | macOS, including the in-job retry | One quiet second didn't mean startup's own passes had finished on a slow runner, so a late startup pass read as a pass caused by the database read. | Wait for four consecutive quiet seconds first, the same fix relay-desktop shipped. Main has since landed the same fix with a 30 s deadline and diagnostics, so after merging main this PR no longer changes this test. |
broker snippets::tests::mcp_preflight_rejects_incomplete_tool_registration | Ubuntu release tests | The assertion didn't print the error. Two likely causes: a 1 s budget on a loaded runner, or ETXTBSY from exec'ing a script this multithreaded test process had just written while another test forked. | Run the fake server as /bin/sh <script>, so no just-written file is exec'd. Raise the budget to 10 s; it only bounds a hung server, and this one answers at once. Print the error if the assertion fails. |
Verified on an Apple-silicon Mac:
- Devin test: 40/40, plus the A/B above.
relay_coreandrelay_outboundtests: 25/25 each, with the full probe lib suite running alongside as load.- Inventory test: 12/12.
- Broker preflight tests: 20/20.
history_flush: 4/4 cold.cargo fmtis clean, and clippy reports nothing new in the touched files.
One user-visible fix (Devin on macOS) has a changelog bullet under Fixed.
🤖 Generated with Claude Code
![Autofix with [code]smith](https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png)
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.
Agent Relay sessions
claudesessionab25cff8· opened viagh pr create· last active 2026-11-03