From 8aa3f291f659f1f969698880e09273b13bcb95a5 Mon Sep 17 00:00:00 2001 From: skulidropek <66840575+skulidropek@users.noreply.github.com> Date: Wed, 25 Mar 2026 09:17:14 +0000 Subject: [PATCH 1/2] fix(spawn): run agent directly via ssh instead of attaching tmux --- packages/app/src/docker-git/spawn.ts | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/packages/app/src/docker-git/spawn.ts b/packages/app/src/docker-git/spawn.ts index 9355206..82bd19a 100644 --- a/packages/app/src/docker-git/spawn.ts +++ b/packages/app/src/docker-git/spawn.ts @@ -11,15 +11,13 @@ import { type TemplateConfig } from "@effect-template/lib/core/domain" import type { SpawnCommand } from "@effect-template/lib/core/spawn-domain" -import { runCommandCapture, runCommandExitCode } from "@effect-template/lib/shell/command-runner" +import { runCommandCapture, runCommandExitCode, runCommandWithExitCodes } from "@effect-template/lib/shell/command-runner" import { readProjectConfig } from "@effect-template/lib/shell/config" import { CommandFailedError, SpawnProjectDirError, SpawnSetupError } from "@effect-template/lib/shell/errors" import { createProject } from "@effect-template/lib/usecases/actions" import { findSshPrivateKey } from "@effect-template/lib/usecases/path-helpers" import { getContainerIpIfInsideContainer } from "@effect-template/lib/usecases/projects-core" -import { spawnAttachTmux } from "./tmux.js" - const SPAWNDOCK_REPO_URL = "https://github.com/SpawnDock/tma-project" const SPAWNDOCK_REPO_REF = "main" @@ -174,5 +172,22 @@ export const spawnProject = (command: SpawnCommand) => } yield* _(Effect.log(`Project bootstrapped at ${projectDir}`)) - yield* _(spawnAttachTmux(template, projectDir, sshKey)) + + yield* _(Effect.log("Starting opencode directly via SSH...")) + yield* _( + runCommandWithExitCodes( + { + cwd: process.cwd(), + command: "ssh", + args: buildSshArgs( + template, + sshKey, + ipAddress, + `cd '${projectDir}' && spawn-dock agent` + ).filter((arg) => arg !== "-T" && arg !== "-o" && arg !== "BatchMode=yes" && arg !== "ConnectTimeout=2" && arg !== "ConnectionAttempts=1") + }, + [0, 255], // SSH frequently exits with 255 on user disconnect, which is normal + (exitCode) => new CommandFailedError({ command: "ssh agent", exitCode }) + ) + ) }) From 16756bf12e97b57f9922e9a4d59d803ee7b4e882 Mon Sep 17 00:00:00 2001 From: skulidropek <66840575+skulidropek@users.noreply.github.com> Date: Wed, 25 Mar 2026 09:17:14 +0000 Subject: [PATCH 2/2] chore: version bump for spawn-dock tmux fix --- .changeset/remove-tmux.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/remove-tmux.md diff --git a/.changeset/remove-tmux.md b/.changeset/remove-tmux.md new file mode 100644 index 0000000..b80cfcc --- /dev/null +++ b/.changeset/remove-tmux.md @@ -0,0 +1,5 @@ +--- +"@spawn-dock/cli": patch +--- + +fix: execute agent directly via ssh instead of attaching tmux in spawn command