Skip to content

fix(core): exempt orchestrator sessions from idle-beyond-threshold stuck transition#2121

Open
Bdandc wants to merge 1 commit into
AgentWrapper:mainfrom
Bdandc:session/ca-3
Open

fix(core): exempt orchestrator sessions from idle-beyond-threshold stuck transition#2121
Bdandc wants to merge 1 commit into
AgentWrapper:mainfrom
Bdandc:session/ca-3

Conversation

@Bdandc

@Bdandc Bdandc commented Jun 12, 2026

Copy link
Copy Markdown

What

Fixes a false-positive agent-stuck notification for orchestrator sessions. The idle-beyond-threshold stuck transition in determineStatus (lifecycle-manager.ts) did not exempt orchestrator sessions, so after the default 10m agent-stuck threshold a human-driven orchestrator — idle by design while waiting for user input — was flagged stuck, emitting session.stuck and firing the default agent-stuck reaction (URGENT desktop notification).

Why

The agent-report branch immediately above this block already skips orchestrators via lifecycle.session.kind !== "orchestrator", and its comment states lifecycle.session.kind is the authoritative source (string-matching role/id suffixes misses numbered orchestrator IDs like ${prefix}-orchestrator-1). This PR applies the same exemption to the idle-beyond-threshold stuck transition so orchestrator sessions never transition to stuck via idle decay.

Invariants preserved (per lifecycle-manager.ts guidance)

  • Runtime death: probed and resolved earlier via resolveProbeDecision — unaffected.
  • Activity waiting_input/blocked: short-circuit earlier in the cascade — unaffected.
  • SCM ground truth (PR merged/closed, CI, reviews): handled earlier — unaffected.
  • Worker stuck detection: unchanged; the exemption only applies when lifecycle.session.kind === "orchestrator". An exempted orchestrator falls through to the existing default branches and keeps its current status (no transition → no event).

Tests

  • does not mark orchestrator sessions stuck when idle exceeds agent-stuck threshold — orchestrator session idle 2m past a 1m threshold stays working and emits no notification.
  • still marks worker sessions stuck and fires the agent-stuck reaction when idle exceeds threshold — identical setup with worker kind transitions to stuck and fires the agent-stuck notify reaction (proves the no-notification assertion above is non-vacuous).

Verification

  • pnpm --filter @aoagents/ao-core typecheck
  • pnpm --filter @aoagents/ao-core test ✅ 1346 passed (74 files)
  • ESLint on changed files ✅ 0 errors (2 pre-existing warnings untouched)

🤖 Generated with Claude Code

…uck transition

Orchestrator sessions are human-driven and idle by design while waiting
for user input. The idle-beyond-threshold stuck transition did not exempt
them, so after the default 10m agent-stuck threshold they were flagged
stuck, emitting session.stuck and firing an URGENT desktop notification.

Add the same authoritative lifecycle.session.kind === "orchestrator"
exemption already used by the agent-report branch immediately above
(string-matching role/id suffixes misses numbered orchestrator IDs).

Invariants preserved: runtime death, activity waiting_input, and SCM
ground truth all short-circuit earlier in determineStatus and are
unaffected; worker stuck detection is unchanged.

Co-Authored-By: Claude Opus 4.8 <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