Repository navigation
chore(agents): keep one agents instance warm - #12511
Merged
Merged
Conversation
anyplot-agents scaled to zero after about 15 idle minutes, which lost every in-memory session, reset the day counters and gave the next message a cold start. Set _MIN_INSTANCES to 1 (owner decision of 2026-11-02). The idle instance costs about 0.44 CHF a day at list price (1 vCPU and 2 GiB, measured on anyplot-api's min instance in the billing export, 2026-10-12 to 2026-10-31). The account's Compute Flexible commitment left 0.59 CHF a day unused over the same window, so the instance costs nothing extra until the commitment's first part ends on 2027-01-15. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A critical unit-test expectation still conflicts with the changed substitution default, and the changelog overstates session persistence during idle periods.
2 open issues
What changed in this PR
This pull request keeps one anyplot-agents Cloud Run instance warm by setting _MIN_INSTANCES to "1", preserving in-memory state across scale-to-zero periods and reducing cold-start latency. It also documents the operational decision and adds a changelog entry.
Changes:
- Sets the agents service minimum instance count to one.
- Updates the agent network documentation with lifecycle and cost details.
- Adds a changelog fragment describing the warm-instance behavior.
| File | Summary | Review comments |
|---|---|---|
docs/concepts/agent-network.md |
Documents the warm-instance deployment decision, cost rationale, and session limitations. | No comments. |
changelog.d/agents-warm-instance.md |
Announces reduced cold starts and retained in-memory state. | Nit: Qualify session persistence to clarify that the one-hour session sweep still applies. |
agents/cloudbuild.yaml |
Changes the default Cloud Run minimum instance count to one. | Critical: Update tests/unit/agents/test_image.py:520 and any expected fixtures, which still expect a default of "0". |
Review effort: Lite
…gelog The image test still expected _MIN_INSTANCES "0". The fragment claimed that sessions survive idle periods without limit; a session still ends after an hour without activity, and a deploy resets sessions and day counters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8
`gather` raises as soon as the first cancelled theme ends, so render() returned, and removed the run directory, while the other theme's `docker kill` was still running. That made test_local_backend_kills_the_container_on_cancellation flaky on a loaded runner (failed on #12511, which does not touch this code). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.


Summary
anyplot-agentsnow deploys with_MIN_INSTANCES: "1". Today it scales to zero after about 15 idle minutes, and that loses every in-memory session, resets the day counters and gives the next message a cold start (owner decision of 2026-11-02).deploy-agentstrigger overrides only_RENDER_URL, so the new default applies.asyncio.gatherraised after the first and left the seconddocker killrunning). Development backend only.Plan
N/A
Test plan
tests/unit/test_cloudbuild_configs.pypasses, and the YAML parses.tools.changelog check --base origin/mainpasses.deploy-agentssucceeds andgcloud run services describe anyplot-agentsshowsminScale=1.