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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- When ChatGPT's page could not draw an answer, prodex saved the page's own error, "This response couldn’t load", as the answer, and the consult reported done with its request verified. `pro browser recover` saved the same sentence again, because the tab was already on the thread and was not loaded again. Found 2026-10-30 in the browser container: Chromium could not start threads there, and ChatGPT held the finished answer ("OK") while the page showed the error in its place. A send now stops as `answer_render_failed` and names the `recover` command. Recovery loads the thread once more when it finds the error, and returns the answer drawn after that. If the error is still there, recovery stops as `answer_render_failed` instead of saving it. Checked live on WSL by marking an answer the way the failed page did: 0.40.48 recovered the error text; the fix blocked the send, then recovered "PROBE7731" once the page could draw it.
- `--tool " "` (a tool name of only spaces, such as an empty script variable) was accepted, and the prompt went out with no tool and no warning. Measured 2026-10-29. MCP `pro_consult` with a blank entry in `tools` did the same. Both now stop before the browser with "--tool is blank".

## 0.40.48

Expand Down
5 changes: 5 additions & 0 deletions src/cli-pro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,11 @@ export async function runAskProCommand(
// --tool turns on a composer tool (deep-research, web-search,
// create-image, or any label the menu shows) for this send.
const tools = readRepeatedFlag(parsedAskPro.optionArgs, "--tool");
// A tool is opened by its label, so a value that is only spaces names none:
// the prompt went out with no tool and nothing said so.
if (tools.some((tool) => !tool.trim())) {
throw new Error("--tool is blank; name a composer tool (web-search, create-image), or leave the option out.");
}
if (tools.length > 0 && !hasSendMode) {
throw new Error("--tool only applies when sending (`prodex pro browser ask`); the dry-run preview cannot open ChatGPT's tools menu.");
}
Expand Down
18 changes: 18 additions & 0 deletions tests/cli-pro-browser-send.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3573,3 +3573,21 @@ describe("blank project names", () => {
await expect(runCli(["setup", "--project", " "], io(cwd))).rejects.toThrow(/--project .*blank/);
});
});

describe("blank composer tools", () => {
// Measured 2026-10-29: `--tool " "` (a script's empty variable, say) was
// accepted and the prompt went out with no tool at all, so a send that asked
// for a tool got none without a word. MCP pro_consult passes its tools here.
const io = (cwd: string) => ({ cwd, stdout: () => {}, stderr: () => {} });
beforeEach(() => {
sendChatGptPromptMock.mockClear();
});

it.each([" ", "\t"])("refuses --tool %j before touching the browser", async (value) => {
const cwd = await mkdtemp(path.join(tmpdir(), "prodex-pro-send-"));
await expect(runCli(["pro", "browser", "ask", "--send", "--tool", "web-search", "--tool", value, "Review this"], io(cwd))).rejects.toThrow(
/--tool .*blank/
);
expect(sendChatGptPromptMock).not.toHaveBeenCalled();
});
});
6 changes: 6 additions & 0 deletions tests/mcp-consult.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ describe("pro_consult MCP tool registration", () => {
});

describe("performBrowserConsultForMcp", () => {
it("refuses a blank tool before sending", async () => {
const cwd = await mkdtemp(path.join(tmpdir(), "prodex-mcp-consult-"));
await expect(performBrowserConsultForMcp(cwd, { prompt: "Question", tools: [" "] })).rejects.toThrow(/--tool .*blank/);
expect(sendChatGptPromptMock).not.toHaveBeenCalled();
});

it("threads selection options into the send and returns structured fields", async () => {
const cwd = await mkdtemp(path.join(tmpdir(), "prodex-mcp-consult-"));
sendChatGptPromptMock.mockResolvedValueOnce({
Expand Down
Loading