You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 68a6754
Browse filesBrowse the repository at this point in the historyBrowse files
feat(opencode): resume/reconcile recovery control (M6.5)
A fusion_resume model-facing control and /fusion-resume command that
present the owned or recovered run - run ID, owner, child session,
pending executor request, outstanding-work flags - and name the
recovery capability by mirroring the fusion_reconcile guard exactly:
- available when uncertain with a pending request and a backgrounded
turn or a recorded result (the setttle path vs notification wait is
named);
- busy while delegating or reconciling;
- unavailable elsewhere with the specific cause: retained request with
no live turn and no recorded result; unknown outcome with no retained
request; nothing unsettled.
nextAction routes to fusion_reconcile when exact proof can exist -
including after reload, where the notification may already be recorded
in the session - and documents explicit operator resolution otherwise,
down to the concrete "bun src/workspace/resolve.ts <workspace> <run-id>
<request-id | --no-request-id> --confirm-stopped" invocation with the
retained request ID. activeTurnReattach is a literal "refused" with its
reason rather than an implied capability; healthy runs state no
recovery is owed.
Unit-pinned across healthy, backgrounded-miss, retained-intent-without-
proof, reload continuity, and scout-only states plus non-supervisor
refusal; the model-free live smoke shows fusion-resume registered in
the installed host's command surface (v2.2.5). Recovery after a restart
that lost the completion notification stays blocked pending upstream
parent completion (anomalyco/opencode#36349); cross-session
presentation and a real restart recovery run join the M6.6 parity
coverage list. 371 tests and type checking pass.
| Configure and model validation (M6.2) |`fusion_configure` validates provider/model/variant against the live catalog; configured model reaches scout and executor submissions; shared price/cohort metadata reported | Unit tests; model-free live catalog + configure-unknown-refused/real-applied (v2.2.3); live scout child ran on the configured model (`opencode-go/glm-5.3-flash`), child session model observed |
40
40
| Commands, persistent mode, clean (M6.3) |`fusion-run`, `fusion-mode`, `fusion-status`, `fusion-stats`, `fusion-clean` native commands; mode gates mutation tools per session; clean releases settled resources only | Unit tests (registration, /fusion-run prompt injection, mode gating + persistence, clean settled/foreign/uncertain); model-free live: all five commands in `/api/command` and `fusion-status` invoked through the command API (v2.2.3) |
41
41
| Completion hooks, bounded nudges (M6.4) | Turn-end bus events feed the shared completion policy; nudges sent via session.prompt; interrupted/failed never nudge; runs settle per mode. Review follow-ups: Fusion-turn binding, event dedupe, persisted budget, incomplete reporting, retryable delivery, final-part summary detection; unresolved-work hold across all terminals (interrupt/fail included); budget + settlement + incomplete persist across reload; missing-prompt hosts consume nothing | Channel pinned live (v2.2.3 execution/text event shapes); unit-pinned nudge bound (2), summary suppression, backgrounded suppression, interrupt settle, agent binding, dedupe, reload persistence (incomplete + completed phase), delivery-failure retry and persistence-failure hold; live early-settle observation deferred to the M6.6 parity run |
42
+
| Resume/reconcile control (M6.5) |`fusion_resume` tool and `/fusion-resume` command present owner, pending request, outstanding work, and reconciliation capability (available/busy/unavailable mirroring the `fusion_reconcile` guard); routes to `fusion_reconcile` when exact proof can exist (across reload too); documents concrete operator resolution (`bun src/workspace/resolve.ts ... --confirm-stopped`) otherwise; `activeTurnReattach` refused with reason | Unit-pinned across healthy, backgrounded-miss, retained-intent-without-proof, reload continuity, and scout-only states, plus non-supervisor refusal; model-free live command registration on the installed host (v2.2.5). Recovery after a restart that lost the completion notification stays blocked pending upstream (#36349); cross-session "not attached" presentation and a real restart recovery run join M6.6 parity coverage |
42
43
| Complete OpenCode Fusion workflow | No | Not ready to install/use |
43
44
44
45
The core extraction is partial: the shared controller owns task transitions,
45
46
pending and uncertain state, delegation guards, and the main delegation sequence;
46
47
the adapters still own native worker handles, persistence, and presentation.
47
-
The experimental OpenCode entrypoint exposes delegate, scout, status, reset,
48
-
and reconciliation tools, native commands, and example agent files. OpenCode
48
+
The experimental OpenCode entrypoint exposes delegate, scout, status, stats,
49
+
resume/reconciliation, and reset tools, native commands, and example agent
50
+
files. OpenCode
49
51
plugin storage and the shared ownership registry retain the workspace owner,
50
52
original task, budgets, child ID and pending turn across reloads. The SQLite
51
53
workspace coordinator excludes concurrent owners across processes. The package
message: "The workspace Fusion record is not attached to this session; recovery happens in its owning session or through explicit operator resolution.",
reattachReason: "Fusion never reattaches another session's executor turn into this session.",
728
+
nextAction: `Call fusion_resume in the owning session (${owned.manifest.owner.supervisorId}), or after inspecting the worker and workspace run: bun src/workspace/resolve.ts ${workspace}${owned.manifest.runId}${owned.manifest.pending?.requestId??"--no-request-id"} --confirm-stopped`,
if(outstanding.delegating||outstanding.reconciling)reconcile={capability: "busy",detail: "another executor transition is in progress"};
739
+
elseif(run.controller.uncertain&&pendingRequest&&(outstanding.backgroundPending||outstanding.recordedResult))reconcile={capability: "available",detail: outstanding.recordedResult ? "the executor's recorded result can be settled into the run" : "the executor's completion notification is awaited, or may already be recorded in this session"};
740
+
elseif(run.controller.uncertain&&pendingRequest)reconcile={capability: "unavailable",detail: "the retained executor request has no live turn and no recorded result; automatic retry stays disabled while the outcome is unknown"};
741
+
elsereconcile={capability: "unavailable",detail: run.controller.uncertain ? "the outcome is unknown with no retained request" : "nothing is unsettled; the run owes no recovery"};
? "Call fusion_reconcile to adopt the executor's exact completion. If it reports no matching notification, inspect the worker and workspace, and after confirming the worker stopped run: "+resolveCommand
744
+
: reconcile.capability==="busy"
745
+
? "Wait for the in-flight executor transition to finish, then call fusion_resume again."
746
+
: run.incomplete
747
+
? "The Fusion run is incomplete: the supervisor stopped before finishing. Take over the task yourself, or call fusion_reset to finish the run."
748
+
: run.controller.uncertain
749
+
? "No exact completion proof can be adopted. Inspect the worker session and the working tree, and after confirming the worker stopped run: "+resolveCommand
750
+
: "No recovery is owed; the run is active in this session. Continue the protocol and call fusion_reset when it finishes.";
751
+
returnJSON.stringify({ ...run.controller.state,runId: run.runId,owner: run.handle.owner,model: run.model,childSessionID: run.handle.reference?.id, pendingRequest, outstanding,uncertain: run.controller.uncertain,reconcile: reconcile.capability,reconcileDetail: reconcile.detail,activeTurnReattach: "refused",reattachReason: "OpenCode cannot reattach a live or interrupted executor turn back into this session; recovery routes through the completion notification (fusion_reconcile) or explicit operator resolution.",incomplete: !!run.incomplete, nextAction });
752
+
}
715
753
functionstatsContent(sessionID: string): string{
716
754
construn=runs.get(sessionID);
717
755
if(!run)return"No Fusion run in this session.";
@@ -1000,6 +1038,13 @@ export default {
1000
1038
}finally{run.reconciling=false;}
1001
1039
},
1002
1040
});
1041
+
editor.add({
1042
+
name: "fusion_resume",description: "Show this Fusion run's recovery state: owner, pending request, reconciliation capability, and the next valid action. Refuses outright anything it cannot honestly promise, including mid-turn reattachment.",input: {type: "object",properties: {},additionalProperties: false},options: {codemode: false},
name: "fusion_status",description: "Show the current Fusion run state.",input: {type: "object",properties: {},additionalProperties: false},options: {codemode: false},
1005
1050
asyncexecute(_input,context){
@@ -1109,6 +1154,11 @@ export default {
1109
1154
description: "Show the current Fusion run's budgets",
0 commit comments