Repository navigation
fix: preserve OpenCode V1 hooks and support V2 - #982
Merged
Merged
Conversation
|
No findings. The PR description includes a representative built-CLI, real OpenCode V1/V2 host verification, satisfying the required end-to-end testing record for runtime changes. I did not run or build PR code, as requested. |
SaulMoro
force-pushed
the
fix/opencode-v2-hooks
branch
from
October 6, 2026 15:36
6abb9bc to
ff96bcc
Compare
The PR description includes a representative built-CLI real-host verification for V1 and V2, satisfying the required end-to-end testing record. |
|
No findings. The earlier Windows issue is resolved: enterprise hooks now use The PR description includes representative built-CLI, real OpenCode V1 and V2 host verification, satisfying the required end-to-end testing record for runtime changes. I did not run or build PR code, as requested. |
jeff-r2026
approved these changes
Oct 7, 2026
This was referenced Oct 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserves OpenCode 1.18.23 and adds V2 compatibility, verified with 2.0.23. Refresh generated plugins with
teamai hooks injectorteamai pull, then restart OpenCode.Type of Change
Evidence
Plugin must export a default definition with an id and an effect or setup function.The original-module regression failed with an undefined default export; V2 prompt dispatch and native shell attribution also failed before implementation.After: Actual V1 1.18.23 and V2 2.0.23 hosts loaded the CLI-installed plugin in isolated HOME/XDG directories. Each session creation produced exactly one
session-startwith the host session id and canonical cwd, and exactly one enterprise shell-command marker. V2plugin.listconfirmedteamai.hooksandteamai.agent.start-proofactive.Test Plan
Rebased onto
origin/main3f11504(after #971, #974, #986) without conflicts; checks below were rerun on the rebased head.npm run buildnpx tsc --noEmitnpm run lintnpx vitest run— 8,103 passed, 20 skipped.npx vitest run opencode-hooks session-id— generated original ESM, both entrypoints, event payloads/matchers, aliases, task links, cleanup, enterprise replacement/removal, thecmd.exespawn onwin32(failed before the fix) and nonfatal subprocess errors.a8957a8):TEAMAI_OPENCODE_V2_BIN=/Users/pw-smoro/.opencode/bin/opencode2 npx vitest run --config vitest.e2e.config.ts opencode-hooks— 2 passed. The built CLI executeshooks inject; real hosts serve and create sessions; a capture executable verifies spawned dispatch argv/STDIN, while the enterprise command actually appends its marker.npm run test:e2e(pre-rebase): 557 passed, 26 skipped, 6 failed, all six also failing at the then-basea8957a8. Five werestats-recall-dry-run; after rebasing onto fix(dry-run): allow stats and recall previews after #970 #986 that file passes (7/7). The remaining one,self-mode-worktrees-808(untracked.teamai/last-fetch.jsonassertion), is unrelated and was not rerun. The full e2e suite was not rerun after the rebase.Related Issues
Reported OpenCode V2 server-plugin error; no linked issue.
Notes for Reviewers
Branch reviewed against
a8957a8(parallel Standards/Spec review: 0 findings in each axis). The commits merged since (#971, #974, #986) touch dry-run, recall scoping and roles, not OpenCode hooks or session-id; they share onlydocs/usage-guide*.md, and those hunks merged cleanly. EN/CN usage docs and agent troubleshooting updated.V2 smoke testing opts in through
TEAMAI_OPENCODE_V2_BIN; default CI retains the pinned V1 binary. Capture verifies adapter delivery, not remote provider side effects. V2 supplies its native shell session variable because its shell hook has no session id. Enterprise hooks previously ran through Bun's$`sh -c …`, which also neededshon PATH; spawning directly now picks the platform shell (Codex review finding). The Windows path is unit-tested only, not run on a Windows host.Merge Danger
Door: two-way
Regenerate plugins after rolling back. No schema or data migration.
Blast Radius: OpenCode
Built-in/enterprise hooks and native shell attribution only; other tool adapters are unchanged.