Repository navigation
Open
Description
Why
OpenCode 2.2.1+ ships a native opencode.goal plugin and /goal (PR anomalyco/opencode#59437). Its goal data is stored in plugin-private ctx.storage and exposed through the opencode.goal RPC (get/changed).
Our V2 Loop guard in src/source/opencode2/native-companion.js only checks ByBrawe Goal's .opencode/goals/<session-hash>.json shard. After decoupling Loop installation from @bybrawe/opencode-goal (PR #194), many users will have native OpenCode Goal but not the ByBrawe plugin. The existing guard cannot detect an active or paused built-in Goal, so competing continuation loops in a shared session are a risk. This is a code-confirmed detection gap, not yet an end-to-end reproduced collision.
Acceptance
- On OpenCode 2.2.4 with only Loop external plugin installed, inspect native Goal state through the host-supported public RPC/API, not another plugin's private storage. If an active native Goal owns a session, Loop cannot admit prompt-producing work in that session. Treat paused unfinished Goal conservatively until explicit ownership rules are agreed.
- Make admission fail closed when Goal ownership is uncertain without permanently blocking old hosts that have no native Goal RPC.
- Recheck ownership directly before each prompt admission and across session switch, restart and compaction boundaries. Host must never receive duplicate autonomous turns from Loop and native Goal.
- Test native-only, Loop-only, Goal-active, Goal-paused, Goal-complete and separately installed ByBrawe Goal scenarios, Windows TUI/Desktop/CLI as supported.
- Keep Loop standalone: no npm dependency on ByBrawe Goal; do not override native
/goalor alter native Goal state.
Source evidence:
- OpenCode native Goal: https://github.com/anomalyco/opencode/blob/dev/packages/core/src/plugin/goal.ts
- Native Goal RPC: https://github.com/anomalyco/opencode/blob/dev/packages/schema/src/goal.ts
- Current Loop guard: https://github.com/ByBrawe/opencode-loop/blob/main/src/source/opencode2/native-companion.js
- Decoupling PR: fix: make Loop fully standalone; remove Goal combo install and release coupling #194
Metadata
Metadata
Assignees
Labels
No labels
Activity
docs(safety): warn native OpenCode Goal overlap is not yet guarded (#195
fix: make OpenCode Loop fully standalone and repair uninstaller (#194)
ByBrawe commentedon Oct 30, 2026
Confirmed public API path (Oct 30)
Checked current OpenCode source:
@opencode/pluginPromise Context exposesctx.rpcas a callable and.register(packages/plugin/src/promise/rpc.ts). Its RPC client routesctx.rpc(definition).get({sessionID})by definition ID and method (packages/client/src/promise/rpc.ts), using the host to validate the native Goal's real input/output schemas. Native Goal registers IDopencode.goal, methodget, returningnullor{status: 'active'|'paused'|'complete', ...}(packages/schema/src/goal.ts). A host with no native Goal returns structuredrpc.unavailable(packages/core/src/rpc.ts).This provides a possible public read-only ownership probe without importing third-party Goal or accessing plugin-private storage. Verify the portable definition schema, old-host availability, location binding and error normalization in a real OpenCode 2.2.4 host test before using it in production. Keep fail-closed behavior for unexpected errors;
rpc.unavailablealone should not block Loop on older hosts. Check ownership both at advance and immediately before prompt admission after preflight; avoid duplicate autonomous turns. Do not mutate the native Goal and do not assume an RPC call is atomic with admission. Separate tests for absent/active/paused/complete/error and host restart are required.fix(v2): probe built-in OpenCode Goal ownership via read-only RPC (#195)
fix(v2): gate every Loop admission on native and ByBrawe Goal session…
fix(v2): wire native OpenCode Goal RPC into standalone Loop setup (#195)
test(v2): native Goal RPC ownership, disabled host, pause and admissi…
build(v2): sync deterministic Bun src/native.js bundle for native Goa…
build(v2): sync deterministic Bun src/server.js bundle for native Goa…
fix(v2): ignore orphaned ByBrawe Goal files after verified standalone…
fix(v2): only reserve legacy Goal sessions while its plugin is instal…
fix(v2): only reserve legacy Goal sessions while its plugin is instal…
test(v2): removed Goal's orphaned shard cannot block standalone Loop (#…
build(v2): update reproducible native Goal ownership bundles (#195)
build(v2): update reproducible native Goal ownership bundles (#195)
4 remaining items
build(v2): sync verified Bun native Goal host-compat bundles (#195)
build(v2): sync verified Bun native Goal host-compat bundles (#195)
build(v2): sync verified Bun native Goal host-compat bundles (#195)
build(v2): sync verified Bun native Goal host-compat bundles (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): decode public OpenCode plugin.list wrapped data response (#195)
fix(v2): reserve active native Goal sessions and ignore orphaned Goal…
release(loop): 0.6.10 standalone OpenCode 2, native Goal guard and TU…
ByBrawe commentedon Oct 31, 2026
Shipped mitigation, but not full acceptance: Loop 0.6.10 includes PR #196: a public read-only
opencode.goalRPC query before Loop prompt admission, active/paused reservation, fail-closed unknown states, older host fallback, and no dependency on third-party ByBrawe Goal.scripts/native-coexistence-test.mjsverifies absent/active/paused/complete/invalid and unavailable RPC behavior with a mocked OpenCode 2.2.4 context, and the 0.6.10 published npm/real-host release gate passed.Still open: the issue specifically asks for an actual OpenCode 2.2.4 host native-only/Loop-only/Goal-active/Goal-paused session admission test across restart/compaction, and no duplicate autonomous turn under real scheduling. Mocked RPC contract and release notes do not prove atomic admission across independent plugins, or Desktop parity. Follow up with a deterministic real 2.2.4 host replay and keep recommending separate sessions.