Improve review accuracy: full-file context and confidence-aware prompts #28

Closed
opened 2026-06-21 01:39:48 +00:00 by coding-agent-marvin8 · 1 comment
coding-agent-marvin8 commented 2026-06-21 01:39:48 +00:00 (Migrated from codeberg.org)

WuMing agents currently receive only the unified diff. This causes false positives and speculative findings because the model lacks surrounding context — full class bodies, sibling functions, imports from other modules.\n\nTwo complementary fixes:\n\n1. Full-file context: For each file touched by the diff, fetch the complete file content from Forgejo and prepend it to the agent's user message. Gated by a new env var WUMING_MAX_FILE_LINES (default 0 = disabled; set e.g. 500 to enable with a size limit).\n\n2. Confidence caveat: Append a standing instruction to every agent's user message telling it to only flag issues evident from the provided context and to avoid speculative findings.

WuMing agents currently receive only the unified diff. This causes false positives and speculative findings because the model lacks surrounding context — full class bodies, sibling functions, imports from other modules.\n\nTwo complementary fixes:\n\n1. **Full-file context**: For each file touched by the diff, fetch the complete file content from Forgejo and prepend it to the agent's user message. Gated by a new env var `WUMING_MAX_FILE_LINES` (default 0 = disabled; set e.g. 500 to enable with a size limit).\n\n2. **Confidence caveat**: Append a standing instruction to every agent's user message telling it to only flag issues evident from the provided context and to avoid speculative findings.
coding-agent-marvin8 commented 2026-06-21 01:40:01 +00:00 (Migrated from codeberg.org)

Plan of attack:

Key files:

  • src/wuming/diff.py — add full_content: str | None = None field to FileDiff dataclass
  • src/wuming/config.py — add max_file_lines: int, parse from WUMING_MAX_FILE_LINES (default 0)
  • src/wuming/forgejo.py — add get_file_content(path) using GET /api/v1/repos/{owner}/{repo}/raw/{path}?ref={sha}; returns None on 404
  • src/wuming/main.py — after parse/filter/truncate, gather all file-content fetches concurrently; attach to FileDiff objects via dataclasses.replace; skip when max_file_lines == 0
  • src/wuming/agents/base.py — in BaseAgent.review(), prepend full file contents to the user message when present; append a module-level _CONFIDENCE_CAVEAT constant to every user message regardless
  • .woodpecker/ai-review.yml — add WUMING_MAX_FILE_LINES: "500"
  • README.md + CLAUDE.md — document the new env var

Sequence: TDD — failing tests for get_file_content and agent context first, then implementation, then docs.

Plan of attack: **Key files:** - `src/wuming/diff.py` — add `full_content: str | None = None` field to `FileDiff` dataclass - `src/wuming/config.py` — add `max_file_lines: int`, parse from `WUMING_MAX_FILE_LINES` (default 0) - `src/wuming/forgejo.py` — add `get_file_content(path)` using `GET /api/v1/repos/{owner}/{repo}/raw/{path}?ref={sha}`; returns `None` on 404 - `src/wuming/main.py` — after parse/filter/truncate, gather all file-content fetches concurrently; attach to `FileDiff` objects via `dataclasses.replace`; skip when `max_file_lines == 0` - `src/wuming/agents/base.py` — in `BaseAgent.review()`, prepend full file contents to the user message when present; append a module-level `_CONFIDENCE_CAVEAT` constant to every user message regardless - `.woodpecker/ai-review.yml` — add `WUMING_MAX_FILE_LINES: "500"` - `README.md` + `CLAUDE.md` — document the new env var **Sequence:** TDD — failing tests for `get_file_content` and agent context first, then implementation, then docs.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
marvin8/wuming#28
No description provided.