-
Notifications
You must be signed in to change notification settings - Fork 1
fix(groom): bound finder and builder exploration #261
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
Open
christian-byrne
wants to merge
5
commits into
main
Choose a base branch
from
christian-byrne/cifix-16923-groom-finder-bounds
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23416d9
fix(groom): bound finder exploration and spend
christian-byrne 16f8045
fix(groom): reserve finder output budget
christian-byrne 1f38b14
fix(groom): address finder budget review findings
christian-byrne 2f43bc8
fix(groom): bound builder feasibility exploration
christian-byrne d56a284
test(groom): anchor clean-bail recovery assertion
christian-byrne File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| import pathlib | ||
| import re | ||
| import unittest | ||
|
|
||
|
|
||
| ROOT = pathlib.Path(__file__).resolve().parents[3] | ||
| WORKFLOW = (ROOT / ".github/workflows/groom.yml").read_text(encoding="utf-8") | ||
| BUILDER_BRIEF = (ROOT / ".github/groom/builder.md").read_text(encoding="utf-8") | ||
|
|
||
|
|
||
| class TestBuilderBounds(unittest.TestCase): | ||
| @staticmethod | ||
| def builder_step(): | ||
| match = re.search( | ||
| r"(?ms)^ - name: Run builder\n(?P<body>.*?)^ - name: Unlock the clone's \.git\n", | ||
| WORKFLOW, | ||
| ) | ||
| if match is None: | ||
| raise AssertionError("groom.yml has no Run builder step followed by Unlock the clone's .git") | ||
| return match.group("body") | ||
|
|
||
| def test_brief_requires_a_bounded_feasibility_decision_before_edits(self): | ||
| self.assertIn("After at most 20 inspection tool calls", BUILDER_BRIEF) | ||
| self.assertIn("make one feasibility decision before editing", BUILDER_BRIEF) | ||
| self.assertIn("Only choose `patched` when the exact bounded diff is clear", BUILDER_BRIEF) | ||
| self.assertIn("Reserve enough time to write the control file", BUILDER_BRIEF) | ||
| self.assertIn( | ||
| "If a tool call is denied, do not retry that operation or seek a shell-command substitute", | ||
| BUILDER_BRIEF, | ||
| ) | ||
|
|
||
| def test_complete_clean_bail_survives_a_late_cli_failure(self): | ||
| builder_step = self.builder_step() | ||
| self.assertIn('if [ -s "$BUILDER_OUT" ] && jq -e', builder_step) | ||
| self.assertIn('.status == "bail"', builder_step) | ||
| self.assertIn('test -z "$(git status --short)"', builder_step) | ||
| self.assertIn("preserving the clean bail-out for issue filing", builder_step) | ||
| self.assertRegex( | ||
| builder_step, | ||
| r'(?s)preserving the clean bail-out for issue filing\."\n\s+STATUS=0\n\s+else', | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import pathlib | ||
| import re | ||
| import unittest | ||
|
|
||
|
|
||
| ROOT = pathlib.Path(__file__).resolve().parents[3] | ||
| WORKFLOW = (ROOT / ".github/workflows/groom.yml").read_text(encoding="utf-8") | ||
| FINDER_BRIEF = (ROOT / ".github/groom/finder.md").read_text(encoding="utf-8") | ||
|
|
||
|
|
||
| class TestFinderBounds(unittest.TestCase): | ||
| @staticmethod | ||
| def finder_step(): | ||
| match = re.search( | ||
| r"(?ms)^ - name: Run finder\n(?P<body>.*?)^ - name: Unlock the clone\n", | ||
| WORKFLOW, | ||
| ) | ||
| if match is None: | ||
| raise AssertionError("groom.yml has no Run finder step followed by Unlock the clone") | ||
| return match.group("body") | ||
|
|
||
| def test_finder_cli_has_turn_and_dollar_caps(self): | ||
| finder_step = self.finder_step() | ||
| claude_command = finder_step.split('claude -p "$PROMPT"', 1)[1].split( | ||
| "--output-format json", 1 | ||
| )[0] | ||
|
|
||
| self.assertRegex(claude_command, re.compile(r"--max-turns\s+150\s+\\")) | ||
| self.assertRegex(claude_command, re.compile(r"--max-budget-usd\s+8\s+\\")) | ||
|
christian-byrne marked this conversation as resolved.
|
||
|
|
||
| def test_brief_requires_an_early_result_and_reports_why_it_stopped(self): | ||
| self.assertNotIn("estimated inspection spend", FINDER_BRIEF) | ||
| self.assertIn("After at most 60 inspection tool calls", FINDER_BRIEF) | ||
| self.assertIn("Reserve enough time to write the result", FINDER_BRIEF) | ||
| self.assertIn("Fewer than 6 findings is valid", FINDER_BRIEF) | ||
| self.assertIn('"stop_reason":"inspection-complete|inspection-call-limit"', FINDER_BRIEF) | ||
| self.assertIn( | ||
| "If an inspection call is denied, do not retry that operation through another tool", | ||
| FINDER_BRIEF, | ||
| ) | ||
|
|
||
| def test_complete_handoff_survives_a_late_cli_failure(self): | ||
| finder_step = self.finder_step() | ||
| self.assertIn('if [ -s "$FINDER_OUT" ] && jq -e', finder_step) | ||
| self.assertIn('(.stop_reason | IN("inspection-complete", "inspection-call-limit"))', finder_step) | ||
| self.assertIn("preserving it for independent verification", finder_step) | ||
| self.assertIn("STATUS=0", finder_step) | ||
|
|
||
| def test_zero_at_call_limit_is_not_reported_as_clean(self): | ||
| self.assertIn( | ||
| "reached its inspection-call limit with zero findings", | ||
| WORKFLOW, | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() | ||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.