-
Notifications
You must be signed in to change notification settings - Fork 29
🤖 Split file_edit_replace into two separate tools #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
https://github.com/coder/cmux/blob/9bdbc520d9807927f1f8b180690fbf92ce729406/src/utils/messages/toolOutputRedaction.ts#L13-L16
Update toolOutputRedaction to new replace tool types
toolOutputRedaction.ts still imports FileEditReplaceToolResult and switches on file_edit_replace (lines 13‑14, 96). The type no longer exists after the rename and the new tools are file_edit_replace_string/file_edit_replace_lines, so this file will not compile and none of the replace-tool outputs will be redacted.
ℹ️ 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 👍.
ef564c6 to
c0ef42f
Compare
|
Applied Codex suggestions: cleaned up file_edit_replace_lines definition and ensured create:true works before invoking shared helper. Re-ran tests locally. |
f1c9fda to
966e72c
Compare
ba9f0b8 to
0f1eb57
Compare
Consolidates file_edit_replace_string and file_edit_replace_lines into a single file_edit_replace tool using discriminated unions. Changes: - New unified tool with mode: 'string' | 'lines' discriminant - Updated type system with FileEditReplaceToolArgs union type - Simplified frontend with single tool rendering path - Updated all tool definitions, registries, and utilities - Removed legacy tool implementations and tests Benefits: - Simpler API (1 tool instead of 2) - Easier to extend with new modes - Reduced code duplication (~327 line net reduction) All tests passing (TypeScript, unit tests, tool policy tests). _Generated with `cmux`_
Prevents checking PR status when: - Working directory has uncommitted changes - Local branch doesn't have upstream configured - Local branch is out of sync with remote (ahead/behind/diverged) Provides clear error messages with suggested remediation steps. _Generated with `cmux`_
27c5f47 to
feca0e7
Compare
Instead of using a discriminated union (which AI providers don't support), create two separate tools that share implementation: - file_edit_replace_string: String-based text replacement - file_edit_replace_lines: Line range replacement - file_edit_replace_shared.ts: Shared helper functions Benefits: - Simple object schemas that AI providers accept - Code reuse through shared helpers - Clearer tool separation in registry - Type safety maintained throughout Updated: - Tool definitions with two separate simple schemas - Tool registry to register both tools - UI components to handle both tool names - Types to separate payload/result types - Tests to cover both tools independently
Update test to look for either file_edit_replace_string or file_edit_replace_lines instead of the old unified tool name.
Splits file edit replace into two separate tools instead of using a discriminated union, as AI providers don't support complex union schemas.
Changes
file_edit_replace_string: String-based text replacementfile_edit_replace_lines: Line range replacementfile_edit_replace_shared.tsfor code reuseBenefits
Test Results
✅ TypeScript passing
✅ Unit tests passing (379 tests)
✅ Tool policy tests passing (20 tests)
✅ Lint + Format passing
Generated with
cmux