Keep the agent warm — Fly's proxy won't wait for it to boot - #279
Merged
Conversation
The agent scaled to zero, and every wakeup against a stopped machine failed with RemoteDisconnected. Fly's proxy waits ~8s for an auto-started machine to bind its port; this process takes longer: before LiteLLM ~7s (fit, barely) after LiteLLM ~16s (broke) after deferring litellm's import ~10s (still broke) So deferring the import was necessary but not sufficient, and the 7s figure says this was always marginal — LiteLLM only exposed it. The remaining time is Python plus the MCP SDK plus Sentry, and trimming that further means tuning against a proxy timeout we do not control and can only observe in production. Keeping one 512MB machine warm costs about $2/month — noise against the LLM spend of a single run — and removes cold starts from the wakeup path instead of racing them. Scale-to-zero was the right shape when the agent was its own app answering a public webhook; it is not worth this. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by re-testing the cold-start path after #278 rather than trusting the fix.
Fly's proxy waits ~8s for an auto-started machine to bind its port. This process doesn't make it:
RemoteDisconnectedRemoteDisconnectedSo #278 was necessary but not sufficient — and that 7s figure means this was always marginal and happened to fit. LiteLLM only exposed it. The remaining time is Python + the MCP SDK + Sentry, and trimming that further is tuning against a proxy timeout we don't control and can only observe in production.
Keeping one 512 MB machine warm is ~$2/month — noise against the LLM cost of a single run — and it removes cold starts from the wakeup path rather than racing them. Scale-to-zero was the right shape when the agent was its own app answering a public webhook; it isn't worth this.
🤖 Generated with Claude Code