Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(windows): pass flag-interactive prompts through the agent's own flag in the launch planner

review2be9a906ce58
diff --git a/src/core/agent-launch.test.ts b/src/core/agent-launch.test.ts
index 71ceb5ad6..0afecc234 100644
--- a/src/core/agent-launch.test.ts
+++ b/src/core/agent-launch.test.ts
@@ -165,6 +165,28 @@ describe("prepareAgentLaunch logical argv", () => {
).resolves.toEqual({ command: "'opencode' '--prompt' 'repo/'" });
});
+ it("passes a flag-interactive builtin's prompt through its own flag, never as a positional", async () => {
+ // Same flags the typed line uses (`assembleLaunchCommand`): a positional is a subcommand slot
+ // for both CLIs, so the earlier argv fallthrough would have launched the wrong thing.
+ await expect(
+ prepareAgentLaunch(
+ start("copilot", { prompt: "fix it" }),
+ "posix",
+ builtinContext("copilot"),
+ ),
+ ).resolves.toEqual({ command: "'copilot' '--interactive' 'fix it'" });
+ await expect(
+ prepareAgentLaunch(
+ start("antigravity", { prompt: "fix it" }),
+ "posix",
+ builtinContext("antigravity"),
+ ),
+ ).resolves.toEqual({ command: "'agy' '--prompt-interactive' 'fix it'" });
+ await expect(
+ prepareAgentLaunch(start("copilot"), "posix", builtinContext("copilot")),
+ ).resolves.toEqual({ command: "'copilot'" });
+ });
+
it("preserves Gemini's historical positional prompt, including an empty prompt", async () => {
await expect(
prepareAgentLaunch(
diff --git a/src/core/agent-launch.ts b/src/core/agent-launch.ts
index 298760fa9..a530aeb54 100644
--- a/src/core/agent-launch.ts
+++ b/src/core/agent-launch.ts
@@ -114,6 +114,8 @@ interface ResolvedAgentConfig {
launchCmd: string;
promptInjectionMode: PromptInjectionMode;
argvPromptSeparator?: string;
+ /** `flag-interactive` only: the builtin's own interactive-prompt flag (agy's differs). */
+ promptFlag?: string;
builtin: boolean;
}
@@ -242,6 +244,7 @@ function resolveTrustedAgentConfig(
launchCmd: config.launchCmd,
promptInjectionMode: config.promptInjectionMode,
argvPromptSeparator: config.argvPromptSeparator,
+ promptFlag: config.promptFlag,
builtin: true,
};
}
@@ -410,12 +413,21 @@ function logicalLaunch(
};
}
- if (promptInjectionMode === "flag-prompt") {
+ if (
+ promptInjectionMode === "flag-prompt" ||
+ promptInjectionMode === "flag-interactive"
+ ) {
+ // Same flag choice as `assembleLaunchCommand`: copilot's `--interactive`, agy's own
+ // `--prompt-interactive`. A positional here would be read as a subcommand by both.
+ const flag =
+ promptInjectionMode === "flag-prompt"
+ ? "--prompt"
+ : (config.promptFlag ?? "--interactive");
return {
executable,
args: [
...baseArgs,
- ...(hasPrompt ? ["--prompt", prompt as string] : []),
+ ...(hasPrompt ? [flag, prompt as string] : []),
...modeFlags,
...sessionArgs,
],