refactor: remove /review command and clean up unused imports

This commit is contained in:
Eyejoker
2026-03-29 21:17:14 +09:00
parent 787c05a561
commit 4f87c840ba
3 changed files with 0 additions and 115 deletions

View File

@@ -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);

View File

@@ -175,7 +175,6 @@ function makeDeps(
formatMessages: vi.fn().mockReturnValue('<formatted>'),
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();

View File

@@ -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<string | null>;
/** 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);