mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix: refuse entity saves while a restart is pending and share replay payloads (OM-179)
This commit is contained in:
1 parent
8a6fd56e9a
commit
9fca96ecea
9 files changed
+82
-20
No files matched your search
@@ -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 { opencodeServerManager } from '../services/opencode-single-server'
|
||||
import { logger } from '../utils/logger'
|
||||
|
||||
interface OpenCodeConfigRoutesOptions {
|
||||
@@ -111,7 +112,6 @@ export function createOpenCodeConfigRoutes(
|
||||
const snapshot = await withOpenCodeConfigLock(readOpenCodeConfigSnapshot)
|
||||
const info = await readManagedOpenCodeConfig(openCodeClient.api, snapshot.sources)
|
||||
return c.json({
|
||||
revision: snapshot.revision,
|
||||
info: options.redactSecrets
|
||||
? redactOpenCodeConfigContent(info as Record<string, unknown>).content
|
||||
: info,
|
||||
@@ -175,6 +175,12 @@ export function createOpenCodeConfigRoutes(
|
||||
return c.json({ error: 'Invalid config data', details: parsed.error.issues }, 400)
|
||||
}
|
||||
|
||||
if (opencodeServerManager.isRestartPending()) {
|
||||
return c.json({
|
||||
error: 'OpenCode has not loaded the saved configuration yet. Restart OpenCode before editing entries.',
|
||||
}, 409)
|
||||
}
|
||||
|
||||
return applyUpdate(c, {
|
||||
content: parsed.data.patch,
|
||||
source: parsed.data.source,
|
||||
|
||||
Reference in new issue
Block a user