aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/herdr-agent-state.test.ts
diff options
context:
space:
mode:
authorJJ Liebig <jonathan.liebig@gmail.com>2026-09-12 15:52:18 +0400
committerGitHub <noreply@github.com>2026-09-12 13:52:18 +0200
commita5d5f6f654a32b27b2bd4dd8edd82f6795359269 (patch)
tree0b54a0fb4c1a136dff8224de617c8403756df19a /src/integration/assets/herdr-agent-state.test.ts
parentcc36a2943e85134768631d6d289e331c0edb940d (diff)
fix: ignore nested OMP session reports (#3994)
refs #2593
Diffstat (limited to 'src/integration/assets/herdr-agent-state.test.ts')
-rw-r--r--src/integration/assets/herdr-agent-state.test.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/integration/assets/herdr-agent-state.test.ts b/src/integration/assets/herdr-agent-state.test.ts
index 48cc8708..19b36d94 100644
--- a/src/integration/assets/herdr-agent-state.test.ts
+++ b/src/integration/assets/herdr-agent-state.test.ts
@@ -11,6 +11,7 @@ const originalEnvironment = {
HERDR_OMP_IDLE_DEBOUNCE_MS: process.env.HERDR_OMP_IDLE_DEBOUNCE_MS,
HERDR_PANE_ID: process.env.HERDR_PANE_ID,
HERDR_SOCKET_PATH: process.env.HERDR_SOCKET_PATH,
+ OMPCODE: process.env.OMPCODE,
};
let server: Server | undefined;
@@ -229,6 +230,33 @@ for (const integration of integrations) {
});
}
+test("OMP ignores nested sessions launched inside another OMP shell", async () => {
+ const requests = await startRecordingServer("omp-nested");
+ process.env.OMPCODE = "1";
+ const { handlers, pi } = createExtensionHarness();
+
+ const { default: install } = await importFresh("./omp/herdr-agent-state.ts");
+ install(pi);
+
+ // OMP sets OMPCODE on every shell it spawns. A nested `omp` inherits it and
+ // must not claim the pane's session for its short-lived conversation.
+ expect(handlers.size).toBe(0);
+ await handlers.get("session_start")?.(
+ { reason: "startup" },
+ {
+ hasUI: true,
+ isIdle: () => true,
+ sessionManager: {
+ getSessionFile: () => "/tmp/omp-nested.jsonl",
+ getSessionId: () => "omp-nested",
+ },
+ },
+ );
+ await Bun.sleep(25);
+
+ expect(requests).toEqual([]);
+});
+
test("OMP accepts POSIX and Windows session paths", async () => {
const { isAbsoluteSessionPath } = await importFresh("./omp/herdr-agent-state.ts");