Defer OpenCode restarts for config mutations

Co-authored-by: Serhii Dziupin <makeittech@users.noreply.github.com>
This commit is contained in:
Cursor Agent
2026-08-03 06:40:01 +00:00
co-authored by Serhii Dziupin
parent 824d1fbbf4
commit 775da6e9f4
11 changed files with 272 additions and 323 deletions
@@ -1,3 +1,5 @@
import { buildExternalManualRestartResponse } from './config-mutation-response.js';
const parseLoopbackUrl = (rawUrl) => {
if (typeof rawUrl !== 'string') {
return null;
@@ -1024,7 +1026,13 @@ export const registerSettingsUtilityRoutes = (app, dependencies) => {
try {
console.log('[Server] Manual configuration reload requested');
await refreshOpenCodeAfterConfigChange('manual configuration reload');
const refreshResult = await refreshOpenCodeAfterConfigChange('manual configuration reload');
if (refreshResult?.external) {
return res.json(buildExternalManualRestartResponse(
'Configuration is saved on disk. Restart your connected OpenCode server to apply the changes.',
));
}
res.json({
success: true,