mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Show only commands in Codex shell tool calls (#2029)
* fix(codex): hide shell launchers from command summaries Codex only unwrapped POSIX shells from /bin. Commands launched through /usr/bin/zsh therefore exposed the wrapper in the tool-call row. * test(codex): preserve shell wrapper path coverage
This commit is contained in:
@@ -51,23 +51,26 @@ describe("codex tool-call mapper", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("unwraps shell wrapper strings for commandExecution", () => {
|
||||
const item = expectMapped(
|
||||
mapCodexToolCallFromThreadItem({
|
||||
type: "commandExecution",
|
||||
id: "codex-call-wrapper-string",
|
||||
status: "running",
|
||||
command: '/bin/zsh -lc "echo hello"',
|
||||
cwd: "/tmp/repo",
|
||||
}),
|
||||
);
|
||||
it.each(['/bin/zsh -lc "echo hello"', '/usr/bin/zsh -lc "echo hello"'])(
|
||||
"unwraps zsh wrapper strings for commandExecution: %s",
|
||||
(command) => {
|
||||
const item = expectMapped(
|
||||
mapCodexToolCallFromThreadItem({
|
||||
type: "commandExecution",
|
||||
id: "codex-call-wrapper-string",
|
||||
status: "running",
|
||||
command,
|
||||
cwd: "/tmp/repo",
|
||||
}),
|
||||
);
|
||||
|
||||
expect(item.detail).toEqual({
|
||||
type: "shell",
|
||||
command: "echo hello",
|
||||
cwd: "/tmp/repo",
|
||||
});
|
||||
});
|
||||
expect(item.detail).toEqual({
|
||||
type: "shell",
|
||||
command: "echo hello",
|
||||
cwd: "/tmp/repo",
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it("unwraps pwsh wrapper strings for commandExecution on Windows", () => {
|
||||
const item = expectMapped(
|
||||
|
||||
@@ -221,7 +221,9 @@ const CodexThreadItemSchema = z.discriminatedUnion("type", [
|
||||
|
||||
function maybeUnwrapShellWrapperCommand(command: string): string {
|
||||
const trimmed = command.trim();
|
||||
const unixWrapperMatch = trimmed.match(/^(?:\/bin\/)?(?:zsh|bash|sh)\s+-(?:lc|c)\s+([\s\S]+)$/);
|
||||
const unixWrapperMatch = trimmed.match(
|
||||
/^(?:(?:\/[^/\s]+)*\/)?(?:zsh|bash|sh)\s+-(?:lc|c)\s+([\s\S]+)$/,
|
||||
);
|
||||
if (unixWrapperMatch) {
|
||||
const candidate = unixWrapperMatch[1]?.trim() ?? "";
|
||||
if (!candidate) {
|
||||
|
||||
Reference in New Issue
Block a user