feat: workflow の sdk 記述方法を変更#9
Conversation
There was a problem hiding this comment.
Pull request overview
ワーカー側の Claude Agent SDK 利用を ClaudeSDKClient ベースに寄せ、同一セッション内で会話コンテキストを維持したまま「起動→スクショ」など複数ステップを実行できるようにする PR です。あわせて、フロントエンドのログ表示フェーズに launching を追加し、進捗表示を改善しています。
Changes:
ClaudeSDKClientを導入し、同一セッションで dev server 起動とスクリーンショット取得を連続実行するフローを追加- メッセージ/ツールログ処理を
receive_response()ベースに切り出し(analyze/implement 両方) - フロントのログフェーズ表示に
launchingを追加し、文言を調整
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/components/LogPanel.tsx | ログ表示フェーズのラベル更新(cloning 文言変更、launching 追加) |
| docker/worker-implement.py | 実装後の「起動→after スクショ」を ClaudeSDKClient セッション内で分割実行する処理を追加 |
| docker/worker-analyze.py | 「起動→before スクショ」を ClaudeSDKClient セッション内で分割実行する処理に変更 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async def _process_messages(client: ClaudeSDKClient, phase: str) -> None: | ||
| """Process messages from ClaudeSDKClient, emitting logs for a given phase.""" | ||
| current_tool = None | ||
| tool_input_chunks = "" | ||
|
|
There was a problem hiding this comment.
_process_messages() (and the related launch_and_screenshot() flow below) duplicates essentially the same streaming/log parsing logic that also exists in docker/worker-analyze.py. Having two copies makes future SDK/event-shape changes easy to miss in one worker. Consider extracting this into a small shared helper module (e.g., docker/claude_streaming.py) imported by both workers, or factor the common loop to accept an async iterator so both query() and ClaudeSDKClient can reuse the same implementation.
| async def _process_messages(client: ClaudeSDKClient, phase: str) -> None: | ||
| """Process messages from ClaudeSDKClient, emitting logs for a given phase.""" | ||
| current_tool = None | ||
| tool_input_chunks = "" | ||
|
|
There was a problem hiding this comment.
_process_messages() (and launch_and_screenshot() below) duplicates the same Claude streaming/tool-log parsing code that now also exists in docker/worker-implement.py. This duplication increases maintenance cost and the chance that a future SDK change (event types / fields) is applied in only one worker. Consider moving the shared logic into a common helper module and importing it from both scripts.
会話を記憶させるため SDKClient に変更