Fix Droid file edit hook not extracting edit content#9
Merged
Conversation
Factory Droid sends old_str/new_str in tool_input for the Edit tool, while Claude Code sends old_string/new_string. The droid-after-file-edit handler only checked for Claude Code's field names, causing empty edits to be sent to the security check — which then returned safe:true without actually running the check.
There was a problem hiding this comment.
Summary: This PR adjusts JSON parsing in OnAfterFileEdit to support alternate field names for edit strings and sets precedence without introducing execution, filesystem, or network actions.
Risk: Low risk. The changes only transform parsed input for handlers and do not affect command execution, path handling, or external integrations; no exploitable security vulnerabilities were identified.
The Droid handler is a separate code path that only receives Droid input, so it will never see Claude's old_string/new_string fields. Remove the unnecessary dual-field struct and fallback logic.
ashwin-corridor
approved these changes
Mar 2, 2026
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
old_str/new_strintool_inputfor the Edit tool, while Claude Code sendsold_string/new_stringdroid-after-file-edithandler only checked for Claude Code's field names, so edits arrived as empty stringssafe: true(no diff summaries) without running the actual analysisold_str/new_strdirectly, since this handler is a separate code path that never receives Claude input — no need for dual-field fallback logicTest plan
Stop hook working after this PR:
droid-stop-hook-demo.mp4