mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
ensure() creates the agent's network and attaches the broker to it in the next statement. Under swarm that network is swarm scoped: the control plane holds it the moment create returns, so the GET inside connect answers, while realizing it on a node is the allocator's asynchronous work and connect is node local. The attach therefore ran against a network the node did not have yet and took a 404. Run 36107421422 shows both halves. The broker logged agent_failed with 'POST /networks/<id>/connect -> 404: network not found' for every owner, and dockerd on the same node logged 'Failed to find network <id> on node' once per node, for all three. Every agent request then answered 502 and the drill reported the two agent services missing. The compose row passed throughout, which fits: a bridge network is local and usable as soon as it exists. connect now retries while the engine answers 404, up to realize_timeout, and re-raises anything else at once. EngineError carries the status for that, set at the single raise site in call, so the decision reads a number rather than matching the message text. The wait is scoped to the one condition known to clear by itself: a 403 from the socket proxy still fails immediately, and a 404 that outlives the window still fails, because then the network really is gone. Three cases pin it in both directions, and each fails against the previous engine.py: a 404 that clears is waited out, a 404 that persists raises at the deadline, a 403 raises on the first attempt. Not verified: no swarm run has exercised this. realize_timeout is 120 seconds from a single observed window of at least five, and it converts a structurally missing network from a fast failure into a slow one. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>