Skip to content

Dry-run dispatcher does not count predicted spawns toward global cap #78117

Description

@davidsolc-ai

Bug

hermes_cli.kanban_db._dispatch_once_locked() does not increment its local spawned counter in the dry_run branch. As a result, dry-run output can predict more spawns than real dispatch allows under max_in_progress / max_spawn when tasks are already running.

Pinned revision reproduced: bc6d86b15c1d3136ee6e56275ffb1d3ff282f943 (Hermes Agent v0.20.0 / 2026.8.3).

Reproduction

  1. Create one valid task with status='running'.
  2. Create nine ready specialist tasks, interleaved across three profiles.
  3. Call dispatch_once(..., dry_run=True, max_in_progress=9, max_in_progress_per_profile=3).

Expected: eight predicted specialist spawns because the running task consumes one global slot.

Actual: nine predicted specialist spawns.

The task row remains running before and after dispatch, and SELECT COUNT(*) FROM tasks WHERE status='running' returns one.

Root cause

In hermes_cli/kanban_db.py, the dry_run branch appends to result.spawned and increments _per_profile_running, but does not execute spawned += 1. The real-dispatch branch does increment it. The loop's global-cap condition therefore never observes predicted dry-run spawns.

Suggested fix

Increment spawned in the dry-run branch immediately before continue, and add a disposable-board regression test that compares dry-run and real dispatch with an existing running coordinator task.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/cronCron scheduler and job managementtype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions