Skip to content

feat(desktop): Actionログの自動ポーリングとRe-run後即時更新#73

Merged
MocA-Love merged 10 commits intomainfrom
feat/action-logs-polling
Apr 4, 2026
Merged

feat(desktop): Actionログの自動ポーリングとRe-run後即時更新#73
MocA-Love merged 10 commits intomainfrom
feat/action-logs-polling

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

@MocA-Love MocA-Love commented Apr 4, 2026

概要

#72 で追加した Action Logs ペインに、自動ポーリングと Re-run 後の即時更新機能を追加。

変更内容

  • 3秒間隔の自動ポーリング: 未完了ステップがある間、ジョブステータスとログを自動リフレッシュ。全ステップ完了で停止
  • Re-run後の即時更新: ActionLogsペイン内・ReviewPanel両方のRe-runで getJobLogs キャッシュをinvalidateして即座に反映
  • 実行中ジョブ対応: ログAPIは完了後のみ利用可能なため、実行中はステップメタデータ(ステータスアイコン・スピナー)を表示し、完了ステップから順次ログを取得

技術的な背景

GitHub REST APIは実行中ジョブのログストリーミングを提供していない(404が返る)。そのため、ステータスのポーリング + 完了ステップのログ一括取得を組み合わせた方式を採用。

テストプラン

  • Re-run実行後、ActionLogsタブのステータスが即座にリセットされることを確認
  • ReviewタブのRe-runでもActionLogsタブが更新されることを確認
  • 実行中のジョブでスピナーが表示され、完了したステップからログが順次表示されることを確認
  • 全ステップ完了後にポーリングが停止することを確認

Summary by CodeRabbit

リリースノート

  • 新機能

    • ブラウザペインのHTMLフルスクリーンモード対応(ツールバーを自動非表示)
    • ポップアップウィンドウの改善されたサポート
    • GitHubジョブステータスの高速化(ポーリング間隔を10秒から3秒に短縮)
  • 改善

    • ジョブログの詳細情報表示向上(ジョブのステータスと結論を表示)
    • ブラウザペーン内動画プレイヤーのフルスクリーン対応改善

- 3秒間隔でジョブステータスとログをポーリング(全ステップ完了で停止)
- Re-run実行後にgetJobLogsクエリをinvalidateして即座に更新
- ReviewPanel側のRe-runでもActionLogsタブのキャッシュを無効化
- 実行中ジョブではメタデータのみ取得(ログAPIは完了後のみ利用可能)
- 完了ステップから順次ログを表示するUX
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 4, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e9ee3d56-3d2e-4248-acb8-211c166a0f78

📥 Commits

Reviewing files that changed from the base of the PR and between 955ca2d and d845fd8.

📒 Files selected for processing (17)
  • apps/desktop/src/lib/trpc/routers/browser/browser.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.ts
  • apps/desktop/src/lib/trpc/routers/workspaces/utils/github/index.ts
  • apps/desktop/src/main/lib/browser/browser-manager.ts
  • apps/desktop/src/renderer/hooks/useBrowserFullscreenHandler.ts
  • apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts
  • apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.ts
  • apps/desktop/src/renderer/routes/_authenticated/_dashboard/layout.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ActionLogsPane/ActionLogsPane.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/BrowserPane.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/hooks/usePersistentWebview/usePersistentWebview.ts
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/components/BasePaneWindow/BasePaneWindow.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx
  • apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/components/CheckSteps/CheckSteps.tsx
  • apps/desktop/src/renderer/stores/browser-fullscreen.ts

📝 Walkthrough

Walkthrough

このPRは、ブラウザペインのHTML全画面モード機能を実装します。メインプロセスで全画面イベントを検出し、TRPC購読経由でレンダラープロセスに通知し、グローバル状態を管理してUIを反応させます。また、GitHubジョブログのポーリング間隔を短縮しました。

Changes

Cohort / File(s) Summary
ブラウザ全画面機能
apps/desktop/src/main/lib/browser/browser-manager.ts, apps/desktop/src/lib/trpc/routers/browser/browser.ts, apps/desktop/src/renderer/hooks/useBrowserFullscreenHandler.ts, apps/desktop/src/renderer/stores/browser-fullscreen.ts
全画面状態を追跡し、イベントを発行・購読し、グローバル状態で管理するための新規実装。setupFullscreenHandler()でフルスクリーンイベントをリッスンし、onFullscreenChangeTRPC購読で状態更新を配信、useBrowserFullscreenStoreで状態集約。
UIコンポーネント全画面統合
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/BrowserPane.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/components/BasePaneWindow/BasePaneWindow.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/index.tsx
全画面状態に応じてツールバーブックマークバー、ヘッダーを表示/非表示制御。hideToolbarプロップを追加、useBrowserFullscreenStoreから全画面状態を読み取り、条件付きレンダリング実装。
Webview全画面API上書き
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/BrowserPane/hooks/usePersistentWebview/usePersistentWebview.ts
全画面API(requestFullscreenexitFullscreenなど)をオーバーライドするゲストページスクリプト注入(147行追加)。視覚的にWebview内に全画面を留め、動画プレーヤーコンテナを検出してビューポート占有、リサイズイベント発行。
GitHubジョブログ/ステータス改善
apps/desktop/src/lib/trpc/routers/workspaces/procedures/git-status.ts, apps/desktop/src/lib/trpc/routers/workspaces/utils/github/github.ts, apps/desktop/src/lib/trpc/routers/workspaces/utils/github/index.ts
getJobLogsクエリ追加、getJobStatusesを複数URL対応に更新。fetchStructuredJobLogsの戻り値をStructuredJobResult(メタデータ+steps含む)に変更。fetchJobStatusesで並列ジョブ照会追加。
GitHubステータスポーリング時間短縮
apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.ts, apps/desktop/src/renderer/lib/githubQueryPolicy/githubQueryPolicy.test.ts
ACTIVE_GITHUB_STATUS_STALE_TIME_MSACTIVE_GITHUB_STATUS_REFETCH_INTERVAL_MS10_000から3_000に短縮。
アクションログ&チェックステップ更新
apps/desktop/src/renderer/screens/main/components/WorkspaceView/ContentView/TabsContent/TabView/ActionLogsPane/ActionLogsPane.tsx, apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/components/CheckSteps/CheckSteps.tsx
JobStepsPropsjobConclusion追加、ジョブ初期化をjobsからinitialJobsに変更、ライブチェックデータで上書き。ポーリング時間を15_000から3_000に短縮、キャッシュ無効化ロジック更新。
レビューパネル キャッシュ無効化
apps/desktop/src/renderer/screens/main/components/WorkspaceView/RightSidebar/ChangesView/components/ReviewPanel/ReviewPanel.tsx
ワークフロー再実行後にgetJobLogsキャッシュを無効化。
グローバルハンドラ登録
apps/desktop/src/renderer/routes/_authenticated/_dashboard/layout.tsx
DashboardLayoutuseBrowserFullscreenHandler()マウント追加、グローバルリスナーセットアップ拡張。

Sequence Diagram(s)

sequenceDiagram
    participant User as ユーザー
    participant BrowserPane as BrowserPane
    participant WebView as WebView
    participant BrowserMgr as BrowserManager
    participant TRPC as TRPC購読
    participant Hook as useBrowserFullscreenHandler
    participant Store as useBrowserFullscreenStore
    participant UI as UIコンポーネント

    User->>WebView: HTML全画面リクエスト
    WebView->>WebView: Fullscreen API上書きシム実行
    WebView->>BrowserMgr: enter-html-full-screen発火
    BrowserMgr->>BrowserMgr: fullscreenPaneId更新
    BrowserMgr->>TRPC: fullscreen-change イベント発行
    TRPC->>Hook: {paneId, isFullscreen: true}配信
    Hook->>Store: setFullscreenPane(paneId)
    Store->>BrowserPane: fullscreenPaneId更新通知
    BrowserPane->>BrowserPane: hideToolbar=true, BookmarkBar非表示
    BrowserPane->>UI: ツールバー/ヘッダー非表示制御
    
    User->>WebView: Esc キー(全画面終了)
    WebView->>BrowserMgr: leave-html-full-screen発火
    BrowserMgr->>TRPC: fullscreen-change イベント発行
    TRPC->>Hook: {paneId, isFullscreen: false}配信
    Hook->>Store: setFullscreenPane(null)
    Store->>UI: ツールバー/ヘッダー表示復元
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 全画面の世界へホップ、ツールバー消えて、
ビデオ映画館モード、Webビュー内で輝く。
イベントの波、ストアで受け止め、
ポーリング加速、ステータス素早く。
ウサギの魔法で、画面は自由~🎬

✨ 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 feat/action-logs-polling

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

- getJobLogsの返り値にjobStatus/jobConclusionを追加
- サイドバーのジョブアイコンがポーリングで動的に更新
- ジョブヘッダーのステータスもライブ更新
- 実行中→完了の遷移をリアルタイムに反映
- ジョブ完了までは3秒ポーリング、完了で停止
- 新しいtRPCプロシージャ getJobStatuses: 全ジョブのステータスを並列取得
- サイドバーのアイコンが選択中以外のジョブもリアルタイム更新
- Re-run後に getJobStatuses もinvalidateして即座に反映
- JobStepsコンポーネントからonJobStatusChangeコールバックを削除(不要に)
- ACTIVE_GITHUB_STATUS_REFETCH_INTERVAL_MS: 10s → 3s
- ACTIVE_GITHUB_STATUS_STALE_TIME_MS: 10s → 3s
- CheckSteps: 15s → 3s
- ActionLogsタブと同じ3秒間隔で統一
- getJobStatuses廃止 → getGitHubStatusキャッシュを共有
- ReviewタブとActionLogsタブが完全に同じデータソースを参照
- ステータス変化のタイミングが完全一致
- API呼び出し数を削減
- ジョブの名前マッチで最新のcheck URLに自動更新(Re-runでURL変更に対応)
- Re-run後も古いURLに固定されず、新しいrunのジョブを自動追跡
- サイドバーのステータスもlive checksから直接反映
- window.open()をElectron子ウィンドウで開きOAuth認証フローに対応
- Fullscreen APIをJS側でオーバーライドしpane内で動画全画面を実現
- BrowserWindow全画面化を防止し、動画プレーヤーだけをfixed表示
- ESCキーで全画面終了、中間コンテナも含め全てのサイズを復元
@MocA-Love MocA-Love self-assigned this Apr 4, 2026
@MocA-Love MocA-Love marked this pull request as ready for review April 4, 2026 05:54
@MocA-Love MocA-Love merged commit feb35ce into main Apr 4, 2026
6 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