fix(cli): protect built-in TUI agent modes#36
Open
BunsDev wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR hardens the CLI TUI mode-switcher so that selecting reserved modes (build, plan, explore) always resolves to the built-in agent definitions, preventing repository-configured agents with the same names from replacing security-significant built-in modes.
Changes:
- Added
resolve_tui_agent_modeto force reserved TUI modes to use built-in agent definitions before consulting familiars/project agents. - Updated the interactive TUI mode-change handling to use
resolve_tui_agent_mode, keeping displayed mode and tool filtering consistent. - Added regression tests to verify reserved modes ignore project overrides while non-reserved modes can still resolve to project agents.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+1282
to
+1284
| let mut all_agents = claurst_core::coven_shared::default_agents_with_familiars(); | ||
| all_agents.extend(config_agents.clone()); | ||
| all_agents.get(mode).cloned() |
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.
Motivation
planfrom replacing the built-in read-only Plan mode and misleading the user into granting write/exec tool access.Description
resolve_tui_agent_modewhich resolves TUI-selected reserved modes (build,plan,explore) to the built-in definitions before consulting familiars/project agents.resolve_tui_agent_modewhenapp.agent_mode_changedso the visual mode and tool-filtering remain consistent and secure.tui_reserved_modes_ignore_project_agent_overrides,tui_non_reserved_modes_can_use_project_agents) and a smalltest_agenthelper to cover reserved vs non-reserved resolution behavior insrc-rust/crates/cli/src/main.rs.Testing
git diff --checkwhich passed with no whitespace/errors reported.cargo fmt --all --check(formatting verified) in the workspace.cargo test/cargo check --workspaceand targeted tests, but execution was blocked by missing system development dependency (alsa.pc/ ALSA dev package), causing the build to fail before tests could run; the new unit tests are present but could not be executed in this environment.Codex Task