From 5282237027a0e9766697b57f1e8c475f4c3cac38 Mon Sep 17 00:00:00 2001 From: "claude (blind_chess)" Date: Mon, 18 May 2026 20:03:37 -0400 Subject: [PATCH] refactor(bot): hoist the rejection announcement to a single local Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/server/src/bot/driver.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/bot/driver.ts b/packages/server/src/bot/driver.ts index 4e561b9..ddb1e8a 100644 --- a/packages/server/src/bot/driver.ts +++ b/packages/server/src/bot/driver.ts @@ -162,7 +162,8 @@ export class BotDriver { return { kind: 'done' }; } if (result.kind === 'announce') { - const text = result.announcements[0]!.text; + const rejection = result.announcements[0]!; + const text = rejection.text; if (text === 'wont_help' || text === 'illegal_move' || text === 'no_such_piece' || text === 'no_legal_moves') { // Attempted-move announcements are audience 'both'. The bot's @@ -172,7 +173,6 @@ export class BotDriver { // so removing the announcement is safe. The whole decision cycle // runs before ws.ts broadcasts, so this pop always happens before // any broadcast. - const rejection = result.announcements[0]!; const anns = this.game.announcements; if (anns[anns.length - 1] === rejection) anns.pop(); return {