Skip to content

fix(tools): remove invalid override fallthrough#2428

Merged
Hmbown merged 1 commit into
mainfrom
codex/fix-plugin-override-fallthrough
May 31, 2026
Merged

fix(tools): remove invalid override fallthrough#2428
Hmbown merged 1 commit into
mainfrom
codex/fix-plugin-override-fallthrough

Conversation

@Hmbown
Copy link
Copy Markdown
Owner

@Hmbown Hmbown commented May 31, 2026

Summary

Hardens the tool override path that landed in #2420: if a Script or Command override fails to produce a replacement tool, CodeWhale now removes the original tool instead of leaving the built-in active under a broken override.

This addresses the security-shaped review concern from #2420 while keeping the change intentionally narrow. Thanks @aboimpinto for the original tool-registry work that made this path visible.

Validation

  • git diff --check
  • CARGO_TARGET_DIR=/Volumes/VIXinSSD/codewhale-target/fix-plugin-override cargo test -p codewhale-tui tools::registry --all-features
  • CARGO_TARGET_DIR=/Volumes/VIXinSSD/codewhale-target/fix-plugin-override cargo test -p codewhale-tui tools::plugin --all-features

Copilot AI review requested due to automatic review settings May 31, 2026 10:55
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Hmbown has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the tool registry to remove the original tool when a config override fails to create a replacement, preventing fallback to the original tool. It also adds a unit test to verify this behavior. The review feedback suggests replacing the wildcard pattern (_) in the match block with explicit variant matching to preserve Rust's compile-time exhaustiveness checks.

@@ -425,11 +425,24 @@ impl ToolRegistry {
_ => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using a wildcard pattern (_) here bypasses Rust's compile-time exhaustiveness checks. If a new variant is added to ToolOverride in the future, the compiler won't warn you that this match block needs to be updated. It is safer and more idiomatic to explicitly match the expected variants.

Suggested change
_ => {
crate::config::ToolOverride::Script { .. }
| crate::config::ToolOverride::Command { .. } => {

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@Hmbown Hmbown force-pushed the codex/fix-plugin-override-fallthrough branch from c63c9cc to d2debc9 Compare May 31, 2026 11:03
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Hmbown has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@Hmbown Hmbown merged commit ecfca26 into main May 31, 2026
14 checks passed
@Hmbown Hmbown deleted the codex/fix-plugin-override-fallthrough branch May 31, 2026 11:13
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.

2 participants