Skip to content

feat: auto-resume idle workers with pending in_progress tasks when messaged #62

@komoreka

Description

@komoreka

Problem

When a worker's ephemeral session expires, it transitions to idle. If it has in_progress tasks and unread inbox messages, it stays idle indefinitely until a human manually restarts it from the desktop app. Directors have no programmatic way to trigger the resume.

This creates a gap in autonomous orchestration: a director sends a task brief → worker session times out mid-work → work stalls silently.

Proposed solution

Two complementary mechanisms:

1. Message-triggered auto-resume

When a message is delivered to an idle agent's inbox, Stoneforge should automatically attempt to start the agent's session so it can process the message. This mirrors how email clients wake up mail apps.

2. Watchdog: idle worker + in_progress task = auto-restart

A background scheduler checks for agents that are idle with tasks in in_progress or open status assigned to them, and triggers sf agent start automatically after a configurable timeout (e.g. 5 minutes).

3. (Alternative) sf message send flag

Add a --wake flag to sf message send that also starts the target agent's session:

sf message send --to el-ukb6 --content "Resume task..." --wake

Current workaround

Director must manually call sf agent start <id> — which currently also fails (see issue #61). Requires desktop app restart.

Why this matters

Orchestration sessions can run for hours. Workers going idle between tasks is expected and healthy. What's not acceptable is that re-engaging them requires human intervention. Auto-resume would make multi-worker pipelines genuinely autonomous.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions