Skip to content

feat(v2): host-verified TASK.md checklist stop for Loop (#174) - #182

Merged
ByBrawe merged 27 commits into
mainfrom
fix/v2-checklist-stop-20261019
Oct 19, 2026
Merged

ByBrawe merged 27 commits into
mainfrom
fix/v2-checklist-stop-20261019

Conversation

@ByBrawe

@ByBrawe ByBrawe commented Oct 19, 2026

Copy link
Copy Markdown
Owner

Problem

A Reddit user expected --progress-file TASK.md to stop idle Loop after all Markdown tasks became checked; existing --progress-file is context only and a model printing /loop-clear is not a host slash-command invocation.

Implementation

  • Opt-in --until-checklist-complete requires --progress-file; unbounded /loop behavior is unchanged.
  • A bounded, project-scoped host Markdown checklist inspector ignores fenced/quoted/commented examples and refuses missing/no-tasks, huge, symlink, control-plane, directory and outside-project paths. Never treat invalid state as success.
  • Native OpenCode 2 and legacy V1 admission check completion at a safe boundary, requiring successful previously observed --verify when configured; native V2 pauses with persisted reason rather than sending a further prompt when all actionable checkboxes are checked.
  • Native status/help call out checklist stop, unavailable files, manual /loop-stop and /loop-clear authority. Model-emitted slash text is not executed as a privileged command.
  • Deterministic host and V1 tests, filesystem/parser tests, bundle source parity, docs and package scripts.

Validation and release gate

Built native/server/legacy bundles with Bun 1.4.2 on GitHub Actions and removed the temporary build workflow. PR CI, Windows/Linux native canaries and packed consumer tests must all pass before merging/releasing. This is not yet published in npm 0.6.8.

Closes #174 when merged and consumer-tested. Partially addresses stop UX #175 (does not add autonomous agent-issued control authority). Related #176 and #178.

ByBrawe and others added 17 commits October 19, 2026 23:24
Copilot AI balanced review requested due to automatic review settings October 19, 2026 20:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T20:35:40.636738Z 742e34c PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 742e34cafc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}
// A quoted example must not be mistaken for an actionable checkbox.
if (/^\s*>/.test(line)) continue
const match = line.match(/^\s{0,24}[-+*]\s+\[([ xX])\](?:\s|$)/)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Count ordered task-list items before declaring completion

Markdown task-list items can use ordered list markers, but this regex recognizes only -, +, and *. For a checklist such as - [x] setup followed by 1. [ ] implement, the function reports complete, causing the host to stop the loop while an actionable task remains. Include ordered-list markers when determining the total and pending counts.

Useful? React with 👍 / 👎.

Comment on lines +28 to +35
const start = original.indexOf("<!--", offset)
if (start < 0) {
line += original.slice(offset)
break
}
line += original.slice(offset, start)
comment = true
offset = start + 4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Ignore HTML comment markers inside Markdown code

The comment scanner runs before recognizing code spans or fenced-code contents, so a literal <!-- inside inline code—or an unmatched example inside a fence—sets comment for the rest of the file. If a checked task appeared earlier, later pending tasks are discarded and the checklist is incorrectly reported complete, stopping the loop prematurely. Comment delimiters should only affect parsing outside Markdown code.

Useful? React with 👍 / 👎.

Comment on lines +50 to +52
if (indentation <= 3 && markerSize >= 3) {
fence = { marker, length: markerSize }
continue

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Recognize fenced examples nested under list items

Fence detection only accepts up to three leading spaces, but fenced code nested beneath a list item is commonly indented four or more spaces. In that case the opener is not recorded, and a line such as - [ ] example inside the fence is counted as a pending task; with the default unlimited loop, a completed checklist containing such an example keeps dispatching turns indefinitely. Detect fences relative to their Markdown container rather than only at document-level indentation.

Useful? React with 👍 / 👎.

Comment thread src/source/core/args.js
;[found, rest] = takeFlag(rest, "--git-checkpoint"); if (found) job.gitCheckpoint = true
;[found, rest] = takeFlag(rest, "--checkpoint-only"); if (found) job.checkpointOnly = true
;[found, rest] = takeFlag(rest, "--pause-on-verify-fail"); if (found) job.pauseOnVerifyFail = true
;[found, rest] = takeFlag(rest, "--until-checklist-complete"); if (found) job.untilChecklistComplete = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject the checklist flag on the fallback V2 runtime

On OpenCode 2 hosts without session.hook, experimental.js selects createOpenCode2PromptRuntime, but the shared parser now accepts this flag while that runtime neither blocks it in unsupportedRuntimeJob nor inspects the checklist in runDueAction. Such a host accepts the command and decorates the prompt as though the host will stop it, yet the default unlimited loop continues after every checkbox is complete. Either implement the check in the fallback runtime or reject the flag there as unsupported.

Useful? React with 👍 / 👎.

@ByBrawe
ByBrawe merged commit 1c5e9df into main Oct 19, 2026
19 checks passed
@github-actions
github-actions Bot deleted the fix/v2-checklist-stop-20261019 branch October 19, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V2: opt-in task-checklist completion stop for --progress-file (Reddit TASK.md report)

2 participants