fix(launch-wizard): preserve user-selected agent across hydration#2745
Conversation
`LaunchWizardState::apply_hydration` が Runtime confirmation や custom agent cache refresh の経路で `apply_preferred_agent_profile()` を再実行し、 ユーザーが Settings step で明示的に選んだ `agent_id` を前回 Launch agent (preferred agent) で上書きしていた。SPEC-2014 FR-024 / FR-025 / FR-026 (2026-05-11 Local User Agent Preferences) の plan は preferred agent identity を wizard 初期化と明示的 agent 切替時のみ適用すると規定しており、hydration 経路で 再適用するとは記述されていない。 `apply_hydration` 内の `apply_preferred_agent_profile()` 呼び出しを `restore_agent_draft_or_defaults()` に置き換え、現在選択 agent の per-agent draft / previous profile だけを refresh するようにする。 `apply_preferred_agent_profile` 自体は constructor 経由 (initial open) と `set_agent_id` 経由の明示的切替で利用するため残し、関数 doc コメントに constructor-only と明示。 SPEC-2014 に新 phase `2026-05-15 Wizard Hydration Preserves User-Selected Agent` を追加し、US-24 / FR-054..FR-056 / SC-029..SC-030 を spec / plan / tasks に反映。RED test 2 件 (apply_runtime_context / custom agent cache refresh path) と既存の hydration_refresh_preserves_open_wizard_agent_settings test を併走させ、hydration 経路で agent identity が保持されることを固定する。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04c9889b8e
ℹ️ 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".
| if refreshed_previous_profiles && self.launch_path != LaunchWizardLaunchPath::QuickStart { | ||
| self.apply_preferred_agent_profile(); | ||
| self.restore_agent_draft_or_defaults(); |
There was a problem hiding this comment.
Re-apply preferred agent during hydration for loading wizard
In the open_loading flow, the wizard starts with empty previous_profiles and receives them only on async hydration (open_launch_wizard_for_branch creates open_loading, then apply_hydration applies resolved profiles). Replacing apply_preferred_agent_profile() with restore_agent_draft_or_defaults() here means preferred_agent_id is never applied in that path, so users can be reset to the first detected agent instead of their saved preferred agent whenever hydration completes. This regresses the persisted agent-preference behavior for normal Launch Wizard opens.
Useful? React with 👍 / 👎.
Summary
LaunchWizardState::apply_hydrationから agent identity 上書きを除き、現在選択 agent の per-agent draft / previous profile だけを refresh する設計へ補正2026-05-15 Wizard Hydration Preserves User-Selected Agentを追加し、US-24 / FR-054..FR-056 / SC-029..SC-030 を spec / plan / tasks に反映Changes
crates/gwt/src/launch_wizard.rs:apply_hydration内のapply_preferred_agent_profile()呼び出しをrestore_agent_draft_or_defaults()に置換 (line 1043-1049 周辺)。apply_preferred_agent_profile自体は constructor 経由 (line 781) とset_agent_id経由の明示的切替で利用するため残し、関数 doc コメントに constructor-only と明示crates/gwt/src/launch_wizard.rs(mod tests): RED test を 2 件追加apply_runtime_context_preserves_user_selected_agent_after_settings_step— Runtime confirmation 経路で user の agent_id 選択が保持されることを固定custom_agent_cache_refresh_preserves_user_selected_agent— custom agent cache refresh 経路で同じ性質を固定spec/plan/tasksに## 2026-05-15 Wizard Hydration Preserves User-Selected Agentphase を追加 (US-24 / FR-054..FR-056 / SC-029..SC-030 / T85..T88)Testing
cargo test -p gwt --lib launch_wizard::tests::apply_runtime_context_preserves_user_selected_agent_after_settings_step --nocapture— fix 前 FAILED (left: "codex" right: "claude") → fix 後 PASSEDcargo test -p gwt --lib launch_wizard::tests::custom_agent_cache_refresh_preserves_user_selected_agent --nocapture— fix 前 FAILED → fix 後 PASSEDcargo test -p gwt --lib launch_wizard::tests::hydration_refresh_preserves_open_wizard_agent_settings_without_reapplying_preferences --nocapture— GREEN を維持cargo test -p gwt --lib launch_wizard::tests— 75 passed / 0 failedcargo test -p gwt-core -p gwt --all-features— 全 suite greencargo clippy --all-targets --all-features -- -D warnings— warning なしcargo fmt -- --check— diff なしcargo build -p gwt --bin gwt --bin gwtd— successbunx commitlint --from HEAD~1 --to HEAD— exit 0Manual Verification (推奨)
cargo run -p gwt --bin gwtで gwt 起動Launch AgentContinueで Runtime confirmation step に進むStart Work経由でも同手順で再現確認Closing Issues
Related Issues / Links
2026-05-15 Wizard Hydration Preserves User-Selected Agentphase 追加work/20260515-1015-2PR fix(gui): keep Runtime active during confirmation #2740 (Runtime confirmation progress rail) — seam が異なり衝突なし、Board に claim 済みChecklist
cargo clippy,cargo fmt)fix:patch 扱い、breaking change なしContext
2026-05-11 Local User Agent Preferencesと2026-05-12 Host/Docker Per-Repo Persistenceで hydration 経路のprevious_profilesrefresh が強化された際、apply_preferred_agent_profile()が agent_id まで上書きしていた点が見落とされた regressionLaunchWizardState の初期化と agent 切替時の fallback を、open Wizard draft -> local user agent preference -> agent defaults の順にする規定 (2026-05-11 Local User Agent Preferences) と実装の乖離を解消するRisk / Impact
apply_hydration内の 1 行 (restore_agent_draft_or_defaults→apply_preferred_agent_profile) を戻すだけで挙動が元に戻る。SPEC-2014 phase 追加は revert 不要 (記録として保持可)