Skip to content

fix(scheduler): dispatch executor-excluded handoffs instead of repolling origin monitor #4311

Description

@huangruiteng

问题 / Problem

当一个 continuous monitor 在 material transition 后创建 continuation_policy=independent_handoff 的 advancement Todo,并用 excluded_agents=[origin-agent] 禁止原作者自审时,Todo 会保持 unclaimed;但后续 heartbeat 仍持续唤醒 origin agent 轮询同一 monitor。即使 consecutive_no_change >= 2,当前行为也只建议调大轮询间隔,不会把真实可推进的 handoff 分派给同 Goal 的另一个 Agent。

When a continuous monitor emits an advancement Todo with continuation_policy=independent_handoff and excludes the origin agent, the Todo can remain unclaimed while later heartbeats repeatedly select the origin monitor. Even after multiple unchanged polls, the runtime only proposes polling backoff; it does not dispatch the real handoff to another agent in the same Goal.

可复现证据 / Reproduction evidence

  1. Origin agent owns a due continuous_monitor.
  2. A material transition creates one linked advancement Todo with excluded_agents=[origin-agent].
  3. The projected priority list shows that unclaimed Todo, while the current-agent claim scope reports zero selectable unclaimed work.
  4. manager.context_inbox is empty at turn start because no durable dispatch/receipt was produced for another agent.
  5. The origin agent receives repeated monitor turns; unchanged polls increase consecutive_no_change, but no peer claim or handoff occurs.

This is not a missing-work problem: actionable work exists, but the scheduler/claim/handoff bridge cannot route it to an eligible executor.

根因划分 / Root-cause split

  • Agent-side: the origin agent must not equate a successful poll with whole-goal progress; it should verify that an independent successor has a receiver and return receipt.
  • LoopX-side: the control plane lacks an idempotent broker from an unclaimed, executor-excluded successor to an eligible peer/session. Current projection also conflates “unclaimed globally” with “selectable by this agent”, hiding dispatch starvation.

期望 / Expected behavior

  • A material monitor transition atomically links the successor and emits a durable dispatch obligation.
  • Turn-start handoff/inbox logic claims the successor exactly once for a different registered agent in the same Goal, or projects an explicit no_eligible_peer blocker.
  • The origin monitor may continue at its configured cadence, but it must not starve independent advancement work or force a second automation/source of truth.
  • Codex message delivery alone is not acceptance; dispatch requires inbox visibility plus a return receipt.

验收 / Acceptance

  • Frontier projection distinguishes dispatchable_by_peer from unclaimed_but_executor_excluded.
  • agent_handoff -> turn_start hook -> inbox read -> return receipt survives restart and is idempotent under duplicate delivery.
  • After the configured unchanged threshold, origin-agent routing yields to a dispatch/replan action instead of only suggesting interval backoff.
  • If no eligible peer exists, a typed blocker is projected without inventing a user gate.
  • CLI/managed Turn, frontend, and Lark read the same typed dispatch/receipt projection.
  • Tests cover duplicate heartbeats, stale claims, restart, and same-Goal agent identity isolation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions