From 4f87c840ba682b119001f230dd2f877b0b7bce5d Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Sun, 29 Mar 2026 21:17:14 +0900 Subject: [PATCH] refactor: remove /review command and clean up unused imports --- src/message-runtime.ts | 21 --------- src/session-commands.test.ts | 82 ------------------------------------ src/session-commands.ts | 12 ------ 3 files changed, 115 deletions(-) diff --git a/src/message-runtime.ts b/src/message-runtime.ts index 594f650..e60f19e 100644 --- a/src/message-runtime.ts +++ b/src/message-runtime.ts @@ -46,11 +46,6 @@ import { import { runAgentForGroup } from './message-agent-executor.js'; import { MessageTurnController } from './message-turn-controller.js'; import { createSuppressToken } from './output-suppression.js'; -import { - formatRoomReviewReadyMessage, - markRoomReviewReady, -} from './paired-execution-context.js'; -import { buildRoomRoleContext } from './room-role-context.js'; import { extractSessionCommand, handleSessionCommand, @@ -658,22 +653,6 @@ export function createMessageRuntime(deps: MessageRuntimeDeps): { isTriggerAllowed(chatJid, msg.sender, loadSenderAllowlist()))) ); }, - // Session commands are explicit control events, so owner-only and - // reviewer-only commands resolve against the target role rather than - // whichever service happened to pick up the slash command first. - markReviewReady: async () => { - const lease = getEffectiveChannelLease(chatJid); - const roomRoleContext = buildRoomRoleContext( - lease, - lease.owner_service_id, - ); - const result = markRoomReviewReady({ - group, - chatJid, - roomRoleContext, - }); - return formatRoomReviewReadyMessage(result); - }, resetPairedTask: () => { if (isPairedRoomJid(chatJid)) { const task = getLatestOpenPairedTaskForChat(chatJid); diff --git a/src/session-commands.test.ts b/src/session-commands.test.ts index 6f7a473..12948f3 100644 --- a/src/session-commands.test.ts +++ b/src/session-commands.test.ts @@ -175,7 +175,6 @@ function makeDeps( formatMessages: vi.fn().mockReturnValue(''), isAdminSender: vi.fn().mockReturnValue(false), canSenderInteract: vi.fn().mockReturnValue(true), - markReviewReady: vi.fn().mockResolvedValue('Review snapshot updated.'), killProcess: vi.fn().mockReturnValue(false), ...overrides, }; @@ -235,88 +234,7 @@ describe('handleSessionCommand', () => { ); }); - it('handles authorized /review without invoking the agent', async () => { - const deps = makeDeps({ - markReviewReady: vi - .fn() - .mockResolvedValue('Review snapshot updated.\n- Task: paired-task-1'), - }); - const result = await handleSessionCommand({ - missedMessages: [makeMsg('/review')], - isMainGroup: true, - groupName: 'test', - triggerPattern: trigger, - timezone: 'UTC', - deps, - }); - - expect(result).toEqual({ handled: true, success: true }); - expect(deps.markReviewReady).toHaveBeenCalledWith('msg-1'); - expect(deps.runAgent).not.toHaveBeenCalled(); - expect(deps.advanceCursor).toHaveBeenCalledWith('100'); - expect(deps.sendMessage).toHaveBeenCalledWith( - 'Review snapshot updated.\n- Task: paired-task-1', - ); - }); - - it('handles authorized /review-ready as an alias without invoking the agent', async () => { - const deps = makeDeps({ - markReviewReady: vi - .fn() - .mockResolvedValue('Review snapshot updated.\n- Task: paired-task-1'), - }); - - const result = await handleSessionCommand({ - missedMessages: [makeMsg('/review-ready')], - isMainGroup: true, - groupName: 'test', - triggerPattern: trigger, - timezone: 'UTC', - deps, - }); - - expect(result).toEqual({ handled: true, success: true }); - expect(deps.markReviewReady).toHaveBeenCalledWith('msg-1'); - expect(deps.runAgent).not.toHaveBeenCalled(); - expect(deps.advanceCursor).toHaveBeenCalledWith('100'); - expect(deps.sendMessage).toHaveBeenCalledWith( - 'Review snapshot updated.\n- Task: paired-task-1', - ); - }); - - it('sends the pending review message when owner workspace is not ready yet', async () => { - const deps = makeDeps({ - markReviewReady: vi - .fn() - .mockResolvedValue( - [ - 'Review request recorded, but the owner workspace is not ready yet.', - '- Task: paired-task-1', - 'The task stays review_pending until the owner workspace is prepared.', - ].join('\n'), - ), - }); - - const result = await handleSessionCommand({ - missedMessages: [makeMsg('/review')], - isMainGroup: true, - groupName: 'test', - triggerPattern: trigger, - timezone: 'UTC', - deps, - }); - - expect(result).toEqual({ handled: true, success: true }); - expect(deps.markReviewReady).toHaveBeenCalledWith('msg-1'); - expect(deps.sendMessage).toHaveBeenCalledWith( - [ - 'Review request recorded, but the owner workspace is not ready yet.', - '- Task: paired-task-1', - 'The task stays review_pending until the owner workspace is prepared.', - ].join('\n'), - ); - }); it('sends denial to interactable sender in non-main group', async () => { const deps = makeDeps(); diff --git a/src/session-commands.ts b/src/session-commands.ts index c8611cb..944184e 100644 --- a/src/session-commands.ts +++ b/src/session-commands.ts @@ -33,7 +33,6 @@ export function extractSessionCommand( const text = normalizeSessionCommandText(content, triggerPattern); if (text === '/compact') return '/compact'; if (text === '/clear') return '/clear'; - if (text === '/review' || text === '/review-ready') return '/review'; if (text === '/stop') return '/stop'; return null; } @@ -79,7 +78,6 @@ export interface SessionCommandDeps { isAdminSender: (msg: NewMessage) => boolean; /** Whether the denied sender would normally be allowed to interact (for denial messages). */ canSenderInteract: (msg: NewMessage) => boolean; - markReviewReady: () => Promise; /** Reset/complete the active paired task so ping-pong stops. */ resetPairedTask?: () => void; /** Kill the currently running agent process for this group. Returns true if a process was killed. */ @@ -169,16 +167,6 @@ export async function handleSessionCommand(opts: { return { handled: true, success: true }; } - if (command === '/review') { - const result = await deps.markReviewReady(); - deps.advanceCursor(cmdMsg.timestamp); - await deps.sendMessage( - result ?? - 'Review is unavailable for this room. Paired workspaces require a configured project workDir.', - ); - return { handled: true, success: true }; - } - if (command === '/stop') { const killed = deps.killProcess(); deps.advanceCursor(cmdMsg.timestamp);