This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-06 19:43:52 -05:00
1 parent ef7ea5f828
commit 942eba00cf
3 files changed
+19 -7

No files matched your search

@@ -86,8 +86,7 @@
id="sa-concurrent"
type="number"
bind:value={maxConcurrent}
min="1"
max="100"
min="-1"
class="w-16 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors"
/>
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600"
@@ -123,8 +122,7 @@
id="sa-async"
type="number"
bind:value={maxAsync}
min="1"
max="100"
min="-1"
class="w-16 h-7 px-2 rounded-lg text-xs bg-gray-100 dark:bg-white/6 text-gray-700 dark:text-gray-300 border border-gray-200 dark:border-white/8 outline-none focus:border-blue-400 dark:focus:border-blue-500 transition-colors"
/>
<span class="text-[0.6875rem] text-gray-400 dark:text-gray-600"
+4 -2
View File
@@ -39,10 +39,12 @@ async def active_count() -> int:
async def reserve_async_subagent(max_async: int, **record: Any) -> dict[str, Any]:
"""Reserve capacity for a background subagent before creating its chat."""
max_async = max(1, int(max_async or 20))
max_async = int(max_async or 20)
if max_async != -1:
max_async = max(1, max_async)
async with _lock:
running = sum(1 for r in _records.values() if r.get("status") in {"starting", "running"})
if running >= max_async:
if max_async != -1 and running >= max_async:
return {
"status": "rejected",
"error": (
+13 -1
View File
@@ -2318,8 +2318,20 @@ async def delegate_task(
}
)
if config["max_concurrent"] == -1:
return await _run_subagent_chat(
task=task,
context=context,
workspace=__context__["workspace"],
connection=__context__["connection"],
model=__context__["model_id"],
user_id=__context__["user_id"],
parent_chat_id=__context__["chat_id"],
config=config,
)
if _subagent_semaphore is None:
_subagent_semaphore = asyncio.Semaphore(config["max_concurrent"])
_subagent_semaphore = asyncio.Semaphore(max(1, config["max_concurrent"]))
async with _subagent_semaphore:
return await _run_subagent_chat(