Files
oh-my-opencode/src/features/tmux-subagent/polling-manager-event-session-id.test.ts
T
YeonGyu-Kim 4da48555ee fix(plugin): normalize event session ids
Handle OpenCode session events that carry the session ID under properties.info.id or properties.info.sessionID so background tasks and continuation hooks do not miss idle/error/delete events.

Add regression coverage for nested session.idle events completing background tasks and waking continuation hooks.
2026-05-12 12:32:26 +09:00

44 lines
1.2 KiB
TypeScript

import { describe, expect, test } from "bun:test"
import { TmuxPollingManager } from "./polling-manager"
import type { TrackedSession } from "./types"
describe("TmuxPollingManager event session ids", () => {
test("#given legacy message.part.updated properties #when handling activity #then part session id increments activity version", () => {
const sessions = new Map<string, TrackedSession>()
sessions.set("ses-part-only", {
sessionId: "ses-part-only",
paneId: "%1",
description: "test",
createdAt: new Date(),
lastSeenAt: new Date(),
closePending: false,
closeRetryCount: 0,
activityVersion: 0,
})
const client = {
session: {
status: async () => ({ data: {} }),
messages: async () => ({ data: [] }),
},
}
const manager = new TmuxPollingManager(client as never, sessions, async () => {})
manager.handleEvent({
type: "message.part.updated",
properties: {
part: {
id: "part-1",
messageID: "msg-1",
sessionID: "ses-part-only",
type: "text",
text: "working",
},
},
})
expect(sessions.get("ses-part-only")?.activityVersion).toBe(1)
})
})