The model batches are isolated with a deadline, so a Kill or a hang ends them

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-28 19:42:28 +02:00
1 parent c63f348dc9
commit b73a0fc2cb
6 files changed
+54 -9

No files matched your search

+13 -2
View File
@@ -216,10 +216,21 @@ TASK: ModelTask[ExtractResult] = ModelTask(
)
@job(f"{TASK.kind}_batch", "Extracting a batch", resource="llm")
# One call is bounded at AgentConfig.timeout (300s by default), and a batch
# is one call, plus a few short ones when a refusal halves it down
# (desk/modeltask.py `_narrow`). A batch of 20 still running after 30
# minutes is stuck, not slow.
@job(f"{TASK.kind}_batch", "Extracting a batch", resource="llm",
isolate=True, timeout=1800)
def run_batch(config: Config, store: Store, *, context: RunContext = NULL,
uids: list[str] | None = None) -> dict[str, Any]:
"""One model call over one batch of the roles that were waiting."""
"""One model call over one batch of the roles that were waiting.
Isolated so a Kill lands even while the call itself is in flight: `one`
only checks between calls, and a hung request — the CLI backend spawns a
process of its own, the API one blocks on a socket — has no such gap for
a thread to be ended at.
"""
return modeltask.one(TASK, config, store, uids or [], context=context).model_dump()