Skip to content

Raise default agent.max_concurrent from 4 to 32#195

Merged
pufit merged 1 commit into
mainfrom
pufit/bump-max-concurrent-32
Jul 25, 2026
Merged

Raise default agent.max_concurrent from 4 to 32#195
pufit merged 1 commit into
mainfrom
pufit/bump-max-concurrent-32

Conversation

@pufit

@pufit pufit commented Jul 22, 2026

Copy link
Copy Markdown
Member

Why

engine.run() holds a global asyncio.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: no session_running broadcast, 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_concurrent default 432 (dataclass default + loader fallback)
  • nerve/bootstrap.py: setup-wizard generated config → 32
  • config.example.yaml, docs/config.md: documented default → 32

Existing configs with an explicit max_concurrent are unaffected.

Testing

  • Full suite: 1588 passed, 2 skipped.

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.

Generated by Nerve

@pufit
pufit merged commit 979bd50 into main Jul 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant