fix(team-mode): gate member wake prompts

This commit is contained in:
YeonGyu-Kim
2026-05-15 11:29:52 +09:00
parent 174cbd0fbd
commit f1a62a9cd1
3 changed files with 70 additions and 14 deletions
@@ -282,6 +282,34 @@ describe("createTeamSendMessageTool", () => {
expect(calls[0]?.directory).toBe(resolveBaseDir(fixture.config))
})
test("#given recipient OpenCode session is busy #when team_send_message attempts live delivery #then it leaves the message unread without starting another reply", async () => {
// given
const fixture = await createTeamFixture()
let promptCalls = 0
const client = {
session: {
status: async () => ({ data: { [fixture.memberTwoSessionId]: { type: "busy" } } }),
promptAsync: async () => {
promptCalls += 1
},
},
}
const liveTool = createTeamSendMessageTool(fixture.config, client)
// when
await liveTool.execute({
teamRunId: fixture.teamRunId,
to: "m2",
body: "ping while busy",
}, fixture.toolContext(fixture.memberOneSessionId))
// then
expect(promptCalls).toBe(0)
const unread = await listUnreadMessages(fixture.teamRunId, "m2", fixture.config)
expect(unread).toHaveLength(1)
expect(unread[0]?.body).toBe("ping while busy")
})
test("live delivery pins the recipient's resolved subagent_type and model on promptAsync", async () => {
// given
const fixture = await createTeamFixture()