Skip to content

[Feature]: Periodic agent nudges for long running PTY #51

Description

@cybe42

Problem Statement

It's frustrating when the agent runs long commands and the command gets stuck, or takes longer than expected, with this plugin, the agent isn't notified of anything until the pty finishes, meaning it can hang for a long time by waiting for a non responsive command or a command that is waiting for input.

(Example of this issue can be found in additional context)

Proposed Solution

Similar to the existing notification system that works when a command exits, I suggest a similar approach could be taken for new a nudge parametre within pty_spawn. Something like nudgeIntervalSeconds to nudge the agent in an interval, or a nudgeStart so if the process takes longer than this then the agent is told and it is notified again and again by the interval mentioned beforehand.
I haven't established any specifics so it should be up to debate, but the nudge system could be made to only run when the agent is idle (to save tokens)

Alternatives Considered

I've instructed agents to be more strict with timeouts, but timeouts can kill processes that you don't actually want to kill (say for example you're transferring files)
I've also tried instructing the agent via system prompt to be more mindful of the running pty instances, like tell it to manually check by running bash sleep in between pty_read operations. However, this is unstable, the agent occasionally forgets to check and/or checks too often bloating context for no reason. And on top of this, it's very hard to instruct cheaper models with lower prompt adherence to do this, and it's an absolute nightmare getting them to do this, because that is essentially trying to get the agent to do the plugin's job.

Use Case

Monitoring long running tasks: Say for example a heavy database migration or a long install is running, if for example, input is required mid run, or an error happens, if this suggested nudge feature were available, the agent could be woken up to check the status, if there are any errors, it could restart the process, or if an input is required, it could allow the process to continue. Opposed to the only alternative today which is a hard timeout, which could lead to an install/database migration getting corrupted when it couldve been saved by a nudge.

Additional Context

Image

The agent would have waited for a long time unless I intervened.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions