From f7913a04d26f6232ba49ad5baddbff379de80af4 Mon Sep 17 00:00:00 2001 From: James Long Date: Wed, 26 Aug 2026 15:39:29 -0400 Subject: [PATCH] fix(cli): stop PTY daemon on explicit service restart (#45373) --- packages/cli/src/commands/handlers/service/restart.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/cli/src/commands/handlers/service/restart.ts b/packages/cli/src/commands/handlers/service/restart.ts index fe306dcb027..b18691677c2 100644 --- a/packages/cli/src/commands/handlers/service/restart.ts +++ b/packages/cli/src/commands/handlers/service/restart.ts @@ -4,11 +4,14 @@ import { Service } from "@opencode-ai/client/effect/service" import { Commands } from "../../commands" import { Runtime } from "../../../framework/runtime" import { ServiceConfig } from "../../../services/service-config" +import { ServerConnection } from "../../../services/server-connection" export default Runtime.handler( Commands.commands.service.commands.restart, Effect.fn("cli.service.restart")(function* () { const options = yield* ServiceConfig.options() + // Keep this explicit: automatic service replacement must preserve terminals. + yield* ServerConnection.shutdownPersistentPty(options).pipe(Effect.ignore) yield* Service.stop(options) const transport = yield* Service.ensure(options) process.stdout.write(transport.url + EOL)