aboutsummaryrefslogtreecommitdiff
path: root/src/integration/assets/omp
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-06-16 18:25:02 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-06-16 18:25:02 +0300
commit5ffaf4f32b299bd904c9dbfc02e77252cbfb0220 (patch)
tree698bf736a4a624909820010df038e4988ad33244 /src/integration/assets/omp
parentebff34063a55446c7390e12ec84acd2dad04ce43 (diff)
fix: isolate omp hook state to ui sessions
refs #614
Diffstat (limited to 'src/integration/assets/omp')
-rw-r--r--src/integration/assets/omp/herdr-agent-state.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/integration/assets/omp/herdr-agent-state.ts b/src/integration/assets/omp/herdr-agent-state.ts
index c2bec682..a6428cdd 100644
--- a/src/integration/assets/omp/herdr-agent-state.ts
+++ b/src/integration/assets/omp/herdr-agent-state.ts
@@ -197,6 +197,7 @@ export default function (pi) {
let lastMessage: string | undefined;
let idleTimer: ReturnType<typeof setTimeout> | undefined;
let retryTimer: ReturnType<typeof setTimeout> | undefined;
+ let rootSession = false;
function clearTimer(timer: ReturnType<typeof setTimeout> | undefined) {
if (timer) {
@@ -267,6 +268,9 @@ export default function (pi) {
}
pi.events.on("herdr:blocked", (data) => {
+ if (!rootSession) {
+ return;
+ }
if (!data?.active) {
blockedCount = Math.max(0, blockedCount - 1);
if (blockedCount === 0) {
@@ -283,11 +287,18 @@ export default function (pi) {
});
pi.on("session_start", (_event, ctx) => {
+ rootSession = ctx?.hasUI === true;
+ if (!rootSession) {
+ return;
+ }
updateSessionRef(ctx);
publishState(true);
});
pi.on("agent_start", () => {
+ if (!rootSession) {
+ return;
+ }
clearPendingTimers();
clearFailureState();
agentActive = true;
@@ -295,6 +306,9 @@ export default function (pi) {
});
pi.on("agent_end", (event) => {
+ if (!rootSession) {
+ return;
+ }
if (!agentActive) {
// OMP can emit duplicate/late end events while auto-retry is already
// holding the pane in Working. Do not let an unqualified duplicate end
@@ -314,6 +328,9 @@ export default function (pi) {
});
pi.on("session_shutdown", async () => {
+ if (!rootSession) {
+ return;
+ }
clearPendingTimers();
await releaseAgent();
});