feat(zerocode): add mid-session agent switching (Ctrl+G)#6
Open
JordanTheJet wants to merge 2 commits into
Open
feat(zerocode): add mid-session agent switching (Ctrl+G)#6JordanTheJet wants to merge 2 commits into
JordanTheJet wants to merge 2 commits into
Conversation
* ci(clawpatch): review every PR with zeroclaw as the brain Adds a GitHub Actions workflow that, on each PR, installs the prebuilt zeroclaw binary + acpx, points acpx at `zeroclaw acp` (stdio ACP), and runs `clawpatch ci` with provider=acpx so changed code is reviewed by ZeroClaw's own coding agent (Claude-backed). Non-blocking; findings post to the job summary + an artifact. Requires the ANTHROPIC_OAUTH_TOKEN repo secret. * ci: daily auto-sync fork master with upstream zeroclaw-labs/zeroclaw
The agent was chosen once at session start; the only way to change it was to quit and relaunch. Ctrl+N restarts with the same agent and Ctrl+S only switches between existing sessions, so there was no path back to the agent picker from a live session. Add a SwitchAgent action (Ctrl+G) that opens an agent-picker overlay from an active session, mirroring the existing session-switch overlay. Enter starts a fresh session against the chosen agent; Esc returns to the current session untouched; re-picking the current agent is a no-op so a stray confirm never discards the live session. A click only moves the selection (Enter confirms) for the same reason. Details: - restart/switch share start_fresh_session, which commits agent_alias only after the daemon confirms the new session β a failed create no longer strands the alias on an agent the live session isn't running. - agent_overlay is mirrored into wants_text_input() so global keys (?, Ctrl+R) treat the picker the same as the session picker regardless of any leftover draft. - Switching warns via the info bar when a draft or queued messages are cleared, instead of dropping them silently. The agent list is a transient on-demand snapshot of agents_status β the live agent of record remains ChatState::agent_alias; nothing is cached.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
masterzerocodeTUI the agent was chosen once at session start and could not be changed without quitting and relaunching βCtrl+Nrestarts the same agent andCtrl+Sonly switches between existing sessions, so there was no path back to the agent picker from a live session. This adds aSwitchAgentaction (default Ctrl+G) that opens an agent-picker overlay from an active session, mirroring the existing session-switch overlay; Enter starts a fresh session against the chosen agent, Esc returns to the current session untouched.start_fresh_session, which commitsagent_aliasonly after the daemon confirms the new session β a failed create no longer strands the alias on an agent the live session isn't running.agent_overlayis mirrored intowants_text_input()so global keys (?,Ctrl+R) treat the new picker the same as the session picker regardless of any leftover draft; switching also warns via the info bar when a draft or queued messages are cleared instead of dropping them silently.Ctrl+S), theCtrl+Nrestart semantics, or any daemon/RPC surface. No copy/paste changes (tracked separately).apps/zerocode(TUI client). The sharedrestart_session_for_statewas refactored to delegate tostart_fresh_session; behavior for the existingCtrl+Nrestart path is unchanged (it passes the current alias and the same "New session started." notice).apps/zerocode; suggestenhancement,size: S,risk: medium(touchesapps/zerocode/src/**).Validation Evidence (required)
cargo fmt --all -- --check cargo clippy --all-targets -- -D warnings cargo testcargo fmt --all -- --checkβ clean, no diff (exit 0).cargo clippy --all-targets -- -D warningsβFinished \dev` profile [unoptimized + debuginfo] target(s) in 4m 03s`; no warnings.cargo testβ all suites pass (exit 0). Thezerocodepackage:test result: ok. 348 passed; 0 failed; 0 ignored. Full-workspace run green (e.g.system::full_stackok. 9 passed; 0 failed).Ctrl+G(control chords returnNotHandled,input_bar.rs:1052), so the chat handler opens the overlay; overlay captures keys (nav/Enter/Esc), Enter on the current agent is a no-op, click only moves selection (Enter confirms) so a stray click cannot discard the session. Confirmedstart_fresh_sessioncommitsagent_aliasonly on the success branch and the WSS-ACP CWD-picker path carries the new alias without mutating live state. NOT verified: live WSS-ACP remote daemon switch and a real daemonsession_newfailure (the error-path rollback is covered by reasoning + the alias-on-success structure, not an integration test).Security & Privacy Impact (required)
NoNoNoNoYes, describe the risk and mitigation: N/A.Compatibility (required)
YesYesβ adds a new rebindable keymap actionchat.switch_agent(defaultCtrl+G) and two new info-bar strings. No migration required; existing configs and keybinding overrides are unaffected, andCtrl+Gwas previously unbound.NoorYesto either: exact upgrade steps for existing users: None β the new binding is additive and active by default.Rollback (required for
risk: mediumandrisk: high)Low blast radius (single TUI binary).
git revert <sha>cleanly removes the action, overlay, and thestart_fresh_sessionrefactor (the refactor is behavior-preserving for the existing restart path, so reverting restores the prior inlinerestart_session_for_state).