fix(cli): Resolve {env:VAR} and {file:path} patterns in OPENCODE_CONFIG_CONTENT#128
Conversation
9d1f010 to
ca9d68e
Compare
There was a problem hiding this comment.
No issues found across 4 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
|
Ah very interesting! Do you know if this is the same for their other patterns like |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #128 +/- ##
==========================================
+ Coverage 48.05% 48.34% +0.28%
==========================================
Files 46 47 +1
Lines 4903 4944 +41
==========================================
+ Hits 2356 2390 +34
- Misses 2547 2554 +7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Yes, |
It would be great if you did those in this PR! I would greatly appreciate it. |
…IG_CONTENT Both patterns are resolved in OpenCode's load() which OPENCODE_CONFIG_CONTENT bypasses entirely. Resolve them in OCX before passing the serialized config. - Rename resolve-env to resolve-config, add resolveFilePatterns and resolveConfigPatterns - buildOpenCodeEnv accepts pre-resolved configContent string (stays sync) - Pattern resolution happens in runOpencode caller before spawning
|
Hey! Just pushed |
b594efa to
9cf782c
Compare
|
@kdcokenny ready for review when you get a chance! |
|
Thank you! |
|
Looks like the core issue has been fixed anomalyco/opencode#13384 |
Problem
OCX passes
{env:VAR}patterns as literal strings inOPENCODE_CONFIG_CONTENT.OpenCode only resolves these patterns when reading files from disk (
load()),not when receiving config via
OPENCODE_CONFIG_CONTENT(JSON.parseonly).This breaks any MCP server using
{env:VAR}in itsenvironmentorheadersfieldswhen launched through
ocx oc.Fix
Resolve
{env:VAR}patterns on the serialized JSON string inbuildOpenCodeEnv,matching OpenCode's own resolution approach (string replace before parse).
Summary by cubic
Resolve {env:VAR} and {file:path} placeholders in OPENCODE_CONFIG_CONTENT before parsing so MCP servers using env vars or file-based secrets work when launched via ocx oc.
Written for commit e4238f2. Summary will update on new commits.