You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]:Add Suspend/Resume functionality to pause Agent and Subagent execution #27511
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
🚀 Feature Description
I would like to request a "Suspend/Resume" feature for OpenCode. The goal is to allow users to temporarily pause the output and execution of both the main Agent and Subagents.
💡 Use Case & Motivation
This feature would be incredibly useful for scenarios where I need to switch locations or devices, such as commuting between home and the office. Currently, if I need to stop working, the agent might continue running or lose its immediate state context.
Having a suspend button would allow the agent to:
Pause its current operation gracefully.
Wait until the current tool calling is finished.
Enter a suspended state until I press "Resume" to continue the job from where it left off.
🛠️ Proposed Behavior
Suspend Action: When triggered, the Agent/Subagent should complete its currently running tool call and then halt any further actions or output.
Resume Action: When triggered, the Agent should pick up the task and continue its workflow seamlessly.
This would greatly improve the flexibility of OpenCode for developers who work across different environments throughout the day.
Reacted by Josh Klar, ETL, Mihovil Ilakovac, Andrea., yvt, Kaushalya Pradeep, Flomb, Omry Mendelovich, Jiří Kuneš, JeanBaptisteLouvet and 8 more
I would find this great for simply interrupting a model's train of thought in a more graceful way than mashing escape (which kills background subagents). Sometimes I want to get a word in before a model goes off and does some stupid unguided nonsense (for example, forgetting to ask me questions when it was told to ask me questions, or doing too much work in the main thread without splitting off subagents), but I don't want to interrupt the current reasoning, tool call, or background agents.
A button ("graceful pause"?) that says "hey, I want a word in, please, let me know when you're done yapping so I can speak or act" would be excellent.
Reacted by Andrea Russo, Andrea., Jiří Kuneš, JeanBaptisteLouvet, Jamie Isaacs, Vitaly X, Hai-Dang Huynh-Lam and Sergey Malchits
I run opencode against my local GPU. I work on multiple project at the same time constantly. I might be running a long running job like analyzing network logs. This may take 20-30 minutes. I get a priority interrupt on a different project. I want to pause the network log analysis to go work on this priority. But I don't want to abruptly stop the job. I click pause, it finishes the llm call, and waits for "play" to continue.
Reacted by Vitaly X, Hai-Dang Huynh-Lam and Kaylee Sachs
Can we expect any solution implemented? I have to commute 2 times daily between work and home with my laptop, and need a realiable way to gracefully pause/resume work of multiple agents. Pretty please :)
Reacted by Prateek Rathod, Jamie Isaacs, Vitaly X and Hai-Dang Huynh-Lam
Yeah I desperately need this i think this might be a great addition. Here is what I faced, When your main agent session has delegated task to certain subagents and you want to pass some more information after clearly seeing that the subagents are drifting, you need to press escape two times this cancels everything main as well as subagents, but then you can't resume your subagents ans the context is lost, even if I tell the main agent to resume those I guess the tool doesn't support it and it will just spawn fresh subagents
Sometimes I just want to spend the rest of my limit on a low priority project before it resets but once the limit is spent, I need to pause the execution to save the limits for higher priority tasks. I understand it might not be instant as it might need to way for some tasks to finish.
/resume {msg} — deterministically re-prompts the interrupted subagents of the current turn; the parent stays busy while they run and their results flow back into the task parts (no synthetic message).
resume_subagents + read_subagent_history tools — the main agent can autonomously resume its own interrupted subagents (no session ids needed) and inspect their history; results are written back into the original task parts so the TUI updates in place.
Interrupted task parts carry a resumable marker (session id) in the model context; cancellation cascades to running children, and resume reuses the existing subagent session instead of spawning fresh ones.
After ESC (cancel) or CTRL+C (abort), you can send a message asking to resume, or use /resume to resume the uncompleted subagent tasks of that turn, and the main task will wait for all of them and go on as expected. We deliberately skipped graceful pause — cancel + resume covers it.
[Preview]
Test both /resume and by sending resume to main agent
To restate it: you'd like a Suspend/Resume control that lets the running tool call finish, then holds the main agent and its subagents, so they can continue from the same point when you press Resume. That's different from today's Esc/abort, which cancels everything, including background subagents, and those can't be picked up again afterwards.
This isn't something a plugin can do today: no plugin hook runs between agent steps in a way that can hold a session and its subagents and release them later. Maintainers will consider it. Several people have already added their own use cases here, and #60011 was pointed here as a duplicate.
We hit this while building our own harness on top of OpenCode v2, worked through the cases from this thread and a few more (background shells waking an interrupted session, retries, restarts), and wrote it up for V2: #63875
soft: finish the current step, then stop the whole tree
hard: stop now, running tools move to background instead of being killed
kill: cancel background work too, but the session can still be resumed
Nothing wakes the session until resume, and everything that arrives in the meantime gets queued.
@trin4ik at least the way I read the description, particularly that quote:
Currently, if I need to stop working, the agent might continue running or lose its immediate state context.
Having a suspend button would allow the agent to:
Pause its current operation gracefully.
Wait until the current tool calling is finished.
Enter a suspended state until I press "Resume" to continue the job from where it left off.
That feature supposed to store cache on disk so that upon later restart the 30k context wouldn't have been parsed for the next 30 minutes with my 3 tok/s speed.
Your PR has no mention of cache management.
I'm personally find that even convenient at the current state of matter where I can press EscapeEscape to stop and then write a new prompt correcting the agent, etc.
The problem I'm really missing is that there's no way to stop the agent in a way that would avoid it, quoting, "lose its immediate state context".
@Hi-Angel
You’re right that #63875 does not cover inference-cache persistence; it addresses a different part of suspend/resume.
It is not intended to replace the EscEsc → corrective prompt workflow. It adds a durable execution gate for the whole session tree, including subagents: no new turn can start while paused, and background shell completions, retries, restart recovery, and other events are queued until an explicit resume. Already-running background jobs may continue depending on the pause mode. It does not change or persist the model’s cache.
For a local model, saving and restoring the KV cache across process restarts would normally require support from the inference backend, since OpenCode does not hold that cache. That sounds like a separate feature from session pause.
OpenCode V2’s session warming only sends periodic keep-alive requests to preserve provider-side prompt caches between prompts. It does not persist the cache to disk, so it does not cover the restart scenario you describe.
Activity
klardotsh commentedon Jun 2, 2026
I would find this great for simply interrupting a model's train of thought in a more graceful way than mashing escape (which kills background subagents). Sometimes I want to get a word in before a model goes off and does some stupid unguided nonsense (for example, forgetting to ask me questions when it was told to ask me questions, or doing too much work in the main thread without splitting off subagents), but I don't want to interrupt the current reasoning, tool call, or background agents.
A button ("graceful pause"?) that says "hey, I want a word in, please, let me know when you're done yapping so I can speak or act" would be excellent.
etlweather commentedon Jun 16, 2026
Here is another use case for the same:
I run opencode against my local GPU. I work on multiple project at the same time constantly. I might be running a long running job like analyzing network logs. This may take 20-30 minutes. I get a priority interrupt on a different project. I want to pause the network log analysis to go work on this priority. But I don't want to abruptly stop the job. I click pause, it finishes the llm call, and waits for "play" to continue.
Dmitry-Leushkin commentedon Jul 7, 2026
Can we expect any solution implemented? I have to commute 2 times daily between work and home with my laptop, and need a realiable way to gracefully pause/resume work of multiple agents. Pretty please :)
atulsharma052 commentedon Jul 19, 2026
Yeah I desperately need this i think this might be a great addition. Here is what I faced, When your main agent session has delegated task to certain subagents and you want to pass some more information after clearly seeing that the subagents are drifting, you need to press escape two times this cancels everything main as well as subagents, but then you can't resume your subagents ans the context is lost, even if I tell the main agent to resume those I guess the tool doesn't support it and it will just spawn fresh subagents
LorincJuraj commentedon Jul 30, 2026
Sometimes I just want to spend the rest of my limit on a low priority project before it resets but once the limit is spent, I need to pause the execution to save the limits for higher priority tasks. I understand it might not be instant as it might need to way for some tasks to finish.
linsmod commentedon Aug 16, 2026
Hi @thdxr @nexxeln — FYI we have a working implementation on the
task-resumebranch of https://github.com/linsmod/opencode:/resume {msg}— deterministically re-prompts the interrupted subagents of the current turn; the parent stays busy while they run and their results flow back into the task parts (no synthetic message).resume_subagents+read_subagent_historytools — the main agent can autonomously resume its own interrupted subagents (no session ids needed) and inspect their history; results are written back into the original task parts so the TUI updates in place.taskparts carry aresumablemarker (session id) in the model context; cancellation cascades to running children, and resume reuses the existing subagent session instead of spawning fresh ones.After ESC (cancel) or CTRL+C (abort), you can send a message asking to resume, or use
/resumeto resume the uncompleted subagent tasks of that turn, and the main task will wait for all of them and go on as expected. We deliberately skipped graceful pause — cancel + resume covers it.[Preview]
/resumeand by sendingresumeto main agent[Gif Preview]

If gif not showing, check the video:
https://www.youtube.com/watch?v=3CnRBQUPG1g
albasili commentedon Oct 9, 2026
this is soo much needed. It's still open, is there any change this is going to end up implemented?
opencodejr commentedon Oct 29, 2026
Thanks for the detailed request, @zzxzz12345!
To restate it: you'd like a Suspend/Resume control that lets the running tool call finish, then holds the main agent and its subagents, so they can continue from the same point when you press Resume. That's different from today's Esc/abort, which cancels everything, including background subagents, and those can't be picked up again afterwards.
This isn't something a plugin can do today: no plugin hook runs between agent steps in a way that can hold a session and its subagents and release them later. Maintainers will consider it. Several people have already added their own use cases here, and #60011 was pointed here as a duplicate.
Closely related issues:
trin4ik commentedon Nov 14, 2026
We hit this while building our own harness on top of OpenCode v2, worked through the cases from this thread and a few more (background shells waking an interrupted session, retries, restarts), and wrote it up for V2: #63875
Nothing wakes the session until resume, and everything that arrives in the meantime gets queued.
Hi-Angel commentedon Nov 14, 2026
@trin4ik at least the way I read the description, particularly that quote:
That feature supposed to store cache on disk so that upon later restart the 30k context wouldn't have been parsed for the next 30 minutes with my 3 tok/s speed.
Your PR has no mention of cache management.
I'm personally find that even convenient at the current state of matter where I can press Escape Escape to stop and then write a new prompt correcting the agent, etc.
The problem I'm really missing is that there's no way to stop the agent in a way that would avoid it, quoting, "lose its immediate state context".
trin4ik commentedon Nov 14, 2026
@Hi-Angel
You’re right that #63875 does not cover inference-cache persistence; it addresses a different part of suspend/resume.
It is not intended to replace the
EscEsc→ corrective prompt workflow. It adds a durable execution gate for the whole session tree, including subagents: no new turn can start while paused, and background shell completions, retries, restart recovery, and other events are queued until an explicit resume. Already-running background jobs may continue depending on the pause mode. It does not change or persist the model’s cache.For a local model, saving and restoring the KV cache across process restarts would normally require support from the inference backend, since OpenCode does not hold that cache. That sounds like a separate feature from session pause.
OpenCode V2’s session warming only sends periodic keep-alive requests to preserve provider-side prompt caches between prompts. It does not persist the cache to disk, so it does not cover the restart scenario you describe.