From 73bb52e2f57d2ca74684b417ba82a60f101e5636 Mon Sep 17 00:00:00 2001 From: Ahmed Abushagur Date: Thu, 26 Mar 2026 11:30:54 -0700 Subject: [PATCH] fix: use sprite exec -tty instead of sprite console for entering agents (#3014) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sprite console does not accept arguments — it's a pure interactive shell. When entering an agent on Sprite, use `sprite exec -s NAME -tty` which supports passing commands via `-- bash -lc CMD`. Signed-off-by: Ahmed Abushagur Co-authored-by: Claude Opus 4.6 (1M context) Co-authored-by: L <6723574+louisgv@users.noreply.github.com> --- packages/cli/src/__tests__/cmd-connect-cov.test.ts | 6 ++++-- packages/cli/src/commands/connect.ts | 8 +++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/cli/src/__tests__/cmd-connect-cov.test.ts b/packages/cli/src/__tests__/cmd-connect-cov.test.ts index fc02b7bc..2058611f 100644 --- a/packages/cli/src/__tests__/cmd-connect-cov.test.ts +++ b/packages/cli/src/__tests__/cmd-connect-cov.test.ts @@ -207,7 +207,7 @@ describe("cmdEnterAgent", () => { expect(processExitSpy).toHaveBeenCalledWith(1); }); - it("enters agent via sprite console", async () => { + it("enters agent via sprite exec -tty", async () => { const conn = makeConn({ ip: "sprite-console", server_name: "my-sprite", @@ -217,7 +217,9 @@ describe("cmdEnterAgent", () => { expect(spawnInteractiveSpy).toHaveBeenCalled(); const args = spawnInteractiveSpy.mock.calls[0][0]; expect(args[0]).toBe("sprite"); - expect(args).toContain("console"); + expect(args).toContain("exec"); + expect(args).toContain("-tty"); + expect(args).toContain("my-sprite"); }); it("uses agent key as fallback when manifest is null", async () => { diff --git a/packages/cli/src/commands/connect.ts b/packages/cli/src/commands/connect.ts index a273256d..bf784fbf 100644 --- a/packages/cli/src/commands/connect.ts +++ b/packages/cli/src/commands/connect.ts @@ -163,22 +163,24 @@ export async function cmdEnterAgent( const agentName = agentDef?.name || agentKey; - // Handle Sprite console connections + // Handle Sprite connections — use `sprite exec -tty` to run a command interactively. + // `sprite console` does NOT accept arguments; it is a pure interactive shell. if (connection.ip === "sprite-console" && connection.server_name) { p.log.step(`Entering ${pc.bold(agentName)} on sprite ${pc.bold(connection.server_name)}...`); return runInteractiveCommand( "sprite", [ - "console", + "exec", "-s", connection.server_name, + "-tty", "--", "bash", "-lc", remoteCmd, ], `Failed to enter ${agentName}`, - `sprite console -s ${connection.server_name} -- bash -lc '${remoteCmd}'`, + `sprite exec -s ${connection.server_name} -tty -- bash -lc '${remoteCmd}'`, ); }