Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances the config API to support both global and project-scoped configuration updates. It migrates from config.json to opencode.jsonc filenames and adds robust error handling, validation, and backup/rollback mechanisms.
Key Changes
- Added scope parameter (
globalorproject) to config update endpoint and function - Migrated config filename from
config.jsontoopencode.jsonc - Implemented permission checks, config validation, and automatic backup/rollback
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
packages/opencode/src/config/config.ts |
Added scope-aware config update logic with validation, error handling, and backup/rollback |
packages/opencode/src/server/server.ts |
Added scope query parameter to PATCH /config endpoint with validation |
packages/opencode/test/config/config.test.ts |
Updated existing test and added 5 new tests for scope handling, merging, validation, and rollback |
CONFIG_API_UPDATES.md |
Comprehensive documentation of API changes, usage examples, and migration guide |
Comments suppressed due to low confidence (2)
packages/opencode/test/config/config.test.ts:417
- Unused variable mockGlobal.
const mockGlobal = {
packages/opencode/test/config/config.test.ts:531
- Unused variable originalContent.
const originalContent = await Bun.file(path.join(tmp.path, "opencode.jsonc")).text()
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Dispose instance if project config was updated | ||
| if (scope === "project") { | ||
| await Instance.dispose() | ||
| } |
There was a problem hiding this comment.
Global config updates leave cached config stale
The new scope support writes to the global config file but never invalidates the in‑memory config cache. Config.update only disposes the cached state when scope === "project", so PATCH /config?scope=global writes a file yet future calls to Config.get (including the GET /config endpoint) continue returning the previous values until the process is restarted or someone manually disposes the instance. Global updates need to call Instance.dispose() (or disposeAll) to ensure consumers see the new config.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
To use Codex here, create an environment for this repo.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@kcrommett I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
[WIP] Address feedback on the /config endpoint update PR
No description provided.