Skip to content

drafter thinks too much#147

Merged
derekmisler merged 1 commit intodocker:mainfrom
derekmisler:drafter-thinks-too-much
Apr 23, 2026
Merged

drafter thinks too much#147
derekmisler merged 1 commit intodocker:mainfrom
derekmisler:drafter-thinks-too-much

Conversation

@derekmisler
Copy link
Copy Markdown
Contributor

@derekmisler derekmisler commented Apr 23, 2026

Related Issues

Closes: https://github.com/docker/gordon/issues/437

Summary

The drafter agent was generating unnecessarily verbose hypotheses due to using sonnet-thinking model. This PR switches to sonnet and adds guardrails to prevent the verifier from reading temporary diff chunk files and clarifies how deleted lines should be handled in comments.

Changes

  • Model optimization: Changed drafter from sonnet-thinking to sonnet to reduce verbose output while maintaining analysis quality
  • Verifier constraints: Removed read_multiple_files from verifier toolset and added explicit instruction to only read source files, never /tmp/ — prevents unnecessary diff chunk file reads
  • Deleted line handling: Added clear guidance for verifier to use side: "LEFT" with old-file line numbers when findings are on deleted lines (- in diff), since deleted lines don't exist in the new working tree
  • Updated posting format docs: Clarified how to construct GitHub API comments for both added/context lines and deleted lines, with concrete jq examples for deleted line handling

Tip

Comment /review to trigger the PR Reviewer agent for automated feedback.
Comment /describe to generate a PR description.

Signed-off-by: Derek Misler <derek.misler@docker.com>
@derekmisler derekmisler self-assigned this Apr 23, 2026
@derekmisler derekmisler requested a review from a team April 23, 2026 14:34
@derekmisler derekmisler marked this pull request as ready for review April 23, 2026 14:34
@derekmisler derekmisler enabled auto-merge (squash) April 23, 2026 14:39
@derekmisler derekmisler merged commit cb19cc3 into docker:main Apr 23, 2026
19 checks passed
@docker-agent
Copy link
Copy Markdown
Contributor

docker-agent Bot commented Apr 23, 2026

⏭️ Review skipped — another review for this PR is already in progress (started 154s ago). Only one review runs at a time to avoid duplicate comments. The in-progress review will post its results when complete.

Copy link
Copy Markdown
Contributor

@docker-agent docker-agent Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟡 NEEDS ATTENTION

⚠️ Note: The verifier returned an empty response (likely exhausted context budget). The findings below are from the drafter's analysis and have not been independently confirmed — please evaluate them directly.

found on disk, use diff hunk headers instead. Never read the same file more than twice.
**Deleted lines**: If a finding is on a deleted line (`-` in the diff), the line
does not exist in the new file. Use `side: "LEFT"` with the old-file line number
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] No algorithm provided for computing old-file line numbers for deleted lines

The new guidance instructs verifiers to use side: "LEFT" with the old-file line number (from the -X,Y side of the hunk header) when a finding is on a deleted line, and explicitly says not to use grep. However, there is no corresponding explanation of how to derive that old-file line number from the hunk header. The existing new-file line-number algorithm (walk from +Z in the @@ -X,Y +Z,W @@ header, counting +/ lines) is already documented elsewhere, but no analogous -X-side algorithm is given for the deleted-lines case.

Without a deterministic procedure, agents may guess or use the wrong counter, producing misplaced GitHub review comments or 422 errors from the API.

Suggested addition: Add a brief note like: "To find the old-file line number, start from X in the hunk header and count only - and (context) lines down to the target deleted line."

⚠️ Verification was inconclusive (verifier returned empty response) — the drafter's analysis is surfaced for author evaluation.

&& mv /tmp/review_comments.tmp /tmp/review_comments.json

# For deleted lines (- in diff), add side: LEFT with the OLD file line number:
jq --arg path "$file_path" --argjson line "$old_line_number" --arg side "LEFT" \
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[MEDIUM] $old_line_number shell variable is undefined/unexplained in the jq snippet

The new jq snippet for deleted-line comments uses --argjson line "$old_line_number", but $old_line_number is never defined or set anywhere in the surrounding script context. The added/context-line snippet uses $line_number, which is at least consistent with other variables in the template.

If an agent or human copies this template without knowing to substitute a real integer, jq will receive an empty string for --argjson, causing a jq parse error or producing null for the line field — which the GitHub API will reject with a 422.

Suggestion: Either define old_line_number explicitly in the snippet (e.g., old_line_number=45 # from -X,Y side of hunk header) or add a comment explaining that this is a placeholder to be replaced with the actual old-file line number derived from the hunk header.

⚠️ Verification was inconclusive (verifier returned empty response) — the drafter's analysis is surfaced for author evaluation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants