fix: enforce MAX_CONCURRENT_AGENTS limit properly (fixes #63) #64

Closed
shoko wants to merge 0 commits from fix/issue-63 into main
Owner

Summary

  • Fix MAX_CONCURRENT_AGENTS slot being released immediately after forking
  • Wait for child process to complete before releasing slot

Bug

In cmd_start(), the slot acquired via acquire_agent_slot() was released immediately after calling opencode run --fork because the parent returns immediately while the child continues running.

Fix

Capture the child PID with $! and add wait $child_pid before release_agent_slot(). This ensures the slot is only released after the forked process completes.

## Summary - Fix MAX_CONCURRENT_AGENTS slot being released immediately after forking - Wait for child process to complete before releasing slot ## Bug In cmd_start(), the slot acquired via acquire_agent_slot() was released immediately after calling `opencode run --fork` because the parent returns immediately while the child continues running. ## Fix Capture the child PID with `$!` and add `wait $child_pid` before `release_agent_slot()`. This ensures the slot is only released after the forked process completes.
shoko added 1 commit 2026-04-01 04:13:41 +02:00
shoko force-pushed fix/issue-63 from a952204e15 to bd4e8587b4 2026-04-01 05:05:32 +02:00 Compare
shoko closed this pull request 2026-04-01 08:42:28 +02:00

Pull request closed

Sign in to join this conversation.