Skip to content

fix(omp): resolve host modules and tokenizer from plugin runtime - #655

Merged
ualtinok merged 3 commits into
cortexkit:masterfrom
randomvariable:fix/omp-module-resolution
Oct 11, 2026
Merged

ualtinok merged 3 commits into
cortexkit:masterfrom
randomvariable:fix/omp-module-resolution

Conversation

@randomvariable

@randomvariable randomvariable commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Refs #657

Fix compiled OMP host-module imports and tokenizer runtime fallback resolution. Preserve package-local tokenizer precedence.

Independent of PR #656. Initial standalone verification: typecheck, build, 29 focused tests. Review regression improvements are in progress.

RetriggerConfidence Score: 5/5

The PR appears safe to merge; no actionable issues remain.

Summary

This PR keeps Pi and OMP host imports visible to the host loader and adds tokenizer fallback roots for the plugin’s install tree and OMP’s plugin directory.

  • Dreamer session loading reaches both hosts through literal package imports.
  • Token counts find the tokenizer from the plugin and OMP runtime.

Reviews (3) · Last reviewed commit: "test(tokenizer): copy recursive relative..." · Reviewed by Greptile

@cortexkit-ci

cortexkit-ci Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Design gate skipped: the trivial label is applied.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread packages/plugin/src/hooks/magic-context/read-session-formatting.ts Outdated
@magic-alfonso

magic-alfonso Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thanks for this, and for splitting it from the discovery change.

Before review, please address the open bot finding. Greptile notes that the new tokenizer-roots test may not exercise the fallback: preloadTokenizer() first calls loadTokenizer(), which resolves from import.meta.url regardless of cwd or process.argv[1]. So the test can pass even if the new probe roots are never used. A test that fails without your new roots (for example with the module-relative lookup made to miss) would show the fix does what it says.

Once the finding is resolved, we'll take it through review.

@randomvariable

Copy link
Copy Markdown
Contributor Author

Addressed all three threads in 3b046f4. The runtime fixture forces the primary loader to fail under bun --no-install and proves fallback estimator identity. A second fixture proves the plugin dependency beats a conflicting host-wide copy. Three focused tests, plugin typecheck, and Pi build passed. Negative control with the old probe ordering fails the precedence regression. Refs #657 for maintainer design approval.

@greptile-apps

greptile-apps Bot commented Oct 10, 2026

Copy link
Copy Markdown

Want your agent to iterate on Greptile's feedback? Try greploops.

@ualtinok ualtinok added the trivial Typo-class change; exempt from the design-approved gate label Oct 10, 2026
@magic-alfonso

magic-alfonso Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thanks for resolving the findings. I've labelled this trivial and ran it through our merge checks against current master. Two of the new tests fail there, because of a change that landed on master after your branch point, not a problem with your fix.

read-session-formatting.ts now imports a new sibling module, ./token-count-exact (added today for issue 653). Your tokenizer-roots tests copy read-session-formatting.ts into a temporary module tree, so the copy can't resolve that import:

ResolveMessage: Cannot find module './token-count-exact' imported from …/mod/src/hooks/magic-context/read-session-formatting.ts

Affected: "the fallback loads from the plugin tree when the primary loader fails" and "the plugin's own tree outranks the host-wide ~/.omp/plugins copy". Could you rebase onto master and have the fixture copy token-count-exact.ts too, or better, every relative import of the copied file, so the next new import doesn't break it? Once that's green, we'll merge it.

@randomvariable
randomvariable force-pushed the fix/omp-module-resolution branch from 3b046f4 to 49f86b5 Compare October 10, 2026 23:58
@randomvariable

Copy link
Copy Markdown
Contributor Author

Rebased onto upstream master e3d82fa and pushed 49f86b5. The isolated tokenizer fixture now traverses and copies the recursive relative runtime import closure using Bun.Transpiler.scanImports, including token-count-exact.ts, instead of a fixed shared directory. Bare package dependencies remain excluded so the primary tokenizer loader still fails as intended. Both affected tests and the probe-roots test pass (3/3). Plugin typecheck, focused Biome check, and plugin build also pass.

@ualtinok
ualtinok merged commit c27afd7 into cortexkit:master Oct 11, 2026
17 checks passed
@magic-alfonso

magic-alfonso Bot commented Oct 11, 2026

Copy link
Copy Markdown

Merged, thank you. It passed the full plugin, Pi and CLI suites on current master, and it ships in the next release. Issue 657 stays open until then.

@randomvariable
randomvariable deleted the fix/omp-module-resolution branch October 11, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

trivial Typo-class change; exempt from the design-approved gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants