Skip to content

[FEATURE]: Let agents wait and automatically continue a session #53960

Description

@subhoghoshX

Feature hasn't been suggested before.

  • I searched existing issues. Related closed requests are linked below; this request focuses on reliable waiting and automatic continuation in V2.

Describe the enhancement you want to request

I'd like a supported way for agents to wait and then continue the same session automatically, without needing another user message.

My use case was simple: "wait two hours before starting this task." On V2.0.24, the agent launched a background sleep 7200 and said it would resume automatically. About an hour later, OpenCode evicted the project's services for inactivity. The background shell disappeared, no completion notification arrived, and the session never continued. Its persisted background-job marker was still running.

The relevant idle-cleanup and notification lifecycle code is unchanged in V2.0.25 and v2 at a67cf4c. This was observed once; the version comparison was source inspection, not a reproduction on V2.0.25.

I'm not specifically asking to increase the internal inactivity limit or prescribing a sleep tool, scheduler, or API. The capability I want is to tell an agent "continue in two hours" and trust that it will do so. It would also help with delayed retries and checking CI or PR reviews later.

An intentional wait shouldn't be mistaken for abandoned work or require repeated model calls just to stay alive. The pending wait should be visible and cancellable. Behavior across service shutdown/restart should be explicit; if a wait cannot resume, it should report that rather than silently disappear.

Related closed requests: #20486 (short sleep tool), #20874 (sleep/autonomous tick loop), and #25395 (scheduled tasks). This is about an agent's one-off continuation in an existing V2 session, not necessarily recurring jobs or manual pause/resume.

Environment: release/latest V2.0.24, Linux x86_64 (kernel 7.0.0-34-generic), Bash, TERM=xterm-256color. Terminal application unavailable. One custom plugin was active: visible-session-tabs.server.

Activity

  1. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up! You're asking for a supported way to tell an agent "continue in two hours" and have it reliably pick the same session back up on its own. The pending wait would be visible and cancellable, wouldn't need model calls to stay alive, and if it can't resume after a shutdown or restart it would say so instead of silently disappearing. Maintainers will consider it.

    The failure you ran into is a known bug: background shells get killed when a project's services are shut down for inactivity after 60 minutes, and the completion notification is lost. It's tracked in #51828, and PRs #52580 and #51827 propose fixes. Those would make the background sleep approach work across the idle period, but a dedicated, visible and cancellable wait is a separate request, so I'm keeping this one open as a feature request.

    Related issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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