Skip to content

Commit 6fbaaf8

Browse files
authored
Merge pull request #15 from d3cker/codex/bot-task-management
Manage and close bot tasks from /bot without losing work
2 parents 4d5ea20 + 3062857 commit 6fbaaf8

19 files changed

Lines changed: 481 additions & 60 deletions

‎AGENTS.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ steps, project setup, headless operation, and removal.
2828
| [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. |
2929
| [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. |
3030
| [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. |
31-
| [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, and routine management commands. | Use when changing issue conversations, session continuation, runtime tools, or TUI behavior. |
31+
| [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, local task closure, and routine management commands. | Use when changing issue conversations, session continuation, runtime tools, or TUI behavior. |
3232
| [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. |
3333
| [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. |
3434
| [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. |
@@ -58,7 +58,7 @@ the installation block without making remote writes. Keep its markers intact.
5858
and GitHub plugin entrypoints. `src/easy.ts` resolves standard project settings;
5959
`src/config.ts` defines the configuration schemas and route matching.
6060
- `src/dispatcher.ts` owns discovery, the durable task lifecycle, questions,
61-
feedback rounds, publication coordination, retries, and merge polling.
61+
feedback rounds, publication coordination, retries, durable task closure, and merge polling.
6262
`src/scheduler.ts` owns interval jobs; `src/state.ts` owns persistence and locks.
6363
- `src/executor.ts` owns analysis, base selection, worktrees, session execution,
6464
verification, and pushing. `src/analysis.ts` and `src/branch.ts` validate model

‎CHANGELOG.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ include the full version, for example `## 0.7.0-beta.1`.
2424

2525
### Added
2626

27+
- Manage tasks directly from `/bot`: inspect details, open sessions, close idle
28+
tabs, restart workflows, or stop sessions and durably end tracking without
29+
deleting work. Preserve closed tasks as history and skip rediscovery, feedback,
30+
runtime hooks and publication after closure, including missing issue/PR cases.
31+
- Identify blocked, failed and closing issue keys and errors in the runtime
32+
sidebar instead of showing only an anonymous attention counter.
33+
2734
- Add a live BOT RUNTIME sidebar and `/botstatus` report with dispatcher operations,
2835
scheduler scans/retries, queue counts and selected-task details. Keep stale and
2936
unavailable readings explicit; monitor through read-only owner-scoped RPC.

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ installations are not removed by `npm uninstall --global`.
254254
`/botstatus` opens a full text report. Status refreshes every five seconds;
255255
unavailable or stale readings are marked explicitly. See
256256
[runtime panel details](docs/runtime.md#runtime-status-sidebar).
257+
- **Task management:** `/bot` lets you open a session, inspect details, close idle
258+
tabs, restart a stopped workflow, or stop sessions and end task tracking. Closing
259+
tracking preserves all local work and history, works without a surviving GitHub
260+
issue/PR, and prevents rediscovery. See [task management](docs/runtime.md#manage-tasks-from-bot).
257261
- **Progress:** use `/bot` in the TUI, or the CLI's `status`, `scan`, `pause`, and
258262
`resume` commands from the target repository. Closing a PR closes its bot tabs
259263
while retaining session history. Authorized issue comments can continue work

‎docs/advanced.md‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,3 +182,28 @@ API references: [OpenCode 2 plugins](https://opencode.ai/v2/docs/build/plugins),
182182
[GitHub issues](https://docs.github.com/en/rest/issues/issues),
183183
[comments](https://docs.github.com/en/rest/issues/comments),
184184
and [pull requests](https://docs.github.com/en/rest/pulls/pulls).
185+
186+
## Ending task tracking
187+
188+
Use `/bot` → select issue → **Stop and close task**. The owner-scoped RPC is
189+
`automation.github.close` with `{ "key": "owner/repository#123" }`, returning
190+
`{ "accepted": true }` when durable closure is queued or `false` if already closed.
191+
There is no corresponding setup CLI subcommand. This action does not require the
192+
GitHub issue/PR or saved session to still exist. It never deletes local work.
193+
194+
The queue retains phase and history with statuses `closing` and `closed`,
195+
`closeRequestedAt`, `closedAt`, and `closeError`. Interruption of all saved main,
196+
earlier-round and media session IDs is bounded to 15 seconds per request; missing
197+
sessions are ignored, other failures retry no sooner than 30 seconds. Closure
198+
waits for the selected task's in-flight worker and question posts, then interrupts
199+
again to cover a session creation that was already in flight. Checkpoint guards
200+
prevent late results from publishing or reviving the task. Publication/merge
201+
already in flight rejects admission, rather than promising to undo remote effects.
202+
203+
Pending closure is resumed on startup. Keep the queue and Git worktree backups
204+
when upgrading: older plugin builds do not understand these two new statuses.
205+
See [runtime management](runtime.md#manage-tasks-from-bot) for the UI and limits.
206+
207+
While a closure is pending, the dispatcher does not start another worker pass.
208+
An unrelated already-running task can finish; scanning continues for other tasks.
209+
The monitor reports task maintenance until closure completes.

‎docs/architecture.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,10 @@ activity snapshots. Scheduler status retains its existing RPC. The TUI polls bot
7070
independently every five seconds through the connected client; it does not infer
7171
worker activity from queue status alone. These live diagnostics do not add durable
7272
workflow phases or replace the existing ownership keepalive.
73+
74+
Operator task closure is a durable dispatcher operation: `/bot` sends the owner
75+
`automation.github.close`, which records `closing` before interruption and later
76+
`closed`. Closed records remain as history and prevent rediscovery; scans, runtime
77+
hooks, feedback execution and merge monitoring exclude them. Session/worktree
78+
data is retained. See [task management](runtime.md#manage-tasks-from-bot) for
79+
in-flight operation limits and the distinction from closing a TUI tab.

0 commit comments

Comments
 (0)