fix(ansible): a run that waited says so in its stored output, not only live (#5158)

The "[queued — waiting for run X on the same host]" and run-slot lines were
broadcast to live viewers and never stored, so a run that sat queued had no
record of why once the live view was gone (CI 8439: the overlap test found
the order right and the explanation missing). _claim_hosts now returns the
line it waited on and start_run seeds the run's output with every wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 21:29:21 -04:00
co-authored by Claude Opus 5.5
parent 3c24c633df
commit 37ffe06531
2 changed files with 23 additions and 15 deletions
+3 -3
View File
@@ -47,18 +47,18 @@ def test_a_second_run_on_the_same_host_waits_for_the_first(gate):
app = gate.app
async def go():
assert await executor._claim_hosts(app, "a", {"web"}) is False
assert await executor._claim_hosts(app, "a", {"web"}) is None
b = asyncio.create_task(executor._claim_hosts(app, "b", {"web", "db"}))
await asyncio.sleep(0.05)
assert not b.done()
held = app._ansible_host_gate["held"]
assert "db" not in held # all or nothing: b holds no half
assert await executor._claim_hosts(app, "c", {"db"}) is False
assert await executor._claim_hosts(app, "c", {"db"}) is None
executor._release_hosts(app, "c", {"db"})
await asyncio.sleep(0.05)
assert not b.done() # web is still a's
executor._release_hosts(app, "a", {"web"})
assert await asyncio.wait_for(b, 5) is True
assert "waiting for run a" in await asyncio.wait_for(b, 5)
assert held == {"web": "b", "db": "b"}
asyncio.run(go())