Skip to content

Develop => main - #594

Merged
tegnike merged 5 commits into
mainfrom
develop
Aug 4, 2026
Merged

Develop => main#594
tegnike merged 5 commits into
mainfrom
develop

Conversation

@tegnike

@tegnike tegnike commented Aug 4, 2026

Copy link
Copy Markdown
Owner

新機能

  • /api/v1/speakspeechSessionId を追加し、ストリーミング生成した回答を複数リクエストへ分割しても、同じ発話セッションへ送信順で追加できるようにしました。
  • MessageReceiver向けの認証付きSSE購読を追加し、message_queuedcommand_queuedstop_requested を受信して対象データを即時取得できるようにしました。

改善

  • SSE接続中の常時ポーリングを15秒ごとの安全確認へ減らし、切断中だけ1秒間隔のポーリングへフォールバックするようにしました。
  • SSE切断時は250ミリ秒から最大5秒の指数バックオフで再接続し、安定接続後に待機時間をリセットするようにしました。
  • 同じ speechSessionId の発話は、priority: high の場合もFIFOを維持するようにしました。

バグ修正

  • interrupt: true の停止コマンドと後続発話をReceiverごとの単一runnerで直列処理し、通信順の逆転で新しい発話まで停止する競合を防ぎました。

テスト

  • SSEのイベント解析、通知の集約、切断時フォールバック、指数バックオフをカバーするテストを追加しました。
  • speechSessionId の入力検証、同一セッションの送信順、イベント通知をカバーするAPIテストを追加・更新しました。
  • 遅延したコマンド・メッセージ応答でもコマンド適用後に発話を処理する回帰テストを追加し、関連3スイート・57テストと本番ビルドの成功を確認しました。
  • 修正後のリリースPRでもsecret検査、lint/format、unit test、通常E2E、production E2E、Cloudflare deployがすべて成功しました。

ドキュメント・翻訳

  • Receiver Registry APIと外部Presentation APIの内部仕様へ、SSE受信と分割発話の契約を反映しました。
  • 公開ドキュメントへ speechSessionId、ライブSSEフレーム、通知後の取得契約、フォールバック条件を日本語・英語・中国語で反映し、docsのmainへマージしました。

その他

  • アプリ表示バージョンを 2.70.0 に更新しました。

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

変更概要

/api/v1/speakspeechSessionIdを追加し、同一セッションの発話をFIFOで処理します。Receiverは認証付きSSEを中心にイベントを受信し、切断時のみポーリングと指数バックオフ再接続を使用します。

Changes

Receiver配信と発話セッション

Layer / File(s) Summary
発話セッションFIFO処理
src/pages/api/v1/speak.ts, src/features/api/messageGateway.ts, src/features/chat/speechPipeline/speakMessageHandler.ts, src/components/messageReceiver.tsx, src/pages/send-message.tsx, src/__tests__/pages/api/v1/externalApi*.test.ts, docs/receiver-registry-api-spec.md
speechSessionIdを検証してキューへ渡します。同一IDのメッセージを同一セッションとしてFIFOで処理します。
SSEイベント配信
src/features/api/receiverEventStream.ts, src/pages/api/v1/events.ts, src/features/api/messageGateway.ts, src/__tests__/features/api/receiverEventStream.test.ts, src/__tests__/pages/api/v1/externalApiValidation.test.ts
認証付きSSEを解析します。対象イベントを通知し、heartbeat、切断処理、指数バックオフ再接続を実装します。
MessageReceiverのSSE統合
src/components/messageReceiver.tsx, docs/external-presentation-api-spec.md, docs/receiver-registry-api-spec.md
messageReceiverがSSE通知で取得処理を起動します。SSE切断時はポーリングへ切り替え、接続中は15秒間隔で確認します。
リリース情報
src/constants/appVersion.json
アプリケーションバージョンを2.70.0へ更新します。

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client as messageReceiver
  participant SSE as receiverEventStream
  participant API as /api/v1/events
  participant Gateway as messageGateway
  Client->>SSE: Receiver SSEを購読
  SSE->>API: 認証付きGETを実行
  Gateway->>API: messagesまたはcommandsイベントを発行
  API-->>SSE: SSEイベントを送信
  SSE-->>Client: 対象種別の起床通知
  Client->>Gateway: メッセージまたはコマンドを取得
Loading

Possibly related PRs

  • tegnike/aituber-kit#524: messageGateway、外部API、MessageReceiverの基盤変更に直接関連します。
  • tegnike/aituber-kit#587: messageReceiver.tsxと外部APIイベントフローを共有し、ポーリングからSSEへ拡張しています。
  • tegnike/aituber-kit#593: SSE通知とspeechSessionIdによるFIFO処理を同じ変更範囲で扱っています。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed タイトルはdevelopからmainへのマージという実際の変更を示しますが、SSE購読やspeechSessionId追加など主要な変更内容は示していません。
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch develop

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/messageReceiver.tsx`:
- Around line 638-646: Integrate the `safeFetchCommands` and `safeFetchMessages`
runners in `messageReceiver.tsx` into one coalesced runner for each Receiver,
ensuring command draining always completes before message draining, especially
for `interrupt_before_speak`. Update the `stop_requested` and `message_queued`
handling around the affected dispatch path to use this runner, and add
regression coverage with delayed command/message responses verifying commands
are applied before messages.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1b8d8504-bf83-43af-9129-536d3d84c474

📥 Commits

Reviewing files that changed from the base of the PR and between ab89855 and 9cc1498.

📒 Files selected for processing (13)
  • docs/external-presentation-api-spec.md
  • docs/receiver-registry-api-spec.md
  • src/__tests__/features/api/receiverEventStream.test.ts
  • src/__tests__/pages/api/v1/externalApi.test.ts
  • src/__tests__/pages/api/v1/externalApiValidation.test.ts
  • src/components/messageReceiver.tsx
  • src/constants/appVersion.json
  • src/features/api/messageGateway.ts
  • src/features/api/receiverEventStream.ts
  • src/features/chat/speechPipeline/speakMessageHandler.ts
  • src/pages/api/v1/events.ts
  • src/pages/api/v1/speak.ts
  • src/pages/send-message.tsx

Comment thread src/components/messageReceiver.tsx Outdated
@tegnike
tegnike merged commit 4b7c0db into main Aug 4, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant