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)