fix(core): simplify shell execution boundary (#39530)

This commit is contained in:
Aiden Cline 2026-07-29 11:16:45 -05:00 committed by GitHub
commit 813c41ff6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 62 deletions

View file

@ -59,6 +59,13 @@ describe("shell", () => {
expect(ShellSelect.args("/usr/bin/fish", "echo hi")).toEqual(["-c", "echo hi"])
expect(ShellSelect.args("/bin/zsh", "echo hi")).toEqual(["-c", "echo hi"])
expect(ShellSelect.args("/bin/bash", "echo hi")).toEqual(["-c", "echo hi"])
expect(ShellSelect.args("pwsh", "Write-Output hi")).toEqual([
"-NoLogo",
"-NoProfile",
"-NonInteractive",
"-Command",
"Write-Output hi",
])
})
if (process.platform === "win32") {

View file

@ -346,33 +346,6 @@ describe("ShellTool", () => {
),
)
it.live("reports external command arguments as advisory warnings without enforcing approval", () =>
Effect.acquireUseRelease(
Effect.promise(() => Promise.all([tmpdir(), tmpdir()])),
([active, outside]) => {
reset()
denyAction = "external_directory"
const target = path.join(outside.path, "secret.txt")
return withSession(active.path, (registry) => executeTool(registry, call({ command: `cat ${target}` }))).pipe(
Effect.andThen((settled) =>
Effect.sync(() => {
expect(assertions.map((item) => item.action)).toEqual(["shell"])
expect(settled.metadata).not.toHaveProperty("warnings")
expect(settled.content?.[1]).toMatchObject({
type: "text",
text: expect.stringContaining("Warnings:"),
})
}),
),
)
},
([active, outside]) =>
Effect.promise(() =>
Promise.all([active[Symbol.asyncDispose](), outside[Symbol.asyncDispose]()]).then(() => undefined),
),
),
)
it.live("keeps non-zero exits useful", () =>
Effect.acquireUseRelease(
Effect.promise(() => tmpdir()),