Skip to content
Closed
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
10 changes: 10 additions & 0 deletions packages/core/src/tools/agent/agent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,16 @@ describe('AgentTool', () => {
).toMatch(/fork/i);
});

it('rejects a non-boolean run_in_background value', () => {
expect(
agentTool.validateToolParams({
...validParams,
// @ts-expect-error: raw model parameters are untrusted
run_in_background: 'true',
}),
).toMatch(/run_in_background.*boolean/i);
});

it('rejects working_dir combined with run_in_background', () => {
expect(
agentTool.validateToolParams({
Expand Down
7 changes: 7 additions & 0 deletions packages/core/src/tools/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1007,6 +1007,13 @@ assistant: Uses the ${ToolNames.AGENT} tool to launch the test-runner agent
return 'Parameter "prompt" must be a non-empty string.';
}

if (
params.run_in_background !== undefined &&
typeof params.run_in_background !== 'boolean'
) {
return 'Parameter "run_in_background" must be a boolean when set.';
}

if (params.subagent_type !== undefined) {
if (
typeof params.subagent_type !== 'string' ||
Expand Down
Loading