Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/adapters/large-prompt-launch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,19 @@ describe("Large prompt handling — OpenCode", () => {
});
});

it("passes small prompt as CLI arg", async () => {
it("passes small prompt in wrapper script CLI arg", async () => {
await adapter.launch({
adapter: "opencode",
prompt: smallPrompt,
cwd: tmpDir,
});

expect(spawnCalls).toHaveLength(1);
expect(spawnCalls[0].args).toContain(smallPrompt);
// Now launches via wrapper: /bin/sh <wrapper.sh>
expect(spawnCalls[0].cmd).toBe("/bin/sh");
const wrapperPath = spawnCalls[0].args[0];
const wrapperContent = await fs.readFile(wrapperPath, "utf-8");
expect(wrapperContent).toContain(smallPrompt);
// stdin should be "ignore" for small prompts
expect(spawnCalls[0].opts.stdio[0]).toBe("ignore");
});
Expand All @@ -101,9 +105,11 @@ describe("Large prompt handling — OpenCode", () => {
});

expect(spawnCalls).toHaveLength(1);
// Large prompt must NOT appear in args
expect(spawnCalls[0].args).not.toContain(largePrompt);
expect(spawnCalls[0].args).toEqual(["run"]);
// Wrapper script should NOT contain the large prompt
const wrapperPath = spawnCalls[0].args[0];
const wrapperContent = await fs.readFile(wrapperPath, "utf-8");
expect(wrapperContent).not.toContain(largePrompt);
expect(wrapperContent).toContain("'run'");
// stdin should be a file descriptor (number), not "ignore"
expect(typeof spawnCalls[0].opts.stdio[0]).toBe("number");
});
Expand Down
Loading
Loading