Skip to content

[FEATURE]: Config option for continuous execution loop until task completion #18636

Closed as not planned

Description

@viniciusdebruin

Feature hasn't been suggested before.

  • 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:

  1. read project instructions and continuity files
  2. choose the next small task
  3. implement it
  4. run validation (tests/lint/build)
  5. fix failures
  6. update progress
  7. continue to the next task
  8. 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.

Possible examples:

{
  "agent": {
    "builder": {
      "continuous": true,
      "resume_after_compaction": true,
      "stop_conditions": [
        "task_complete",
        "external_blocker",
        "missing_required_input"
      ]
    }
  }
}

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Mar 22, 2026
  2. viniciusdebruin commented on Mar 22, 2026

    @viniciusdebruin
    Author

    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.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.

  3. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 22, 2026
  4. github-actions commented on Mar 22, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  5. developingchet commented on Apr 26, 2026

    @developingchet

    Please add this :)

  6. jingchang0623-crypto commented on Apr 27, 2026

    @jingchang0623-crypto

    我曾经设了一个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自动化的踩坑和解决思路 👀

  7. removed
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  8. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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