Use an explicit requested source range, never infer it after an edit. PostToolUse runs after mutation. Searching old_string could locate a different, unchanged occurrence and falsely attribute that line to the observed edit.
(file_path, args)
| 83 | |
| 84 | |
| 85 | def line_span(file_path, args): |
| 86 | """Use an explicit requested source range, never infer it after an edit. |
| 87 | |
| 88 | PostToolUse runs after mutation. Searching old_string could locate a different, |
| 89 | unchanged occurrence and falsely attribute that line to the observed edit. |
| 90 | """ |
| 91 | offset = args.get('offset') |
| 92 | limit = args.get('limit') |
| 93 | if isinstance(offset, int) and not isinstance(offset, bool) and offset > 0: |
| 94 | if isinstance(limit, int) and not isinstance(limit, bool) and limit > 0: |
| 95 | return [offset, offset + limit - 1] |
| 96 | return [offset, offset] |
| 97 | |
| 98 | return None |
| 99 | |
| 100 | |
| 101 | def daemon_origin(value): |