fix: five from the full review

- doctor printed OPENAI_BASE_URL raw, the third place a credential-bearing URL
  reached the terminal; it goes through _endpoint like the others.
- dev.run left its output readers unjoined, so a child's last lines could be
  lost on exit. The threads are kept and joined during teardown.
- logs read each file and then reopened it to follow, so anything written in
  between appeared in neither. One handle now serves both.
- dev took --port straight from argparse: 0 would have served on an ephemeral
  port while printing 0, and oversized values reach socket.bind. It goes
  through _port_number first.
- doctor --redis-url overrode only the broker, so a stale result backend or
  cache was still pinged and the flag looked broken. All three endpoints now
  come from the URL given.
This commit is contained in:
Alex committed 2026-09-17 13:15:56 +01:00
1 parent d0a0b352e0
commit da58c072a0
4 files changed
+131 -18

No files matched your search

+8 -1
View File
@@ -181,6 +181,7 @@ def run(
colour = out.isatty() if colour is None else colour
lock = threading.Lock()
running: list[tuple[Child, object]] = []
pumps: list[threading.Thread] = []
try:
for child in children:
process = spawn(
@@ -195,7 +196,9 @@ def run(
start_new_session=os.name != "nt",
)
running.append((child, process))
threading.Thread(target=_pump, args=(child, process, out, lock, colour), daemon=True).start()
pump = threading.Thread(target=_pump, args=(child, process, out, lock, colour), daemon=True)
pump.start()
pumps.append(pump)
while True:
for child, process in running:
@@ -214,3 +217,7 @@ def run(
return 0
finally:
_stop(running, grace, sleep)
# Join the readers: a child's last lines are still in flight when it exits, and dropping
# them loses exactly the output that says why it stopped.
for pump in pumps:
pump.join(timeout=grace)