You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
afx: 'Tower is not running' reported under high load while Tower is up; the real probe error is discarded #1901
Under high machine load (load average 31 to 43), afx send and afx status intermittently print [error] Tower is not running. Start it with: afx tower start while Tower is up: same pid for days, and /health on port 4100 answers 200 in 0.6 to 1.1 s. The same command succeeds on a retry seconds later. Reported by an adopter, seen by two architects within two minutes.
Effects: a message relay fails unless the sender reads the last line, and the wording invites starting a second Tower.
What is known
The reporter suspected a ~1 s probe timeout. That is not it: REQUEST_TIMEOUT_MS in packages/sdk/src/tower-client.ts is 10,000.
TowerClient.isRunning() returns result.ok && result.data?.status === 'healthy', a bare boolean. Every failure of the /health request (connection refused or reset, timeout, non-200, a failed auth-key read, a JSON parse error) collapses to false, and the callers (send.ts, interrupt.ts, reset.ts, ide.ts, rename.ts, others) all print the same "Tower is not running". The actual error is thrown away, so the root cause of the false negative is not yet identified. Candidates: a transient connect failure when the accept queue is saturated, or an event-loop stall on the Tower side.
Fix
Reproduce under load and capture the discarded error first. Do not guess the cause.
Make the probe report why it failed: distinguish "nothing listening on the port" from "listening but did not answer / answered badly". Only the first should say "Tower is not running" and suggest afx tower start.
For the second case, retry once after a short pause, then fail with the real reason, e.g. "Tower did not answer /health () after N ms; it appears to be up, retry".
Apply through one shared helper so every caller gets the same behaviour, rather than patching each command.
Testing
Unit tests with an injected fetch: connection refused gives the "not running" message; a reset or timeout followed by success passes silently; two failures give the "did not answer" message with the underlying error and no suggestion to start Tower.
Constraint from the owner (2026-11-16): do not reproduce this with synthetic machine load. A first attempt with CPU-burner processes pushed load average to 76 and slowed the whole machine. Reproduce with an injected slow or failing fetch in a unit test, or a single stalled local HTTP server standing in for Tower.
Activity
waleedkadous commentedon Nov 16, 2026
On it! Working on a fix now.
waleedkadous commentedon Nov 16, 2026
Constraint from the owner (2026-11-16): do not reproduce this with synthetic machine load. A first attempt with CPU-burner processes pushed load average to 76 and slowed the whole machine. Reproduce with an injected slow or failing fetch in a unit test, or a single stalled local HTTP server standing in for Tower.
[Bugfix #1901] WIP: investigate notes before reboot (no code yet)
[Bugfix #1901] Investigate: root cause and scope
[Bugfix #1901] Record architect ruling: towerStart in scope
[Bugfix #1901] Fix: tell "Tower not running" from "Tower not answering"
[Bugfix #1901] Test: only a refused connection reads as "Tower not ru…
[Bugfix #1901] Thread: fix-phase notes
[Bugfix #1901] Fix: workspace stop never clears state on an unanswere…
[Bugfix #1901] Test: workspace start/stop never act on a busy Tower; …
[Bugfix #1901] Fix: send never stacks retries or misreads a busy Towe…
[Bugfix #1901] Test: send against a busy Tower after Spec 1940; retry…
[Bugfix #1901] Fix: the decisions image request honours the client's …
[Air #1999] Tests: #1901 gate fixtures answer the liveness route