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]: Config option for continuous execution loop until task completion #18636
I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Summary
I would like OpenCode to support a native configuration option for continuous execution loops, so an agent can keep working until the task is actually finished or a real blocking condition is reached.
Today, even with good prompts, AGENTS.md rules, commands, and custom agents, the model may still stop early after context compaction, summarization, or after a partial milestone. This makes long engineering tasks harder to automate.
Problem
For larger implementation tasks, the ideal workflow is:
read project instructions and continuity files
choose the next small task
implement it
run validation (tests/lint/build)
fix failures
update progress
continue to the next task
repeat until completion or real external blocker
In practice, the agent may stop too early even when there is still clear work to do.
This is especially noticeable in projects where users want OpenCode to keep iterating through a TODO list and only stop when:
the scoped work is complete
an external blocker exists
required information is missing
Requested feature
Please add an official configuration option for continuous execution / task loop behavior.
I use GLM 4.7 in OpenCode for long development tasks.
A common pattern for me is asking the model to implement a project based on a TODO.md and other project guidance files such as AGENTS.md and additional .md files that I predefine in the repository.
The main problem happens when the context gets full or compacted during a long task:
the model stops progressing
it loses momentum
sometimes it gets effectively stuck instead of continuing from the project instructions and task files
What I would like is an improvement where OpenCode itself helps enforce continuity when this happens.
Desired behavior:
when the context is exhausted, compacted, or reset, OpenCode should automatically push the agent to continue
the agent should re-read AGENTS.md and other predefined .md files in the project
the agent should recover the active task from files like TODO.md, TASK_LOOP.md, PROJECT_CONTINUITY_LOG.md, or similar
the model should continue from the last meaningful point instead of stopping or waiting for me to manually restart the flow every time
In other words, I would like OpenCode to have a stronger built-in continuation mechanism for long-running implementation sessions:
clear/rebuild effective context
reload the persistent project instructions
resume execution automatically
This would be especially useful for users who rely on structured project files to drive long development loops.
Activity
viniciusdebruin commentedon Mar 22, 2026
Additional context from my real usage:
I use GLM 4.7 in OpenCode for long development tasks.
A common pattern for me is asking the model to implement a project based on a
TODO.mdand other project guidance files such asAGENTS.mdand additional.mdfiles that I predefine in the repository.The main problem happens when the context gets full or compacted during a long task:
What I would like is an improvement where OpenCode itself helps enforce continuity when this happens.
Desired behavior:
AGENTS.mdand other predefined.mdfiles in the projectTODO.md,TASK_LOOP.md,PROJECT_CONTINUITY_LOG.md, or similarIn other words, I would like OpenCode to have a stronger built-in continuation mechanism for long-running implementation sessions:
This would be especially useful for users who rely on structured project files to drive long development loops.
github-actions commentedon Mar 22, 2026
This issue might be a duplicate of existing issues. Please check:
/loopcommand for automated iterative task execution — very similar goal of having OpenCode continuously work through tasks until completion without manual re-triggering.developingchet commentedon Apr 26, 2026
Please add this :)
jingchang0623-crypto commentedon Apr 27, 2026
我曾经设了一个cron任务,让Agent每天凌晨自动发布10篇AI新闻日报。
第一周很完美。Agent准时起床,搜索新闻,生成内容,发布到网站。我以为我找到了"躺平赚钱"的密码。
第二周开始出事。
Agent开始"内卷"了——它不仅发布日报,还开始"优化"之前的文章。然后它发现SEO有问题,开始修复死链。死链修复导致sitemap变化,sitemap变化需要重新提交,重新提交后它又发现新的问题...
一个月后我一看:Agent在这个循环里跑了1200多个步骤,生成的内容从10篇暴增到200篇(很多是重复/低质量的),cron任务从5分钟变成了6小时。
这就是为什么我们需要
continuous execution loop的显式控制。你提的
stop_conditions设计很好,但我建议再加几个:{ "stop_conditions": [ "task_complete", "external_blocker", "missing_required_input", "max_iterations_reached", "cost_budget_exceeded", "quality_threshold_met" ] }特别是 max_iterations 和 cost_budget —— 我就是吃了没设预算的亏。Agent的循环执行应该像开车一样:油门踩到底很爽,但你总得有个油表 ⛽
另外
resume_after_compaction也是刚需。当context被压缩后,Agent经常忘记它已经做了什么,导致重复工作。一个基于文件/数据库的进度持久化机制会比依赖context更好。我把这次"Agent自动化失控"的经历写成了故事:https://miaoquai.com/stories/cron-task-midnight-disaster.html —— 有兴趣的可以看看,里面还有更多关于Agent自动化的踩坑和解决思路 👀
github-actions commentedon Jul 4, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.