Repository navigation
fix(connect): recognize OpenCode's opencode.jsonc global config - #923
Merged
Merged
Conversation
Related #922 Recent OpenCode versions bootstrap ~/.config/opencode/opencode.jsonc, so a fresh install was reported as not installed and 'mcpproxy connect opencode' refused with a missing opencode.json. ## Changes - Service-level configPath resolver: opencode targets whichever candidate exists, preferring .jsonc (OpenCode loads it after .json, so it shadows the same keys); static ConfigPath default (.json) kept for the create-new case. Wired through Connect/Disconnect/GetStatus/GetAllStatus/entryAccess/ preview/undo/DetectAppDataDenial. - unmarshalLenientJSON now strips // and /* */ comments (string-aware) before the trailing-comma cleanup, so commented .jsonc files parse for detection. - Comment guard: connect/disconnect refuse to rewrite a .jsonc that actually uses comments (re-serializing would strip them) with a manual-edit hint; OpenCode's comment-free bootstrap stub rewrites safely. - Missing-config refusal now names both probed files and the directory. - docs/setup.md OpenCode section updated. ## Testing - 8 new tests (path resolution, JSONC parsing, .jsonc-only connect/disconnect round-trip incl. no stray .json created, commented-file refusal, status detection, both-candidates error) - go test -race ./internal/connect ./internal/httpapi green - golangci-lint v2 (.github config) 0 issues; scripts/test-api-e2e.sh all pass
Deploying mcpproxy-docs with
|
| Latest commit: |
0a96a50
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0fde72fb.mcpproxy-docs.pages.dev |
| Branch Preview URL: | https://fix-922-opencode-jsonc.mcpproxy-docs.pages.dev |
Related #922 - Unterminated /* block comments now fail parsing instead of silently blanking to EOF (malformed .jsonc no longer reports accessible) - Disconnect retries the other existing opencode candidate when the resolved file lacks the entry (connect-to-.json / later .jsonc bootstrap drift) - Undo accepts backups of either opencode candidate and restores to the file the backup came from, not the freshly resolved one (allowlist stays registry-derived; traversal-proof construction unchanged) - Tests: unterminated block, escaped quotes, EOF line comment, commented disconnect refusal leaves no backup, cross-candidate disconnect, post-drift undo restores .json and leaves .jsonc untouched
…nect (Codex round 2 N1) Related #922 A malformed/unreadable alternate candidate now surfaces its error instead of being masked by the resolved file's not_found.
Contributor
📦 Build ArtifactsWorkflow Run: View Run Available Artifacts
How to DownloadOption 1: GitHub Web UI (easiest)
Option 2: GitHub CLI gh run download 30379345177 --repo smart-mcp-proxy/mcpproxy-go
|
Contributor
There was a problem hiding this comment.
Approved (Model B): issue #922 fix — Codex review approved after 2 fix rounds, 15 targeted tests incl. candidate-drift scenarios, go test -race + golangci-lint v2 + test-api-e2e.sh green, qa-gate success at this head SHA.
|
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Dumbris
added a commit
that referenced
this pull request
Aug 3, 2026
…e, note channel Adversarial review (panel + opencode cross-model) found four genuine defects: - opencodeConfigCandidates joined an empty homeDir into CWD-relative paths. Every production Service is built without a homeDir (NewService), so the #923 jsonc preference — and the new checked_paths — silently degraded to stats against the working directory. Empty now resolves via os.UserHomeDir, like ConfigPath. - A permission-blocked aggregate row (access_state=denied, no remediation) fell through to the looked-for note, claiming files were checked when the stat was forbidden. The gate now allows only absent/unknown/nil. - The looked-for hint rendered in the orange warning channel on every not-installed row; it is informational and now renders secondary (ClientRow.noteIsWarning), and the row accessibility label includes the note so VoiceOver announces it. - The home-abbreviation branch had zero coverage (fixtures used /Users/x); new tests exercise real-home tilde abbreviation and the denied gate.
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 3, 2026
…#949) * fix(connect): name the checked config paths on "No config found" rows A user whose ~/.config/opencode/opencode.jsonc exists saw only "No config found" in the Connect Client form and could not tell which file mcpproxy had looked for (their core predated the #923 jsonc fix). Make the verdict explicit instead of a mystery: - ClientStatus gains additive checked_paths: every config location the existence check consults, highest precedence first (both opencode.jsonc and opencode.json for OpenCode; the single config_path elsewhere). - The macOS form renders it as a "Looked for ... in ..." note on supported, unconnected rows without a config, home-abbreviated. An explicit core note or denied-remediation still outranks it, and a core older than the app falls back to naming config_path. * fix(connect): review round 1 — production home resolution, denied gate, note channel Adversarial review (panel + opencode cross-model) found four genuine defects: - opencodeConfigCandidates joined an empty homeDir into CWD-relative paths. Every production Service is built without a homeDir (NewService), so the #923 jsonc preference — and the new checked_paths — silently degraded to stats against the working directory. Empty now resolves via os.UserHomeDir, like ConfigPath. - A permission-blocked aggregate row (access_state=denied, no remediation) fell through to the looked-for note, claiming files were checked when the stat was forbidden. The gate now allows only absent/unknown/nil. - The looked-for hint rendered in the orange warning channel on every not-installed row; it is informational and now renders secondary (ClientRow.noteIsWarning), and the row accessibility label includes the note so VoiceOver announces it. - The home-abbreviation branch had zero coverage (fixtures used /Users/x); new tests exercise real-home tilde abbreviation and the denied gate.
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.
Related #922
Fresh OpenCode installs (≥ ~1.18) bootstrap
~/.config/opencode/opencode.jsonc, but mcpproxy only recognizedopencode.json— so OpenCode showed as not installed andmcpproxy connect opencoderefused.What
opencode.jsonc(OpenCode loads it after.json, so it shadows the same keys — writing a new.jsonnext to an existing.jsoncwould be silently shadowed later). StaticConfigPathkeeps the.jsondefault for the create-new case. Wired through connect, disconnect, status (GetStatus/GetAllStatus), access classification, preview, undo, and doctor's denial probe.unmarshalLenientJSONstrips//and/* */comments (string-aware) before the existing trailing-comma cleanup, so commented files still parse for detection/status..jsoncthat actually uses comments (mcpproxy re-serializes plain JSON, which would strip them) with a manual-edit hint. OpenCode's comment-free bootstrap stub rewrites safely — the primary broken case now just works.Testing
.jsonc-only connect→status→disconnect round-trip (asserts the entry lands inside the.jsonc,$schemapreserved, no strayopencode.jsoncreated), commented-file refusal leaves the file byte-identical,GetAllStatusdetection, both-candidate error message.go test -raceon connect + httpapi green; golangci-lint v2 (CI config) 0 issues;./scripts/test-api-e2e.shall passed.