feat(gadgets): require PR for implementation agent and refactor file editing#85
Merged
zbigniewsobiecki merged 2 commits intodevfrom Jan 18, 2026
Merged
Conversation
feat(gadgets): add Finish gadget for early agent termination (#83)
…editing Major changes: - Add session state tracking to enforce PR creation for implementation agent - Refactor EditFile into three focused gadgets: FileSearchAndReplace, FileInsertContent, FileRemoveContent - Move shared matcher logic to src/gadgets/shared/ - Add path validation and diagnostic utilities - Update WriteFile with improved validation and read tracking - Streamline efficiency rules and planning prompts Session state feature: - New sessionState.ts module tracks agent type and PR creation - Finish gadget now throws error if implementation agent hasn't created PR - Prevents incomplete work from being reported as successful File editing refactor: - FileSearchAndReplace: targeted search and replace operations - FileInsertContent: insert content at specific line numbers - FileRemoveContent: remove content by line range or pattern - Shared matcher.ts provides common matching utilities - Better error messages and diagnostics
Merged
This was referenced Apr 27, 2026
Merged
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
src/gadgets/shared/Session State Feature
The implementation agent was able to call
Finishand claim success without actually creating a PR. This change:src/gadgets/sessionState.tsto track agent type and PR creation statusFinishgadget now throws an error if implementation agent hasn't created a PRFile Editing Refactor
Replaces the monolithic
EditFilegadget with three focused gadgets:Shared utilities moved to
src/gadgets/shared/:matcher.ts: Common matching utilitiestypes.ts: Shared type definitionsdiagnostics.ts: Error diagnostics helperspathValidation.ts: Path validation utilitiesTest Plan
npm run typecheckpassesnpm testpasses (120 tests)🤖 Generated with Claude Code