0
0
Fork 0

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.
This commit is contained in:
Karstein Phobic Nyvold Kvistad 2026-04-28 17:20:15 +02:00
parent 722c09ed70
commit c1592f40a0

View file

@ -713,9 +713,12 @@ export async function startMcpServer(config: ServerConfig): Promise<void> {
}
}
} 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);