Skip to content

fix(desktop): TodoComposer / PresetsDialog に AgentRuntimePicker を適用#387

Merged
MocA-Love merged 2 commits intomainfrom
fix/todo-composer-agent-picker
Apr 23, 2026
Merged

fix(desktop): TodoComposer / PresetsDialog に AgentRuntimePicker を適用#387
MocA-Love merged 2 commits intomainfrom
fix/todo-composer-agent-picker

Conversation

@MocA-Love
Copy link
Copy Markdown
Owner

Summary

  • PR feat(desktop): TODO Agent に OpenAI Codex CLI 対応を追加 #385TodoModalAgentRuntimePicker (Claude Code / Codex CLI 切替) が導入されたが、TodoManager 内の TodoComposerPresetsDialog 設定タブ には旧 ClaudeRuntimePicker が残っていた
  • 両コンポーネントに agentKind / codexModel / codexEffort の state・送信・保存処理を追加
  • PTY / Remote Control チェックボックスを agentKind に連動 (Codex 選択時は無効化)
  • PresetsDialog の設定タブのラベルを「Claude 既定値」→「既定値」に変更

変更ファイル

ファイル 変更
TodoManager.tsx TodoComposerClaudeRuntimePickerAgentRuntimePicker 差替え、agentKind/codex state 追加、create mutation に codex フィールド追加
PresetsDialog.tsx SettingsTab の既定値ピッカー → AgentRuntimePicker 差替え、codex 規定値の hydrate / dirty check / save 追加

Test plan

  • TODO Agent Manager → 「新しい TODO」→ Agent セレクター (Claude Code / Codex CLI) が表示される
  • Codex CLI 選択時 → Model / Effort が Codex 用オプションに切り替わる
  • Codex CLI 選択時 → PTY / Remote Control が無効化される
  • 設定タブ → Agent 種別の既定値を変更 → 保存 → 再表示で反映される
  • 既存の Claude セッション作成・実行に影響がない

Full Changelog: main...fix/todo-composer-agent-picker

💘 Generated with Crush

PR #385 で TodoModal には AgentRuntimePicker (Claude Code / Codex CLI 切替)
が導入されたが、TodoManager 内の TodoComposer と PresetsDialog の
設定タブには旧 ClaudeRuntimePicker が残っていたため、Agent 切替 UI
が表示されなかった。両コンポーネントに agentKind / codexModel /
codexEffort の state と送信・保存処理を追加し、PTY/Remote Control
チェックボックスも agentKind に連動するよう修正。

 Fixes #385 (follow-up)

 💘 Generated with Crush

 Assisted-by: GLM-5 via Crush <crush@charm.land>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

Warning

Rate limit exceeded

@MocA-Love has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 43 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 43 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d2ecc0e3-0882-49eb-bc2e-404614b35210

📥 Commits

Reviewing files that changed from the base of the PR and between eac37de and e86974a.

📒 Files selected for processing (2)
  • apps/desktop/src/renderer/features/todo-agent/TodoManager/PresetsDialog/PresetsDialog.tsx
  • apps/desktop/src/renderer/features/todo-agent/TodoManager/TodoManager.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/todo-composer-agent-picker

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.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53811234ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Codex review で指摘: defaultAgentKind, defaultCodexModel, defaultCodexEffort が
useCallback の依存配列から漏れており、これらのみ変更して保存すると
古い値が送信されるバグがあった。

 💘 Generated with Crush

 Assisted-by: GLM-5 via Crush <crush@charm.land>
@MocA-Love MocA-Love merged commit 4f3f390 into main Apr 23, 2026
5 of 6 checks passed
@MocA-Love MocA-Love deleted the fix/todo-composer-agent-picker branch April 23, 2026 03:18
MocA-Love added a commit that referenced this pull request Apr 23, 2026
PresetsDialog (設定タブ) と TodoManager (インラインコンポーザー) に
Crush CLI 向けモデル選択 UI を追加。PR #387 で Codex に対応した
両コンポーネントで Crush の抜けがあったのを補完。

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
MocA-Love added a commit that referenced this pull request Apr 23, 2026
* feat(desktop): TODO Agent に Crush CLI 対応を追加

TODO Agent の自律実行エンジンを拡張し、Charmbracelet Crush CLI (`crush run`) を
バックエンドとして選択可能にした。Claude Code / Codex CLI に続く3つ目のエージェント対応。

Crush は stdout に構造化ストリーミングを出力しないため、プロジェクトローカルの
SQLite データベース (`<project>/.crush/crush.db`) をポーリングしてメッセージを
取得し、既存の TodoStreamEvent 形式に変換する方式を採用。
Claude PTY runner の JSONL ポーリングと同じパターン。

モデル選択は `crush models` の出力(276+)を動的フェッチし、
provider ごとにグループ化して UI に表示。ハードコードなし。

## 変更点

### コアロジック
- `types.ts` — `AgentKind` enum に `"crush"` を追加。`crushModel` フィールドを
  `todoCreateInputSchema` / `todoSettingsSchema` に追加
- `crush-turn-runner.ts` (新規) — `crush run --yolo` を spawn → `.crush/crush.db`
  を 250ms 間隔でポーリング → messages テーブルの parts JSON をパースして
  TodoStreamEvent に変換。system_init / assistant_text / tool_use / tool_result /
  result / error の全 kind をマッピング
- `supervisor-engine.ts` — `runAgentTurn()` に `agentKind === "crush"` ルートを追加

### データ層
- DB schema — `todo_sessions` / `todo_schedules` に `crush_model` カラムを追加
- マイグレーション — `0069_add_crush_model.sql` 自動生成
- session-store / tRPC router — 作成・再実行時に crushModel を永続化
- tRPC — `crushModels` クエリ追加(`crush models` の出力をキャッシュ付きで返す)

### UI
- `AgentRuntimePicker.tsx` — Agent セレクタに "Crush" を追加。Crush 選択時は
  モデルのみのセクションを表示(Effort は Crush CLI に概念がないため省略)。
  モデルリストは provider ごとにグループ化
- `claudeRuntimeOptions.ts` — `CrushModelPick` 型 + 永続化ヘルパー
- `TodoModal.tsx` — `crushModel` state + `crushModels` フェッチ + 送信

## 設計上の決定

- **後方互換性**: `agent_kind` のデフォルトは引き続き `"claude"`。
  既存セッションへの影響なし
- **SQLite ポーリング**: Crush は NDJSON 出力をサポートしないため、DB ポーリング
  を選択。Claude PTY runner の JSONL ポーリングと同じアプローチ
- **動的モデルリスト**: 276+ のモデルをハードコードせず `crush models` から動的取得
- **Effort なし**: Crush CLI に effort/reasoning の概念がないため省略

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>

* fix(desktop): crush-turn-runner の DB ポーリングループが永久に終了しないバグを修正

`pollDbForEvents` の `settled` が `const false` だったため、正常終了時に
`await pollPromise` が永久にブロックしセッションが running でスタックしていた。

修正:
- `settled` を `let` に変更し、DB で `finish` part (end_turn/stop) を
  検知したら `settled = true` にする
- `isChildExited` コールバックを追加し、子プロセス終了後もポーリングが
  停止するようにした(DB に finish が書かれないエラー/シグナルケース対応)

Codex review P1 指摘への対応。

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>

* fix(desktop): CodeRabbit レビュー指摘に対応

- crush-turn-runner: `safeParseJson` で `Array.isArray` チェックを追加し、
  非 JSON 配列が渡った際の TypeError を防止
- crush-turn-runner: `killProcess` で `child.pid` の undefined ガードを追加
- crush-turn-runner: `cost` 取得時の NULL チェックを追加
  (`typeof === "number" && Number.isFinite`)
- supervisor-engine: `(currentSession as any).crushModel` の `as any` を削除
- trpc-router: `(source as any).crushModel` の `as any` を削除
- trpc-router: `crushModels` クエリに TTL キャッシュ (5分) と
  inflight 重複排除を追加

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>

* fix(desktop): PresetsDialog / TodoManager に Crush モデル選択を追加

PresetsDialog (設定タブ) と TodoManager (インラインコンポーザー) に
Crush CLI 向けモデル選択 UI を追加。PR #387 で Codex に対応した
両コンポーネントで Crush の抜けがあったのを補完。

💘 Generated with Crush

Assisted-by: GLM-5 via Crush <crush@charm.land>
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