fix: limit the restart-pending 409 to entity patches and keep inherited agent permissions (OM-179)

PATCH /opencode-config refuses only patches that name an agent, command, provider or MCP server while a restart is pending; other keys still apply. The assistant API reference documents the new 409.

The agent dialog adds a wildcard permission rule only for an action whose effect the user changed, so saving an agent no longer overrides an inherited global ask or deny.
This commit is contained in:
Chris Scott committed 2026-11-05 12:43:42 -05:00
1 parent 8d92f86142
commit 38d618be9b
5 files changed
+85 -19

No files matched your search

+2 -1
View File
@@ -27,6 +27,7 @@ import {
import { readManagedOpenCodeConfig } from '../services/opencode-config-effective'
import { applyOpenCodeConfigUpdate, toOpenCodeConfigApplyResponse } from '../services/opencode-config-apply'
import { redactOpenCodeConfigContent, redactOpenCodeConfigFile } from '../services/opencode-config-redact'
import { patchNamesOpenCodeConfigEntities } from '../services/opencode-config-references'
import { opencodeServerManager } from '../services/opencode-single-server'
import { logger } from '../utils/logger'
@@ -175,7 +176,7 @@ export function createOpenCodeConfigRoutes(
return c.json({ error: 'Invalid config data', details: parsed.error.issues }, 400)
}
if (opencodeServerManager.isRestartPending()) {
if (opencodeServerManager.isRestartPending() && patchNamesOpenCodeConfigEntities(parsed.data.patch)) {
return c.json({
error: 'OpenCode has not loaded the saved configuration yet. Restart OpenCode before editing entries.',
}, 409)