Skip to content

[BUG] #680 idle detector flags a session idle while a foreground subagent works #858

Description

@tronghieu

Description

The #680 idle detector keys on the main session transcript only (_transcript_activity_key, src/bmad_loop/adapters/generic.py:1750, unchanged on main @ d09a324a6). Claude Code writes a subagent's turns to its own file, ~/.claude/projects/<project>/<session-id>/subagents/agent-*.jsonl. While a foreground subagent works, the parent transcript does not change, so the detector journals session-idle for a session that is busy.

Steps to reproduce

  1. Claude adapter, dev_stall_grace_s = 600.
  2. Run a story whose dev session hands a slice to a foreground subagent that works for more than 600 s.
  3. Read the run journal.

Expected behavior

No session-idle while any subagent transcript of the session is growing.

Actual behavior

From a real run (bmad-loop 0.13.1):

{"kind": "session-idle",   "task_id": "...-dev-1", "idle_s": 604.737, "threshold_s": 600.0, ...}
{"kind": "session-active", "task_id": "...-dev-1", "idle_s": 846.486, ...}

The session was running a foreground subagent for those 846 s. The notice is observability only, but it reads as a stuck session in the journal and the TUI.

Suggested fix

Fold the newest (mtime_ns, size) of <transcript dir>/<session-id>/subagents/*.jsonl into the activity key, stat-only, so usage_parser = "none" profiles keep working.

Environment

bmad-loop 0.13.1 (68645cb), Claude Code adapter, macOS.

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