Conversation
… environments All dynamic import() calls in strray-codex-injection.js use relative paths that resolve from process.cwd() instead of the plugin file location. In Docker/container setups where cwd differs from the plugin directory, every import() fails silently, causing the entire processor pipeline (30+ processors) to never load. Changes: - Add resolvePluginImport() using import.meta.url + fileURLToPath for file-relative resolution with Docker-aware fallback paths - Add findStrrayDistDir() to locate strray-ai dist via fs.existsSync across multiple candidate paths (standard, Docker /app, backend subdir) - Fix all 10 dynamic imports: loadFrameworkLogger, loadConfigPaths, importSystemPromptGenerator, loadStrRayComponents, outcome-tracker, inference-tuner - Session-scope globalThis cache using process.pid to prevent cross-opencode-session ProcessorManager pollution - Add typeof guards on executePreProcessors/executePostProcessors with automatic stale cache clearing - Wrap resolveStateDir() in try/catch with fallback to directory arg Tested in production Docker deployment with strray-ai 1.15.35.
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.
Problem
All dynamic
import()calls instrray-codex-injection.jsuse relative paths that resolve fromprocess.cwd(), not the plugin file location. JavaScript dynamicimport()resolves relative to cwd, not the calling file. The plugin lives at.opencode/plugin/but when opencode spawns agents withcwd: "/app", imports resolve to wrong paths like/node_modules/strray-ai/dist/...(missing/app/prefix).Impact: The entire StringRay processor pipeline (30+ processors: codex compliance, test auto-creation, test execution, coverage analysis, TypeScript compilation) has never executed in Docker/container environments. Zero validation across 250+ phases.
Root Causes
import()fromprocess.cwd()globalThiscache shared across sessionstypeofguard on processor methodsnot a functionerrors crash silentlyresolveStateDir()crash propagatesChanges
resolvePluginImport(relativePath)— Resolves from plugin file location viaimport.meta.url+fileURLToPathwith Docker-aware fallbacks (/app/node_modules/,/app/backend/node_modules/)findStrrayDistDir()— Locates strray-ai dist viafs.existsSyncacross 4 candidatesloadFrameworkLogger,loadConfigPaths,importSystemPromptGenerator,loadStrRayComponents,routingOutcomeTracker,inferenceTunerglobalThiscache —process.pidkey prevents cross-session pollutiontypeofguards — Clears stale cache gracefully instead of crashingresolveStateDir()fallback — try/catch with directory arg fallbackTesting
+105 lines, -48 lines