Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ steps, project setup, headless operation, and removal.
| [docs/architecture.md](docs/architecture.md) | Component responsibilities, a short issue-to-PR overview, configuration ownership, scheduler ownership, and shared state. | Start here to understand how the system is divided before locating implementation code. |
| [docs/bot-workflow.md](docs/bot-workflow.md) | Eight Mermaid diagrams and detailed implementation notes: startup and polling; discovery and routing; task phases; sessions and questions; media helpers; verification and publication; feedback, merging, and tab closure; status, retries, and recovery. Includes links to the source for each area. | Use for exact execution order, state transitions, checkpoint behavior, failure paths, and tracing a bot task from issue to merged PR. |
| [docs/configuration.md](docs/configuration.md) | The standard `.opencode/automation.json` format, defaults, setup flags, configuration tracking across Git branches, authors, triggers, checks, base branches, model capabilities, media helpers, custom prompts, signatures, and auto-merge settings. | Use when adding or changing user-facing configuration, defaults, or setup examples. |
| [docs/runtime.md](docs/runtime.md) | User-visible behavior while the bot runs: GitHub questions and permission replies, branch selection, media inputs, prompt loading, follow-up comments, session tabs, runtime sidebar/status freshness, host repository inventory and discovery, local task closure, and routine management commands. | Use when changing issue conversations, session continuation, runtime tools, or TUI behavior. |
| [docs/runtime.md](docs/runtime.md) | User-visible behavior while the bot runs: GitHub questions and permission replies, branch selection, media inputs, prompt loading, follow-up comments, session tabs, runtime sidebar/status freshness, host repository inventory and discovery, local task closure, cancelling rounds while retaining tracking, and routine management commands. | Use when changing issue conversations, session continuation, runtime tools, or TUI behavior. |
| [docs/advanced.md](docs/advanced.md) | Separate scheduler/dispatcher setup, multiple repositories, custom RPC jobs, full options, timeouts, management and retry commands, persistence, reconciliation, locks, and known limits. | Use for low-level configuration, operational troubleshooting, recovery, or ownership/concurrency changes. |
| [docs/installation.md](docs/installation.md) | Loader registration, config-directory precedence, prerequisites, source installation, project-local installation, upgrade conflicts, testing on another machine, and migration limits. | Use when working on packaging, installers, registration, upgrades, or deployment troubleshooting. |
| [docs/releases.md](docs/releases.md) | Feature-to-devel and devel-to-release PR checks, automatic patch versions, manual npm version/tag releases, exact changelog notes, publication recovery, README commits on release, automatic release-to-devel synchronization, and promotion PRs into protected main. | Use for CI triggers, versioning, packaging, GitHub Release publication, branch permissions, or recovery after a failed release. |
Expand Down Expand Up @@ -62,7 +62,7 @@ the installation block without making remote writes. Keep its markers intact.
and GitHub plugin entrypoints. `src/easy.ts` resolves standard project settings;
`src/config.ts` defines the configuration schemas and route matching.
- `src/dispatcher.ts` owns discovery, the durable task lifecycle, questions,
feedback rounds, publication coordination, retries, durable task closure, and merge polling.
feedback rounds, publication coordination, retries, durable task closure, round cancellation/resumption, and merge polling.
`src/scheduler.ts` owns interval jobs; `src/state.ts` owns persistence and locks.
- `src/executor.ts` owns analysis, base selection, worktrees, session execution,
verification, and pushing. `src/analysis.ts` and `src/branch.ts` validate model
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ include the full version, for example `## 0.7.0-beta.1`.

### Added

- Cancel a single bot round while retaining issue/PR tracking, with durable stop
recovery, preserved draft worktrees and fresh worktrees for later feedback.
Resume tracking a locally closed task without replaying its abandoned round
or old comments. Expose both actions in `/bot` and the CLI; show historical
errors only in details after closing or cancelling.

- List configured repositories across the host with `opencode2-automation list`
(`--json` for scripts) and `/bot` → **Repositories**. Show owner/checkout paths,
base branches, timestamped dispatcher/scheduler status and concrete issue
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ installations are not removed by `npm uninstall --global`.
unavailable or stale readings are marked explicitly. See
[runtime panel details](docs/runtime.md#runtime-status-sidebar).
- **Task management:** `/bot` lets you open a session, inspect details, close idle
tabs, restart a stopped workflow, or stop sessions and end task tracking. Closing
tabs, restart a stopped workflow, **Cancel current round** while keeping issue
tracking, or stop sessions and end task tracking. **Resume issue tracking**
restores a closed task for future comments without replaying its old round. Closing
tracking preserves all local work and history, works without a surviving GitHub
issue/PR, and prevents rediscovery. See [task management](docs/runtime.md#manage-tasks-from-bot).
- **Progress:** use `/bot` in the TUI, or the CLI's `status`, `scan`, `pause`, and
Expand Down
35 changes: 35 additions & 0 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,3 +264,38 @@ notice; full saved text remains in task state and the session. Dispatcher check
text is limited to 8,000 bytes. The complete description, including retained
notes and signature, must fit within the automation limit of 60,000 bytes or
publication blocks without dropping notes. Titles are not regenerated on updates.


## Round cancellation and resuming tracking

Owner RPC methods `automation.github.cancelround` and
`automation.github.resumetracking` accept `{ "key": "owner/repository#123" }`
and return `{ "accepted": true }` when cancellation is queued. A no-op returns
`false`; invalid transitions and publication/merge in flight throw an actionable
error. Matching CLI commands work from the configured owner checkout. See
[runtime semantics](runtime.md#cancelling-one-round-while-keeping-tracking).

Durable `cancellation` stores the request time and interruption error. Status
`cancelling` gates worker checkpoints, session prompts, runtime hooks, discovery
updates and publication; scans leave its cursor unchanged. A worker pass resumes
due cancellation after restart and retries failed interruption after 30 seconds.
It drains the selected worker and pending question posts before entering `watching`.
The queue keeps `cancelledRounds` with prior errors, questions, feedback, worktree,
session and verification/report snapshots. `controlVersion` increases on operator
transitions, so stale TUI events cannot undo explicit resumption.

Watching continues PR-state discovery and accepts new authorized issue comments.
`publishedHead` retains the successfully published SHA and approval-window time
across rounds; merge checks use it while watching. No saved published head means
no automatic merge until the next successful publication. Old round checkpoints
are not treated as a new successful publication. Explicit resumption validates
GitHub objects and advances the comment cursor to the observed backlog without
queuing it; failed validation leaves tracking closed.

The next round allocates `localBranch` and a new managed worktree, fetching the
existing remote PR head if applicable. The prior worktree and branch are never
reset, cleaned, deleted or force-pushed. Checks validate the new local branch;
push still targets the task's original remote `branch`. Normal publication and
verification guards apply, including ancestry of the pinned base. The archived
round is not replayed or published automatically. Existing queued feedback is
retained by cancellation, while resuming a closed task explicitly skips backlog.
11 changes: 11 additions & 0 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ loads a generic scheduler, a GitHub dispatcher, and a terminal UI component.
if creating a PR without an already-saved title.
6. After publication, process queued authorized issue comments as new rounds on
the same worktree and branch, with a new main session and the existing open PR.
After cancellation, use a fresh local branch/worktree from the published head,
preserving the abandoned worktree and the remote PR branch.
Keep the original PR report and update its Latest update section after pushing;
preserve manual notes outside the managed description.
7. Merge only after eligible approval of the published head, repository permission
Expand Down Expand Up @@ -87,3 +89,12 @@ Operator task closure is a durable dispatcher operation: `/bot` sends the owner
hooks, feedback execution and merge monitoring exclude them. Session/worktree
data is retained. See [task management](runtime.md#manage-tasks-from-bot) for
in-flight operation limits and the distinction from closing a TUI tab.


Round cancellation uses `automation.github.cancelround`: persist `cancelling`,
drain execution, archive the current round, then `watching`. Discovery continues
and future feedback starts a new session in an isolated worktree. Only a saved
published head can authorize auto-merge while watching. Explicit
`automation.github.resumetracking` restores a closed task for future comments,
skipping its abandoned round and closed-period backlog after validating GitHub
objects. Both operations preserve work; neither closes the GitHub PR or issue.
Loading