Skip to content

fix(opencode): export plugin factory instead of object default (#16245) - #16270

Closed
adityachaudhary99 wants to merge 1 commit into
stablyai:mainfrom
adityachaudhary99:fix/object-default-export-breaks-opencode-16245
Closed

adityachaudhary99 wants to merge 1 commit into
stablyai:mainfrom
adityachaudhary99:fix/object-default-export-breaks-opencode-16245

Conversation

@adityachaudhary99

Copy link
Copy Markdown
Contributor

REPO: stablyai/orca | BRANCH: fix/object-default-export-breaks-opencode-16245 | BASE: main | HEAD: adityachaudhary99

TITLE: fix(opencode): export plugin factory instead of object default (#16245)

BODY:
Closes #16245
Also addresses #15897 (same defect, currently labeled os:linux)

The shipped orca-opencode-status.js ended in an object default export, but opencode plugin loader calls the default as a factory function - so every opencode launch from an Orca terminal threw TypeError: fn3 is not a function.

  • getOpenCodeFamilyPluginSource() now emits the factory itself (async (_ctx) => ({ event, dispose })) instead of an { id, server } wrapper object
  • Hook behavior is unchanged: calling default(input) yields exactly the hooks object the named export always returned
  • hook-plugin-module-contract tests updated to pin the callable-default contract and guard against regression to an object export

Platform-neutral fix - affects Windows/macOS/Linux equally, matching both reports.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 13498478-d302-4eb6-b128-d95854535162

📥 Commits

Reviewing files that changed from the base of the PR and between afd76a4 and 1a86946.

📒 Files selected for processing (2)
  • src/main/opencode/hook-plugin-module-contract.test.ts
  • src/main/opencode/hook-service.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The OpenCode plugin module now exports OrcaOpenCodeStatusPlugin directly as its default export. Contract tests now require a callable default factory, verify equality with the named factory, reject object defaults, and invoke the default export for handler creation and lifecycle event checks.

Merge Risk: ⚪ Minimal · up to 1a869

The PR changes the OpenCode plugin default export to the callable factory expected by the loader and updates contract tests accordingly; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description clearly explains the defect, fix, impact, and linked issues, but it omits most required template sections and testing details. Use the repository template headings and add ELI5, visual proof or N/A, testing evidence, checklist status, and other required sections.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: exporting the OpenCode plugin factory instead of an object default.
Linked Issues check ✅ Passed The PR changes the default export to a callable factory, preserves hook behavior, and addresses the cross-platform OpenCode launch failure described in #16245.
Out of Scope Changes check ✅ Passed The changes are limited to the OpenCode plugin export and its contract tests, matching the linked issue objectives.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker

nwparker commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Superseded by merged #24662, which covers this complete two-file factory correction and credits @adityachaudhary99. The replacement selects the same callable factory for the execution host’s older OpenCode loader while preserving newer loaders’ object contract.

The genuine Orca 1.4.188 / official OpenCode 1.1.23 before/after reproduction failed with the reported TypeError before the correction and initialized successfully afterward. Thank you for the contribution.

@nwparker nwparker closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: object default export in orca-opencode-status.js breaks opencode 1.1.23 plugin load (macOS v1.4.188; same defect as #15897 on Linux)

2 participants