Skip to content

fix(opencode): 支持 .json 配置中的 JSONC 语法(A01) - #6

Closed
ChenM0M wants to merge 1 commit into
mainfrom
codex/agent-config-a01-jsonc
Closed

ChenM0M wants to merge 1 commit into
mainfrom
codex/agent-config-a01-jsonc

Conversation

@ChenM0M

@ChenM0M ChenM0M commented Sep 22, 2026

Copy link
Copy Markdown
Owner

OpenCode 按 JSONC 读取 .json 配置,但 VibeHub 的通用存储层按扩展名使用严格 JSON,导致含注释或尾随逗号的合法配置在发现/读取阶段失败。

本 PR 为存储层增加显式解析格式接口,并让 OpenCode 读取、保存、备份恢复和凭据读取统一使用 JSONC。其他 Agent 的 JSON 规则保持原状,路径校验、并发修订校验和备份逻辑继续执行。

验证:

  • 新增回归在修改前复现 CONFIG_JSON_INVALID,修改后通过。
  • OpenCode adapter 14 项测试通过;存储层 10 项测试通过。
  • 覆盖 CRLF、注释保留、保存、备份恢复及普通 JSON 仍严格校验。
  • rustfmt、git diff --check 通过。

待验证:Tauri 集成及 Windows 原生端到端。此修复确认的是解析问题,尚不能证明用户 Windows 报错的所有原因均已解决。

范围:已确认清单 A01,独立基于 main。A02(注释位于尾随逗号之后)另一个 PR。

提交身份:用户已在本次受信对话批准本批 PR 使用 GitHub 连接器默认提交身份,作为 AGENTS.md 固定 author/committer 要求的例外。上传后的 tree SHA 与已验证本地提交一致。

ChenM0M added a commit that referenced this pull request Sep 23, 2026
…dation

Integrates PRs #6-#32 (Agent configuration reliability, contract and model modality work) as one reviewable candidate, including the stacked-branch CI trigger fix and cross-platform test hardening.

- JSONC comments and unmanaged fields preserved when editing managed fields; failed discovery keeps the file and a structured error
- XDG_CONFIG_HOME / OPENCODE_CONFIG / OPENCODE_CONFIG_DIR discovery with absolute-path validation and WSL environment inspection
- Empty OpenCode config initialization; the selected config is bound to the launch environment
- Draft save/discard/cancel guards on context switches; save before launch and before setting defaults
- Model defaults keep provider identity; disabled models retained and controlled through native filters
- Undeclared reasoning/tool/modality capabilities stay unknown; modalities, token limits, variant JSON and thinking parameters are editable
- Effective config preview shows managed values and unknown sources and excludes credentials
- Windows launcher keeps native argv boundaries and reports real launch results; interactive agents get a visible console while background probes stay silent
- build.yml runs the full gates for PRs on dependent branches; MCP cold-start budget is separated from warm latency

Verification: three-platform CI green at 8841ad8 (run 35838494343); local production build, agent-profile behavior checks, 828 contract assertions, three-locale parity, release metadata, Rust formatting and workspace tests passed.

Not a release: Windows host/WSL native acceptance (A07/E07/F07-F10/G05) still requires the target environment against the Release artifact/hash.
@ChenM0M

ChenM0M commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

内容已随整合 PR #33 合入 main (e3cb573)。此 PR 为被取代的分支/栈式 PR,按用户指示关闭;分支保留,未删除。

@ChenM0M ChenM0M closed this Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant