Root cause: loadPluginConfig() unconditionally switched userConfigPath to the
canonical name after calling migrateLegacyConfigFile(), even when migration
failed (e.g. file lock on Windows, permission denied). This left the config
path pointing to a non-existent file, so the plugin config silently loaded
as empty defaults.
Additionally, several fallback/default paths were hardcoded to the legacy
'oh-my-opencode' basename instead of using CONFIG_BASENAME ('oh-my-openagent'),
causing CLI config commands (writeOmoConfig, detectCurrentConfig) to write to
the wrong filename.
Changes:
- plugin-config.ts: check migrateLegacyConfigFile() return value; only switch
to canonical path if migration succeeded OR the canonical file already exists
- opencode-config-dir.ts: use CONFIG_BASENAME for omoConfig path in
getOpenCodeConfigPaths()
- config-context.ts: getOmoConfigPath() now uses detectPluginConfigFile() to
find whichever name variant actually exists on disk
- plugin-config.ts: default fallback paths use CONFIG_BASENAME instead of
hardcoded legacy name
- Added test: loadPluginConfig still loads config when migration fails
(read-only directory simulation)
When run-ci-tests.ts groups the claude-code-plugin-loader directory,
loader.test.ts mocks ./discovery with name: 'demo'. This mock leaked
into discovery.test.ts because both ran in the same process.
Fix: dynamic import with cache-busting query string ensures each test
gets a fresh module instance, immune to sibling test mocks.
The discovery tests were failing in CI with "demo" plugin name instead
of expected names. The root cause was test directory structure:
**The Bug:**
Original test code created installPath as a subdirectory:
```typescript
const installPath = join(createTemporaryDirectory("omo-plugin-install-"), "oh-my-openagent")
```
This created: `/tmp/omo-plugin-install-XXXXXX/oh-my-openagent`
If another test created `/tmp/omo-plugin-install-YYYYYY/.claude-plugin/plugin.json`
with name "demo", and the test execution order caused the discovery test
to pick up the wrong temp directory, it would read the manifest with "demo".
**The Fix:**
Changed tests to use unique temp directories directly:
```typescript
const installPath = createTemporaryDirectory("omo-npm-plugin-")
```
This creates: `/tmp/omo-npm-plugin-XXXXXX`
Each test now has its own unique temp directory that cannot be contaminated
by other tests.
**Also included:**
- mock.module() for process isolation in CI runner
- pluginsHomeOverride parameter for plugins database isolation
Fixes CI failure on dev branch.
The discovery tests were failing in CI with "demo" plugin name instead of
expected names. This happened because:
1. The CI test runner (run-ci-tests.ts) groups tests by directory
2. Tests using mock.module() are run in isolated processes
3. Tests without mock.module run in a shared batch
4. Other tests in the shared batch were creating plugin state that
contaminated the discovery tests
Fix adds mock.module() to discovery tests:
- Mocks the logger module to avoid noise
- Forces CI runner to run these tests in isolated process
- Prevents cross-test contamination
Combined with previous pluginsHomeOverride parameter fix, this ensures
tests are properly isolated both at the parameter level and process level.
Also removes debug logging that was added for troubleshooting.
Fixes CI failure on dev branch.
The discovery.test.ts was using process.env.CLAUDE_PLUGINS_HOME to set
the plugins directory, but this global state could be affected by other
tests running in parallel, causing flaky failures with errors like:
Expected: "oh-my-openagent"
Received: "demo"
Changes:
- Added pluginsHomeOverride option to PluginLoaderOptions type
- Modified discoverInstalledPlugins to accept optional pluginsHomeOverride
- Modified loadInstalledPlugins to accept optional pluginsBaseDir
- Updated all 3 discovery tests to use pluginsHomeOverride instead of
relying on global process.env.CLAUDE_PLUGINS_HOME
This makes the tests properly isolated and deterministic regardless of
test execution order or parallelization.
Fixes CI failure on dev branch.
GitHub Copilot performs rolling model updates which sometimes return
'400 Bad Request' when a model is temporarily unavailable. This error
was not in the retryable message patterns, causing model fallback to
not trigger and users getting stuck.
Changes:
- Added 'bad request' to RETRYABLE_MESSAGE_PATTERNS in model-error-classifier.ts
- Added test cases for 'bad request' pattern matching
Fixes#3130