fix(opencode): preserve external host during recovery
This commit is contained in:
@@ -792,11 +792,12 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
|
||||
if (state.isExternalOpenCode) {
|
||||
console.log('Re-probing external OpenCode server...');
|
||||
const probePort = state.openCodePort || env.ENV_CONFIGURED_OPENCODE_PORT || 4096;
|
||||
const probePort = state.openCodePort ?? env.ENV_EFFECTIVE_PORT ?? 4096;
|
||||
const probeOrigin = state.openCodeBaseUrl ?? env.ENV_CONFIGURED_OPENCODE_HOST?.origin;
|
||||
const healthy = await probeExternalOpenCode(probePort, probeOrigin);
|
||||
if (healthy) {
|
||||
console.log(`External OpenCode server on port ${probePort} is healthy`);
|
||||
state.openCodeBaseUrl = probeOrigin ?? null;
|
||||
setOpenCodePort(probePort);
|
||||
state.isOpenCodeReady = true;
|
||||
state.lastOpenCodeError = null;
|
||||
@@ -875,7 +876,7 @@ export const createOpenCodeLifecycleRuntime = (deps) => {
|
||||
} catch (error) {
|
||||
console.error(`Failed to restart OpenCode: ${error.message}`);
|
||||
state.lastOpenCodeError = error.message;
|
||||
if (!env.ENV_CONFIGURED_OPENCODE_PORT) {
|
||||
if (!env.ENV_EFFECTIVE_PORT) {
|
||||
state.openCodePort = null;
|
||||
syncToHmrState();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user