Repository navigation
Conversation
|
|
Speaking as Kun Chen's firstmate (public): first stamp vs main Contract-class: new-default — main's specified OpenCode path is 1.15.7–1.18.x ( VISION (per rule):
Gates: attestation MATCH ( Waiting on fork workflow approval, not on the author. |
|
Speaking as Kun Chen's firstmate (public): re-stamp of Contract-class: new-default. There is a real version gate, not only a docs claim. VISION: The fleet outlives any vendor — does not align. A detected 1.x install stays on Gates: attestation MATCH ( Waiting on CI, not on the author. |
|
Thanks for adding the version gate. Two changes would make this mergeable:
The rest can stay as it is: the |
bd44dd4 to
fec3902
Compare
@kunchenguid Both changes are in:
OpenCode 1 behaves exactly as today; only OpenCode 2 gets the new path. |
|
Speaking as Kun's firstmate: thanks @nchandar. I re-read head
Contract-class: new-default. A detected OpenCode 2 gets a launch, exit key and plugin surface that main never specified. One small change also reaches 1.x: the launch now runs the resolved absolute VISION: The fleet outlives any vendor moves to mostly aligns now that 1.x and undetected installs keep the specified path and the OpenCode 2 shape is version-gated. My earlier per-rule read stands otherwise. Gates: the attestation matches |
…plugins OpenCode 2 dropped the v1 server-plugin hook API, so the five fm.primary.* plugins now export a default definition with an id and a setup function alongside their legacy OpenCode 1 server export, backed by a new shared lib/fm-opencode2.js helper; the turn-end guard, watch-arm, cd-check, pretool-check, and sessionstart-nudge install their behavior from setup(ctx) on OpenCode 2 and keep the server entrypoint for OpenCode 1. fm-spawn probes the resolved opencode executable's --version once and branches the launch, model flag, reasoning config, exit key, and busy-state plugin off the detected major. A parsed major >= 2 takes the OpenCode 2 shape (no --model, the model pinned through OPENCODE_CONFIG_CONTENT, a raw Ctrl-C exit, the session.execution.* busy plugin); OpenCode 1.x and any undetected or unparseable version fall back to the 1.x shape (--model, 1.x config, /exit) everywhere. The worker busy-state plugin is always provisioned, but OpenCode 1 keeps the pre-port session.status/session.idle plugin so its busy-state wiring is unchanged, and only a major >= 2 gets the session.execution plugin. Adapter and supervision docs, OpenCode 2 live fixtures, and regression tests for the unknown->1.x launch path and the version-gated busy-plugin shape are included.
fec3902 to
7b1b942
Compare
|
@kunchenguid Rebased onto the latest main and re-pushed to clear a merge conflict. This update:
No other behavior changes; the version gate and plugin port are unchanged. |
|
Superseded by #7336, which landed OpenCode 2 support. Closing. |
Intent
The OpenCode 2 primary-plugin port is implemented and committed on branch fm/opencode2-verify-v1, verified to load clean on OpenCode 2.0.21 - all five fm.primary.* plugins now export a default definition with an id and a setup function, plus a new shared lib/fm-opencode2.js helper, because OpenCode 2 dropped the v1 server-plugin hook API.
Upstream firstmate at kunchenguid/firstmate has no OpenCode 2 support yet, so this work should be contributed back as a pull request.
Open that pull request.
What Changed
opencodeexecutable and probing--version, falling back to 1.x when undetectable) and key the launch shape, plugin shape, and recorded exit mechanics off that single resolved version: 2.x drops the top-level--modelflag and rides the model/effort throughOPENCODE_CONFIG_CONTENT(model pinned globally and on the build agent), while 1.x keeps--modeland theagent.build.variant-only config (bin/fm-spawn.sh)..opencode/plugins/lib/fm-opencode2.jsadapter and port all fivefm.primary.*plugins to export a default definition with anidandsetup(ctx), subscribing tosession.execution.*events and hookingtool.execute.beforethrough the OpenCode 2 server-plugin API that replaced the dropped v1 hooks; the turn-end guard fires only on root-session turn ends and is gated onnotifyTurnEnd.fm-controlexits a 2.x composer with a raw Ctrl-C and a 1.x/undetected composer with/exit, and arm the busy-state contract on every detected major so OpenCode 1 keeps its existing wiring; update supervision/backend docs, add the port-scope doc, and extend the spawn-dispatch, busy-adapter, and control test suites.Risk Assessment
Testing
Drove the OpenCode 2 port against the real product on this host (OpenCode v2.0.26, node v26).
opencode plugin listloads all five committed fm.primary.* plugins cleanly with their declared default-export ids; an isolated adversarial control confirms OpenCode 2 surfaces the default export's id (valid plugin → its id, legacy v1 shape →-), so the positive result is meaningful. A node contract check confirms all five plugins, plus the real fm-spawn-generated v2 busy-state plugin, export {id, setup} and run setup() without throwing. The author's focused suites pass: fm-spawn-dispatch-profile (version-gated model/effort config shape, --model only on 1.x, unknown version→1.x, shared probe/launch executable, busy-plugin per major) and fm-control (exit key /exit on 1.x vs raw Ctrl-C on 2.x). The three OpenCode busy-adapter cases — skipped by an early abort in that file — were driven directly and pass, including the secondmate turn-end gating fix from 7b1b942. Visual evidence is N/A: this change is a CLI/plugin-runtime port with no rendered UI surface. One failure (a Claude secondmate Stop-guard case in fm-busy-adapter-wiring.test.sh) is environmental — the guard exits 0 because FM_HOME defaults to the host's real ~/github/firstmate and the temp sm-home isn't a recognized git scope — and lives in code byte-identical to base, so it is pre-existing and unrelated to the OpenCode 2 change. The upstream-PR half of the intent is owned by the PR phase, not this test phase.opencode plugin liston real v2.0.26 lists all five with declared ids (opencode2-plugin-list.txt); node contract check confirms {id,setup} and setup() does not throw-, proving the id reflects the real default exportbash tests/fm-spawn-dispatch-profile.test.shpasses test_opencode_threads_model_and_effort_variant and test_opencode_without_effort_keeps_launch_config_unchanged (real fm-spawn + fake opencode repor…bash tests/fm-control.test.shpasses 'a recorded OpenCode major picks /exit (1.x) or raw Ctrl-C (2.x)' (46 ok, rc=0)Evidence: opencode v2.0.26 plugin list — all five fm.primary.* load clean
Source: opencode v2.0.26 plugin list — all five fm.primary.* load clean
Evidence: Real fm-spawn-generated OpenCode 2 busy-state plugin (export default {id,setup,server})
Source: Real fm-spawn-generated OpenCode 2 busy-state plugin (export default {id,setup,server})
Evidence: node default-export contract check across all five primary plugins
Evidence: OpenCode busy-adapter cases driven directly (skipped by suite's early abort)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
⏭️ **Rebase** - skipped
bin/fm-spawn.sh- merge conflict rebasing onto refs/remotes/no-mistakes-push/fm/opencode2-pr-v1bin/fm-spawn.sh:4946- The OpenCode 2 busy-state plugin generated in fm-spawn.sh (the major>=2 heredoc, lines ~4909/4946/4968) calls touchTurnEnded() unconditionally on every session.execution.* terminal event and on session.idle. Unlike the retained OpenCode 1 plugin below it (line 4999:const notifyTurnEnd = $busy_notify_turnend;, gated touch at 5030) and the Claude Stop wiring (line 4822), it never interpolates or honors busy_notify_turnend. For an OpenCode 2--secondmatelaunch busy_notify_turnend is set false (line 4721) yet WIRING_HARNESS staysopencode, so this 2.x branch runs and emits turn-ended touches the 1.x plugin suppresses — spurious watcher wake notifications that break the stated secondmate contract ('a secondmate's hooks ... do not touch the parent's turn-ended marker', line ~4712). Remedy restores parity with the 1.x plugin, not new scope: interpolateconst notifyTurnEnd = $busy_notify_turnend;into the 2.x heredoc and wrap bothawait touchTurnEnded();calls inif (notifyTurnEnd).🔧 Fix applied.
2 infos still open:
.opencode/plugins/fm-primary-cd-check.js:78- The OC2 setup-path handlers installCdCheck (fm-primary-cd-check.js:75) and installPretoolCheck (fm-primary-pretool-check.js:75) drop the OC1 server-path gateinput?.tool !== "bash"(cd-check:62, pretool-check:62). They now run the cd/arm seatbelt against any tool whose input/output yields a command-like field via toolCommand(), not just bash. Concrete harm is low (only tools exposing command/cmd/script reach fm-cd-pretool-check.sh / fm-arm-pretool-check.sh, and the script must return code 2 to deny), but it is a real behavioral widening vs OC1 parity. The lib already exports toolName(), so restoringif (toolName(input) !== "bash") return;would re-establish parity; however this may be a deliberate choice if OC2 tool naming is unreliable (gating could fail-open), so the tradeoff is flagged rather than prescribed..opencode/plugins/fm-primary-cd-check.js:31- This change adds a resolvePath() helper to fm-primary-cd-check.js:31 and fm-primary-pretool-check.js:31 that is never called: resolveRoot() in both files (lines 44-48) inlines its own realpathSync/resolve fallback, and the FmPrimaryCdCheck/FmPrimaryPretoolCheck factories inline the worktree resolution too. The helper is dead code introduced by the diff; remove it from both files. (The sibling plugins turnend-guard/watch-arm/sessionstart-nudge do reference their resolvePath, so only these two are dead.)tests/fm-busy-adapter-wiring.test.sh:703- tests/fm-busy-adapter-wiring.test.sh aborts at the Claude secondmate Stop-guard case (test_secondmate_claude_stop_guard_owns_the_stop_verdict, line 703: expected exit 2, got 0). Root cause is environmental: bin/fm-turnend-guard.sh exits 0 because fm_primary_scope_matches fails when FM_HOME defaults to the real ~/github/firstmate and the temp sm-home is not a recognized primary git scope in this gate sandbox. The guard, bin/fm-busy-lib.sh, the test function, and its helpers are all byte-identical between base (e0d95ac) and target (7b1b942), so this reproduces on base and is NOT caused by the OpenCode 2 change. Because the failingfailexits the file, it masked the OpenCode cases later in the file; I drove those three OpenCode cases directly and they pass.opencode plugin liston real v2.0.26 lists all five with declared ids (opencode2-plugin-list.txt); node contract check confirms {id,setup} and setup() does not throw-, proving the id reflects the real default exportbash tests/fm-spawn-dispatch-profile.test.shpasses test_opencode_threads_model_and_effort_variant and test_opencode_without_effort_keeps_launch_config_unchanged (real fm-spawn + fake opencode repor…bash tests/fm-control.test.shpasses 'a recorded OpenCode major picks /exit (1.x) or raw Ctrl-C (2.x)' (46 ok, rc=0)opencode plugin listfrom the worktree on real OpenCode v2.0.26 — all five fm.primary.* plugins load with declared idsopencode plugin listisolated adversarial control — valid {id,setup} plugin shows its id, legacy v1-shape (no default export) shows-node --input-type=module default-export contract check on all five .opencode/plugins/fm-primary-*.js (id string + setup function + setup({}) does not throw)bash tests/fm-spawn-dispatch-profile.test.sh— full pass incl. test_opencode_threads_model_and_effort_variant, test_opencode1_passes_model_flag_and_variant_only_config, test_opencode_probe_and_launch_share_resolved_executable, test_opencode_unknown_version_takes_1x_launch_path, test_opencode_busy_plugin_provisioned_for_every_majorbash tests/fm-control.test.sh— full pass incl. 'a recorded OpenCode major picks /exit (1.x) or raw Ctrl-C (2.x)'Drove the three OpenCode busy-adapter cases directly (test_secondmate_opencode_plugin_closes_without_a_parent_turnend, test_opencode_plugin_semantic_lifecycle, test_opencode_plugin_v2_execution_lifecycle) — all passGenerated the real v2 fm-busy-state.js via fm-spawn (probing opencode 2.0.21) and confirmed its {id:'fm.busy-state', setup} default-export contract loads under node✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.