fix(eval): surfaced subagent abort reason
- Used `||` so empty stderr no longer masks the real abort reason.
This commit is contained in:
@@ -231,6 +231,27 @@ describe("runEvalAgent", () => {
|
||||
});
|
||||
await expect(runEvalAgent({ prompt: "fail" }, { session: makeSession() })).rejects.toThrow("boom");
|
||||
});
|
||||
|
||||
it("surfaces the abort reason when an aborted subagent has empty stderr", async () => {
|
||||
// An aborted subagent returns exitCode 1 with stderr "" and error
|
||||
// undefined; the real reason lives in abortReason. The bridge must not
|
||||
// collapse the failure message to "" (which the Python prelude renders as
|
||||
// the info-free "bridge call '__agent__' failed").
|
||||
mockAgents();
|
||||
vi.spyOn(taskExecutor, "runSubprocess").mockImplementation(async options =>
|
||||
singleResult(options, {
|
||||
exitCode: 1,
|
||||
output: "",
|
||||
stderr: "",
|
||||
aborted: true,
|
||||
abortReason: "Subagent runtime limit exceeded (task.maxRuntimeMs=1000)",
|
||||
}),
|
||||
);
|
||||
|
||||
await expect(runEvalAgent({ prompt: "hello" }, { session: makeSession() })).rejects.toThrow(
|
||||
"Subagent runtime limit exceeded (task.maxRuntimeMs=1000)",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("agent() through eval runtimes", () => {
|
||||
|
||||
@@ -280,7 +280,7 @@ export async function runEvalAgent(args: unknown, options: EvalAgentBridgeOption
|
||||
|
||||
if (result.exitCode !== 0 || result.error) {
|
||||
const failureMessage =
|
||||
result.error ?? result.stderr ?? result.abortReason ?? `agent() subagent '${agentName}' failed.`;
|
||||
result.error || result.stderr || result.abortReason || `agent() subagent '${agentName}' failed.`;
|
||||
throw new ToolError(failureMessage);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user