Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 41 additions & 1 deletion apps/desktop/src/main/lib/agent-setup/agent-wrappers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ describe("agent-wrappers copilot", () => {
expect(wrapper).toContain('_superset_emit_event "Start"');
expect(wrapper).toContain('_superset_emit_event "PermissionRequest"');
expect(wrapper).toContain(
`"$REAL_BIN" -c 'notify=["bash","${path.join(TEST_HOOKS_DIR, "notify.sh")}"]' "$@"`,
`"$REAL_BIN" --enable codex_hooks -c 'notify=["bash","${path.join(TEST_HOOKS_DIR, "notify.sh")}"]' "$@"`,
);
expect(wrapper).toContain("SUPERSET_CODEX_START_WATCHER_PID");
expect(wrapper).toContain('kill "$SUPERSET_CODEX_START_WATCHER_PID"');
Expand All @@ -209,6 +209,46 @@ describe("agent-wrappers copilot", () => {
expect(wrapper).toContain(execLine);
});

it("forwards codex_hooks enablement through the codex wrapper for manual launches", () => {
const realBinDir = path.join(TEST_ROOT, "real-bin");
const realCodex = path.join(realBinDir, "codex");
const wrapperPath = path.join(TEST_BIN_DIR, "codex");
const argsFile = path.join(TEST_ROOT, "codex-args.txt");

mkdirSync(realBinDir, { recursive: true });
writeFileSync(
realCodex,
`#!/bin/bash
printf '%s\n' "$@" > "${argsFile}"
exit 0
`,
{ mode: 0o755 },
);
chmodSync(realCodex, 0o755);

createCodexWrapper();

execFileSync(wrapperPath, ["exec", "Reply with exactly OK."], {
env: {
...process.env,
PATH: `${TEST_BIN_DIR}:${realBinDir}:${process.env.PATH || ""}`,
SUPERSET_TAB_ID: "tab-1",
},
encoding: "utf-8",
});

expect(readFileSync(argsFile, "utf-8")).toBe(
`${[
"--enable",
"codex_hooks",
"-c",
`notify=["bash","${path.join(TEST_HOOKS_DIR, "notify.sh")}"]`,
"exec",
"Reply with exactly OK.",
].join("\n")}\n`,
);
});

it("creates mastracode wrapper passthrough", () => {
createMastraWrapper();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if [ -n "$SUPERSET_TAB_ID" ] && [ -f "{{NOTIFY_PATH}}" ]; then
SUPERSET_CODEX_START_WATCHER_PID=$!
fi

"$REAL_BIN" -c 'notify=["bash","{{NOTIFY_PATH}}"]' "$@"
"$REAL_BIN" --enable codex_hooks -c 'notify=["bash","{{NOTIFY_PATH}}"]' "$@"
SUPERSET_CODEX_STATUS=$?

if [ -n "$SUPERSET_CODEX_START_WATCHER_PID" ]; then
Expand Down
Loading