fix(config): add debug logging for agent/command loading (#8868) #8881
+212
−4
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.
What does this PR do?
Fixes #8868
Description
This PR addresses issue #8868 by adding debug logging to the configuration loading process. This helps diagnose environment-specific issues where agents or commands might not be loaded correctly from discovered directories.
Changes
Added debug logs in src/config/config.ts to track:
Configuration directories discovered (including OPENCODE_CONFIG_DIR, .opencode, and home directory).
The number of agents, commands, modes, and plugins loaded from each directory.
Failures during agent or command loading.
Added a regression test (packages/opencode/test/config/issue-8868.test.ts) that reproduces the user's setup with a .opencode/ directory to ensure configurations are loaded as expected.
How did you verify your code works?
Verification
I verified these changes by running the new regression test:
Ran bun test packages/opencode/test/config/issue-8868.test.ts.
Confirmed that the test passes and that the expected debug logs would be generated in a real scenario.