a73x

4498c812

test: the agent dials are accepted between presses

a73x   2026-09-03 19:25

Commit message
test: the agent dials are accepted between presses

The full-table test dials max_agent_chans + 1 times with nobody accepting,
and the listen backlog is exactly max_agent_chans. Linux stretches the
queue; Darwin refuses the last connect with ECONNREFUSED, so the test died
before the daemon could refuse anything itself. Pumping between dials lets
the daemon accept as it goes, which is also how ssh opens its channels.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SakwJEwD9dXBoRP5kWbemW

src/server/server_test_agent.zig
Old New
@@ -244,7 +244,17 @@ test "Server: a full channel table refuses the newest dial and says so once" {
244 // so a long-lived agent connection holding a slot is the field failure 244 // so a long-lived agent connection holding a slot is the field failure
245 // this counts — eight of them turn forwarding off for every session. 245 // this counts — eight of them turn forwarding off for every session.
246 var dials: [max_agent_chans + 1]std.net.Stream = undefined; 246 var dials: [max_agent_chans + 1]std.net.Stream = undefined;
247 for (&dials) |*d| d.* = try dial.dial(path); 247 // Pump between dials, because the listen backlog is `max_agent_chans` and
248 // this dials one more than that. A queue that nobody accepts from is full
249 // at the last dial, and the two kernels answer that differently: Linux
250 // stretches, Darwin refuses the connect outright with ECONNREFUSED, which
251 // failed the test before the daemon had a chance to say anything. Letting
252 // the daemon accept between dials is also what the field looks like — ssh
253 // opens its channels one at a time against a running daemon.
254 for (&dials) |*d| {
255 d.* = try dial.dial(path);
256 try td.srv.pumpOnce(5);
257 }
248 defer for (dials) |d| d.close(); 258 defer for (dials) |d| d.close();
249 259
250 const Refusals = struct { 260 const Refusals = struct {