Totoro 593ba49458
feat(subagents): continue requested batch work and schedule explicit prerequisites (#7839)
* feat(subagents): continue native batches and honor item dependencies

* docs: link native batch follow-up changelog entries

* test(migrations): pin isolated history-seed upgrade to 0050

* fix(subagents): preserve follow-up scope, blockers and fair scheduling

* test(memory): freeze capacity evaluation time

* fix(subagents): guard follow-up admission and retain run controls

* fix(subagents): enforce runs:cancel on tool cancellation of follow-up batches

* style(tests): format test_batch_followup_host with ruff

* fix(subagents): drop the admission checkpoint check and keep SDK cancel compatible

The checkpoint check inside run admission waited on the checkpoint saver's
lock while holding the SQLite write lock, which could make another chat's
checkpoint write fail. Remove it; dispatch still checks the conversation
before admission.

A follow-up waiting for an unanswered question now keeps its claim until the
lease expires instead of rereading the conversation every poll. Cancel passes
the caller's run authority only to submitters that take it, so existing SDK
submitters keep the two-argument call. Document that retrying a prerequisite
by hand does not requeue its blocked items, and list 0052 as the migration head.

---------

Co-authored-by: Totoro-qaq <279883115+Totoro-qaq@users.noreply.github.com>
Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
2026-11-05 15:10:21 +08:00

48 lines
1.1 KiB
Python

from __future__ import annotations
from typing import Any, Literal, NotRequired, TypedDict
GoalBlocker = Literal[
"none",
"missing_evidence",
"needs_user_input",
"run_failed",
"external_wait",
"goal_not_met_yet",
]
class GoalEvaluation(TypedDict):
satisfied: bool
blocker: GoalBlocker
reason: str
evidence_summary: NotRequired[str]
relied_on_assumption: NotRequired[bool]
class GoalState(TypedDict):
objective: str
status: Literal["active"]
created_at: str
updated_at: str
continuation_count: int
max_continuations: int
no_progress_count: int
max_no_progress_continuations: int
last_evaluation: NotRequired[dict[str, Any]]
last_batch_wakeup_run_id: NotRequired[str]
class GoalOutcomeState(TypedDict):
"""The latest met goal, written only by the checkpoint write that clears it."""
status: Literal["achieved"]
objective: str
goal_created_at: str
achieved_at: str
continuation_count: int
max_continuations: int
reason: str
relied_on_assumption: bool
reply_message_id: str | None