Skip to content

feat(tasks): failure escalation + capability-aware agent_list - #93

Open
sandydasari wants to merge 1 commit into
mainfrom
feat/failure-escalation
Open

feat(tasks): failure escalation + capability-aware agent_list#93
sandydasari wants to merge 1 commit into
mainfrom
feat/failure-escalation

Conversation

@sandydasari

@sandydasari sandydasari commented Jul 2, 2026

Copy link
Copy Markdown
Owner

What

Two halves of the same problem: (1) a failing task today retries identically with the same assignee on a 5-minute loop forever; (2) the manager triaging team work has no visibility into which coworker can actually do what.

How

Failure escalation

  • New failures frontmatter counter, store-managed like runs (deliberately not in the create/update input schemas): park() increments it; completing or reassigning the task resets it.
  • At 3 consecutive failures the dispatcher parks with escalate: true: the store hands the task off — team manager first, then creator — as open with a 30-minute start_at floor. Open rather than blocked, because reassignment clears the session binding and blocked only nudges an already-bound session — a blocked handoff would strand invisibly.
  • No distinct target (self-created solo task) → stays parked, with the system comment telling the assignee to re-scope instead of retrying as-is.
  • Reassignment resetting the counter prevents instant re-escalation ping-pong; the system comment preserves the failure history.

Capability-aware agent_list

  • Each coworker entry now carries tools, skills, and mcp_servers (projected from AgentDefinition in the AgentManager binding); query matches over them, so query: "browser" finds the agent with browser_* tools.
  • The manager triage prompt now points at agent_list for capability matching and tells managers to re-scope, not re-run, tasks that come back escalated.

Independent of #92 at the code level (zero shared files/imports; verified by running the full affected suites on this branch alone) — merge order doesn't matter, though prompt text here mentions task_plan, so both are meant to land.

Tests

5 store tests (counting, reset-on-done, manager/creator escalation, no-target), 1 end-to-end dispatcher test (3 failing turns → escalated open task, reset counter, 30-min floor, cleared session), 2 agent_list tests (capability fields, capability-query matching).

🤖 Generated with Claude Code

Two halves of the same problem: a mis-scoped task today retries
identically with the same assignee on a 5-minute loop forever, and the
manager triaging team work has no visibility into who can actually do
what.

Failure escalation:
- New `failures` frontmatter counter, store-managed like `runs` (not in
  TaskCreate/TaskUpdate input schemas on purpose): park() increments it,
  success or reassignment resets it.
- At MAX_TASK_FAILURES (3) consecutive failures the dispatcher parks
  with `escalate: true`: the store hands the task off — team manager
  first, then the creator — as `open` with a 30-minute start_at floor.
  Open, not blocked: blocked only nudges an already-bound session, and
  reassignment clears the session, so a blocked handoff would strand.
  With no distinct target it stays parked with the system comment
  telling the assignee to re-scope (split via task_plan) instead of
  retrying as-is.
- Reassignment resetting the counter is what prevents instant
  re-escalation ping-pong; the system comment preserves the history.

Capability-aware agent_list:
- Each coworker entry now carries `tools`, `skills`, and `mcp_servers`
  (projected from AgentDefinition in the AgentManager binding), and
  `query` matches over them — "browser" finds the agent with browser_*.
- Manager triage prompt now points at agent_list for capability
  matching, task_plan for fan-out, and tells managers to re-scope (not
  re-run) tasks that come back escalated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant