fix: use sprite exec -tty instead of sprite console for entering agents (#3014)

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 <ahmed@abushagur.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: L <6723574+louisgv@users.noreply.github.com>
This commit is contained in:
Ahmed Abushagur 2026-03-26 11:30:54 -07:00 committed by GitHub
parent defca448b0
commit 73bb52e2f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -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 () => {

View file

@ -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}'`,
);
}