Raise default agent.max_concurrent from 4 to 32#195
Merged
Conversation
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.
Why
engine.run()holds a globalasyncio.Semaphore(agent.max_concurrent)for the entire duration of an agent turn. With the default of 4, a handful of concurrent long-running sessions (e.g. several deep investigations, Claude + Codex side by side, plus cron jobs — all competing for the same pool) saturate every slot. Any further message — to an existing session, the first turn of a brand-new session, or a scheduled cron turn — parks silently at the semaphore: nosession_runningbroadcast, no message persistence, no title, no streaming. To the user the instance looks unwritable until a long turn finishes and frees a slot (observed queue delays of 8+ minutes).Turns are almost entirely I/O-bound (awaiting the backend CLI subprocess), so a much higher ceiling is safe; 32 keeps the semaphore as a runaway backstop rather than a throughput limiter.
Changes
nerve/config.py:AgentConfig.max_concurrentdefault4→32(dataclass default + loader fallback)nerve/bootstrap.py: setup-wizard generated config →32config.example.yaml,docs/config.md: documented default →32Existing configs with an explicit
max_concurrentare unaffected.Testing
Follow-up (not in this PR)
The silent-queueing UX is a separate issue: messages waiting on the semaphore aren't persisted or acknowledged, so users can't tell "queued" from "broken" (and queued messages are lost on restart). Worth persisting the user message and broadcasting a queued state before semaphore acquisition.