From c1592f40a0524b651989fffd7cc13bc15e773310 Mon Sep 17 00:00:00 2001 From: Karstein Phobic Nyvold Kvistad Date: Tue, 28 Apr 2026 17:20:15 +0200 Subject: [PATCH] fix(server): keep executionMode=persistent under --no-auto-launch Previously, '--mode persistent --no-auto-launch' silently downgraded the reported executionMode to 'headless' until launch_codesys was called. get_codesys_status would then mislead the user into thinking they were in headless mode despite having configured persistent. Now executionMode tracks the configured intent. The deferred-launch state is communicated via 'State: stopped' instead. Tool calls before launch_codesys still route through HeadlessExecutor as a best-effort fallback. --- src/server.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server.ts b/src/server.ts index b0f49bf..f8a5f26 100644 --- a/src/server.ts +++ b/src/server.ts @@ -713,9 +713,12 @@ export async function startMcpServer(config: ServerConfig): Promise { } } } else { - // Launcher exists but not yet launched — will use headless until manually launched + // --no-auto-launch under persistent: launcher exists but isn't started. + // Keep executionMode = 'persistent' so get_codesys_status reflects the + // configured intent (State: stopped tells the user it isn't running). + // Tool calls before launch_codesys go through HeadlessExecutor as a + // best-effort fallback so the server stays useful. executor = new HeadlessExecutor(config); - executionMode = 'headless'; } } else { executor = new HeadlessExecutor(config);