test(core): align tool contract expectations (#39172)

This commit is contained in:
Kit Langton 2026-07-27 20:48:29 -04:00 committed by GitHub
commit 470e360942
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 333 additions and 116 deletions

View file

@ -201,9 +201,11 @@ export const Plugin = {
const settleShell = Effect.fn("ShellTool.settleShell")(function* () {
const final = yield* shell.wait(info.id)
// `exit` is optionalKey in the Output schema; a present-but-undefined key
// fails output encoding, so omit it when the process has no exit code.
if (final.status === "timeout") {
return {
exit: final.exit,
...(final.exit !== undefined ? { exit: final.exit } : {}),
output: `Command exceeded timeout of ${timeout} ms. Retry with a larger timeout if the command is expected to take longer.`,
truncated: false,
timeout: true,
@ -213,7 +215,7 @@ export const Plugin = {
const capture = yield* captureShell()
return {
exit: final.exit,
...(final.exit !== undefined ? { exit: final.exit } : {}),
output: capture.output,
truncated: capture.truncated,
status: "completed" as const,