Repository navigation
feat(opencode)!: agent_control — full subagent control on the agent-progress plugin (supersedes #313) - #320
Conversation
…rogress plugin (#302 architecture) Add a second native tool, agent_control, to .opencode/plugins/agent-progress.ts: list / interrupt / delete / wait / confirm_stopped. interrupt stops a RUNNING session without deleting it (ctx.session.interrupt); delete drives `opencode session delete` (session + child sessions); wait is a BOUNDED ctx.session.wait; confirm_stopped re-reads the transcript and ASSERTS no new turns (the CONFIRM-it-stopped rule). interrupt/delete/wait REQUIRE an explicit session id (never `all`) and report what was stopped, so a session another slug owns is never silently killed. Pure TypeScript: the control half's ONE execFile drives the opencode CLI (a tool, like `gh` in coord.ts), never a .sh — no marketplace pin. Also: the gate gains static + unit control coverage (closed action set, the explicit-session rail, a real read-only SQLite fixture, refusals) and the live layer now calls BOTH agent_progress and agent_control list (read-only — the test never interrupts/deletes a real session); charly.yml runs the gate in verify; instructions.md documents both tools; AGENTS.md gains the dispatcher row.
The live snippet now normalizes the tool return (a plain content string in Code
Mode, or { content }) so the model-call assertions read the real report.
…ew round 1)
- Delete CONFIRM_WINDOW_S (zero references; its comment described a window the
confirmStopped implementation does not have — an R1 comment/code divergence).
- KNOWN_TOOLS was zero-reference: wire it via unknownTools(), which the report now
uses to surface any tool outside the known set ('tools+' line); the gate asserts it.
- Move the delete children query into CONTROL_SQL (named SQL, R4).
…ete dead code (review round 2)
R3 — extract ONE shared helper `collectAnalyses(db, {now, windowMin, sinceMin, limit, signal})`
plus `VERDICT_RANK`/`sortByVerdict`/`resolveLimit`/`resolveSinceMin` and route BOTH
`agent_progress` (all) and `agent_control` (list) through them; drop the duplicated
`CONTROL_SQL.turns` and reuse `SQL.counts` in `turnStats` (ONE counts query).
R1 — honour the schema-advertised `all` input via `resolveTarget` (`all:true` forces the
whole set; `all:false` REQUIRES an explicit `session`).
B14(a)/R5 — delete the zero-caller `SQL.lastEvent` and the unused `stale` local in
`classify()`.
R10 check-coverage — the gate now asserts resolveTarget honours `all`, the limit/sinceMin
clamps, collectAnalyses enumerates the real store and stops on abort, and sortByVerdict
orders loudest-first.
…verging comments, gate `wait`+`confirm_stopped` (review round 4)
R1 — the report printed `artifact merged · gh pr merge …` while the verdict said
`no artifact` (the display used `a.artifacts`, the verdict `a.recentArtifacts`). A RECENT
artifact in a stale session is now COMPLETION evidence → DONE ("landed an artifact … then
quiet"), and when only OLDER artifacts exist the display labels them
"(none recent — transcript history)" — display and verdict can no longer contradict.
R1 — the `reportStatus` doc-comment claimed BOTH classifier and report call it; only
`classify` does. Comment corrected to match the code.
R1 — the analyzeSession artifacts fallback comment claimed a short-session rationale; the
fallback is unconditional (and it is LONG/truncated tails that hit it). Comment corrected.
B12 — Layer B now drives `runControl({action:"wait"})` through a stubbed ctx.session.wait
for BOTH the idle and the bounded-timeout result (and the missing-primitive refusal), plus
the `confirm_stopped` ACTION (STOPPED and STILL RUNNING vs the baseline) — a path with no
test fails to exist. Gate: 113 unit / 121 live, 0 FAIL.
…ove the verify step runs (review round 5) B12 — the round-4 `recentArtifact → DONE` arm shipped untested (every artifact fixture also had finish=stop, so DONE came from reportStatus regardless). Added the discriminating fixture: stale + RECENT artifact + NO finish=stop ⇒ DONE, using the REAL store tool-input shape so the artifact is truly extracted. Verified it FAILS without the arm (2 assertions). R1 — the DONE definition in .opencode/instructions.md and the agent_progress tool description now documents the artifact-completion case (a landed artifact with the session then quiet), matching classify. R10/B6 — the added verify step is proven through the charly task verify path it is wired into: `[pass] check — the agent-progress monitor+control plugin … exit=0`. Gate: 116 unit / 124 live, 0 FAIL.
Review — PASSHead SHA: Security screen: PASS — no secrets/egress/eval; the one Checklist: All applicable rules PASS or NA. Body is complete and internally consistent (summary accounts for all 5 files; honest Verdict: PASS ollama-cloud/deepseek-v4.1-flash — action-review. |
…e-identical to opencharly/opencharly#320) (#153) * feat(opencode)!: agent monitor + control plugin (agent_progress + agent_control) Byte-identical to opencharly/opencharly: .opencode/plugins/agent-progress.ts (agent_progress monitor + agent_control control), scripts/check-agent-progress.mjs (A static / B unit incl. the RCA regression / C live), and the instructions.md section documenting both tools. Pure TypeScript — no .sh, no marketplace pin. * fix(opencode): remove dead control constants + wire KNOWN_TOOLS (review round 1) Byte-identical to opencharly/opencharly: delete CONFIRM_WINDOW_S (zero refs), wire KNOWN_TOOLS via unknownTools(), move the delete children query into CONTROL_SQL. * fix(opencode): one shared collector + counts query, honour `all`, delete dead code (review round 2) Byte-identical to opencharly/opencharly#313: R3 (ONE collectAnalyses + ONE SQL.counts, no CONTROL_SQL.turns), R1 (`all` honoured via resolveTarget), and the dead-code removal (SQL.lastEvent, the unused `stale` local). Gate coverage added. * fix(opencode): reconcile the artifact display/verdict, correct two diverging comments, gate `wait`+`confirm_stopped` (review round 4) Byte-identical to opencharly/opencharly#313: R1 (display/verdict artifact reconciliation + two corrected doc comments) and B12 (Layer B drives the `wait` and `confirm_stopped` control paths). Gate: 113 unit / 121 live, 0 FAIL. * fix(opencode): pin the artifact-completion DONE arm + document it; prove the verify step runs (review round 5) Byte-identical to opencharly/opencharly (successor to #313): B12 (the artifact-completion DONE arm is now pinned by a discriminating fixture), R1 (the DONE definition documents the artifact-completion case), and the charly task verify path proof. Gate: 116 unit / 124 live. --------- Co-authored-by: Andreas Trawoeger <[email protected]>
* chore(pins)!: advance the unit-8 pins and re-anchor the census The umbrella pin wave for opencharly/spec#304 unit 8 (#1024). Eight pins move: charly (the fleet), the three distros (their own waves), plugin-check (#149), plugin-substrate (#42/#43/#44/#45/#46/#47), sdk (#514) and spec (#320/#321). The census follows the body: three dulling rows re-anchor to the plugin module, with the three KEEPER citations (#VmBackend, #VmBackendName, #VmKrun) correctly staying in spec - a blanket rewrite moved them and the control caught it. The D-PAT census lowers the twin row and records the plugin union: the six D-PAT-2 dup findings the deletion created are gone because plugin-substrate#47 removed the duplicate defs. TODO.md row 2.1 reads Units 1-8 of 11 with the unit nine legs, its counts (KindValueDefs 3 -> 2, five bodies remain) and its three lessons; the ledger carries the P01 row (3 units left) and the §9 record. Measured on the served tree: the assembled graph builds clean, the corpus sweep moved zero verdict classes, currency 8 of 409 -> 3 of 409, the design controls and the 48-step pin gate green. Assisted-by: DeepSeek Harness ollama-cloud/deepseek-v4.1-flash (fully tested and validated) * docs: the four gitlinks and where the other four went (review round) * docs(ledger): the P01 state column names unit 8 (review round) * docs: the rollback sentence says four (review round) --------- Co-authored-by: aitrawog <[email protected]>
Summary
Supersedes #313 (auto-closed at the 5-verdict threshold — a policy bound, not a new finding). Every finding from every BLOCK verdict on #313 is fixed in ONE commit on this fresh branch off current
origin/main.Add full subagent CONTROL to the OpenCode agent-monitor plugin, and land the monitor + control surface + its docs + the skill. Builds on the operator directive in #302 (OpenCode plugins are pure TypeScript — no
.sh, nomarketplace-pin dependency)..opencode/plugins/agent-progress.tsregisters TWO native V2 tools:agent_progress(MONITOR, read-only) — per session: turns, span, last-activity age, tool mix, the LAST action, artifact hints, and a verdict WORKING / IDLE / LOOP / DONE. A "message" is an ASSISTANT TURN, never a stall signal.agent_control(CONTROL):list/interrupt/delete/wait/confirm_stopped. Mutating actions require an EXPLICITses_…id (requireExplicitSessionrefusesall/blank/non-ses_) and report what they stopped;waitis bounded (DEFAULT_WAIT_TIMEOUT_S).listis read-only.Pure TypeScript — the ONE
execFiledrives the opencode CLI (a tool, likeghincoord.ts), never a.sh; nomarketplacepin.Also in the umbrella:
scripts/check-agent-progress.mjs(the 3-layer gate),charly.yml(verify runs the gate),.opencode/instructions.md(both tools),AGENTS.md(the dispatcher row). Skill sourcelayer-charly-internals#66; byte-identical dotgithub copy.github#151 (successor #152).Every finding from #313, fixed in ONE commit
The round-5 head (
8c2f010, plus theupdate-branchmerge) fixes the surviving blocks:recentArtifact → DONEarm shipped untested. Every artifact fixture also hadfinish="stop", soDONEcame fromreportStatusregardless. Added the discriminating fixture: stale + a RECENT artifact + nofinish=stop⇒DONE, built with the REAL store tool-input shape ({command: …}) so the artifact is genuinely extracted. Verified it fails without the arm (2 assertions) and passes with it.DONEdefinition diverged fromclassify..opencode/instructions.mdand theagent_progresstool description now document the artifact-completion case ("a final reportfinish=stop, no pending action, or a landed artifact with the session then quiet"), matching the code.charly task verifyrun in which the added step executes and PASSES ([pass] check — the agent-progress monitor+control plugin … exit=0). The earlier "cannot load / umbrella charly.yml cannot load: version stamp dropped by 803d411 but the loader requires it #306" framing is dropped — umbrella charly.yml cannot load: version stamp dropped by 803d411 but the loader requires it #306 is CLOSED (the umbrella rootcharly.ymlcarriesversion: 2026.261.1747onorigin/main), and the loader error seen locally was a worktree artifact (the linked worktree'scharly/submodule is empty), not the PR.Carried from earlier rounds (all still in this tree): R3 — ONE
collectAnalysesloop + ONEsortByVerdict+ ONESQL.countsquery shared by both branches,CONTROL_SQL.turnsdeleted; R1 —resolveTargethonours the schema-advertisedall; R1 — the artifact display/verdict reconciled (recent artifact ⇒DONE; older-only ⇒ labelled(none recent — transcript history)); B14(a)/R5 —CONFIRM_WINDOW_S,SQL.lastEvent, and the unusedstalelocal deleted.How tested
All commands executed on the new head
f58a041(this branch).The
charly task verifypath RUNS THE ADDED STEP AND IT PASSES — the load failure seen earlier was the linked worktree's emptycharly/submodule (a worktree artifact), not the PR. Reproduced by giving the task tree a populatedcharly/import (ln -s …/charly charly):The added step (
check-agent-progress.mjs) executes through the wired verify path and returnsexit=0. The 3 remaining failures are the scratch tree's absent submodules (FAIL: suspiciously few submodules (0)), not this PR's step — on a full umbrella checkout they are the routine pinning gate.The gate — Layer A + B, on this head:
The round-5 coverage (the discriminating B12 fixture + the R1 docs):
The fixture was proven to fail without the arm (temporarily commenting it out yields
got "IDLE"on both assertions).The earlier rounds' coverage (shared helper + control dispatch + display reconciliation):
Layer C — the REAL opencode binary (v2.0.19), live-or-skip, on this head:
124 PASS / 0 FAIL with the live layer on this head.
A REAL
agent_progressrun against the live store — the COMPLETE output of ONE invocation:A REAL
agent_controllistrun — the COMPLETE output of ONE invocation (the FIRST line is the table header,formatControlList's non-empty branch — there is noagent_control listbanner for a populated result; the soleagent_control listliteral is the empty-case message):R3/R5 dead-code self-test:
grep -c 'SQL.lastEvent\|const stale '→0; the onlyCOUNT(*) AS turns … MAX(time_created)occurrence isSQL.countsitself.The sibling opencode gates still PASS on this head:
Rulebook compliance
git-workflow,plugin,agents,skills,marketplace,strict-policy.charly/submodule) — not the PR; umbrella charly.yml cannot load: version stamp dropped by 803d411 but the loader requires it #306 is CLOSED and the stamp is onmain. TheDONEdocs now matchclassify; the artifact display/verdict contradiction is fixed.collectAnalyses+ ONEsortByVerdict+ ONESQL.counts, shared by both branches;CONTROL_SQL.turnsdeleted.CONTROL_ACTIONS,DEFAULT_WAIT_TIMEOUT_S,DEFAULT_LIMIT,DEFAULT_SINCE_MIN,VERDICT_RANK,SQL,CONTROL_SQL;waitbounded.CONFIRM_WINDOW_S,SQL.lastEvent, the unusedstalelocal are gone.charly task verifyrun pastes the added step executingexit=0; the unit + live gates are pasted. The full pinning gate did not pass in the scratch task tree (it lacked the submodules the three pinning steps require) — reported, not claimed as green./bin/false; the live layer drives the REAL binary.f58a041.RESOLVED — superseded by this PR; the four surfaces are updated.Change classification
.opencode/*,scripts/check-*.mjs,charly.yml,AGENTS.md) — code/config, not docs-only.charly task verify(the added step executesexit=0) +scripts/check-agent-progress.mjs(A/B/C — 116 unit, 124 live, on this head) + the sibling opencode gates.agent_progress+agent_control list) ran live against the real opencode binary and the real store, with retained output; the repository'scharly task verifyexecuted the added stepexit=0, but the FULL gate did not pass (the scratch task tree lacked the submodules its three pinning steps need), so the "fully tested and validated" tier is not claimed.Relates to #302 (the pure-TypeScript architecture directive). Skill source
opencharly/layer-charly-internals#66 (projection consumer legopencharly/marketplace#380); byte-identical dotgithub copyopencharly/.github#152.Agent:
agent-monitor-control· sessionses_f13e97f62ffebD0x2sHlT4KW19Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)