|
1 | | -// gpt-family workers call run_shell as `shell`. Reactor authz sees that raw |
2 | | -// wire call; the permission middleware sees DynamicToolRunner's |
3 | | -// prepareDispatchedToolCall output, whose coerceShellArgs rebuilds the |
4 | | -// arguments. The authorized retry must match the same envelope at both |
5 | | -// stages. |
| 1 | +// gpt-family workers call run_shell as `shell` with run_shell's own |
| 2 | +// arguments. Reactor authz sees that raw wire call; the permission |
| 3 | +// middleware sees prepareDispatchedToolCall, which renames `shell` to |
| 4 | +// `run_shell` and leaves cwd, timeout, background, and stop in place. |
| 5 | +// The authorized retry must match the same envelope at both stages. |
6 | 6 | import { describe, expect, test } from "bun:test"; |
7 | 7 | import type { ToolCall } from "@intx/types/runtime"; |
8 | 8 |
|
@@ -68,13 +68,21 @@ describe("gpt-family worker authorized retry identity", () => { |
68 | 68 | expect(retryAuthz).toEqual({ effect: "allow" }); |
69 | 69 | expect(store.peek(requestId)?.status).toBe("authorized"); |
70 | 70 |
|
71 | | - // 4. Retry, stage 2: DynamicToolRunner coerces the `shell` call onto |
72 | | - // run_shell, then the posix middleware runs gateToolCall. |
| 71 | + // 4. Retry, stage 2: DynamicToolRunner renames `shell` onto run_shell |
| 72 | + // and keeps the gpt-native arguments, then the posix middleware runs |
| 73 | + // gateToolCall. The grant still matches the authorized envelope. |
73 | 74 | const dispatched = prepareDispatchedToolCall( |
74 | 75 | wireCall("call-2"), |
75 | 76 | "run_shell", |
76 | 77 | ); |
77 | | - expect(dispatched.arguments).not.toEqual(wireCall("x").arguments); |
| 78 | + expect(dispatched.name).toBe("run_shell"); |
| 79 | + expect(dispatched.arguments).toEqual(wireCall("x").arguments); |
| 80 | + expect(dispatched.arguments).toMatchObject({ |
| 81 | + cwd: CWD, |
| 82 | + timeout: 120000, |
| 83 | + background: false, |
| 84 | + stop: "", |
| 85 | + }); |
78 | 86 |
|
79 | 87 | let executed = 0; |
80 | 88 | const result = await gateToolCall( |
|
0 commit comments