gitoria

kunibert

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainbd3591c7conductor: gates run on the live day44 binarymremain/docs/reviewer-design/1-design-and-lessons.md

5.1 KB

  1. # The earlier reviewer: design and lessons (for the gitoria reviewer)
  2. The earlier reviewer: the earlier setup's PR reviewer on GitHub since 2026-10-21. About 1300 lines of Bun/TypeScript, one service. The model is codex (gpt-6.1-sol, reasoning effort max) in a read-only sandbox, run as a separate unix user.
  3. ## Flow per wake-up
  4. 1. Event → job queue (sqlite). One job per PR at a time; a newer event updates the queued job, never doubles it.
  5. 2. Always review the PR's *current* head, never the sha from the (possibly late) event.
  6. 3. Skip when nothing is new (same head, no new replies, not forced).
  7. 4. Set the status to pending → git fetch the PR head and base into a bare cache (forced refspecs: force-pushes happen) → check out the head.
  8. 5. Diff **locally**: merge-base(base, head)..head. Never use the forge's diff API (GitHub caps it at 300 files).
  9. 6. Spec: tickets named in the PR title + issues referenced, **with comments oldest-first; later comments overrule the description**. Missing or partial comments: mark the spec INCOMPLETE, so no "missing requirement" findings.
  10. 7. Run the model. Output is JSON against a schema: summary, axes, verdict, findings[{axis, path, line, severity, title, body}], replies[{thread, body, resolve}].
  11. 8. Findings on lines that are in the diff → inline comments. All others go into the review body under "Not on changed lines".
  12. 9. Post the review, set the status (failure on request_changes), persist the session.
  13. ## Three separate axes (never let one mask another)
  14. - **correctness**: bugs, security, data loss, edge cases, wrong tests.
  15. - **spec**: missing or partial requirements, scope creep, wrongly implemented requirements. Every spec finding quotes the spec line.
  16. - **standards**: the repo's documented rules (AGENTS.md/CLAUDE.md incl. @includes, CONTRIBUTING, …), cited by file + words. Skip what linters already enforce. Code smells are allowed only as nits titled "possible <smell>".
  17. ## Memory (the most valuable part)
  18. - One model session per PR, *resumed* on every wake-up. The prompt holds only the delta:
  19. - new commits (diff last..head, **limited to the PR's files**, so merges from base drop out; the full PR diff sits next to it as the scope);
  20. - new human replies and resolve flips on the bot's own threads;
  21. - refreshed spec;
  22. - `@bot <text>` notes from the conversation.
  23. - Rules: a resolved thread, or one with an accepted reason, is settled and never raised again. If the bot disagrees, it replies in the thread instead of opening a new finding. Fixed → reply + resolve. `findings` = only new points. The verdict covers the whole PR as it stands.
  24. - Settled keys are persisted: the forge may refuse to resolve, and they must survive anyway.
  25. - Generation counter: a reset during a running review makes that run's writes no-ops.
  26. - Seen-watermarks per thread: highest comment id, not counts (deleted comments break counts).
  27. - A lost session falls back to a fresh one with a one-line ledger of earlier threads.
  28. - `@bot reset` = fresh, unbiased session, which also drops pending notes.
  29. ## Triggers
  30. Push / PR opened / ready-for-review; the re-request icon (forced); a human reply in a bot thread; `@bot reset`; `@bot <text>`.
  31. ## Lessons (each one cost a bug)
  32. - Never post "could not review" comments on PRs. Alert the operator instead (the earlier reviewer → hub alert). Surface the model's own error events: stderr only shows progress.
  33. - Force-pushes: forced fetch refspecs. Shallow caches: deepen before declaring history rewritten.
  34. - Merging base into the branch is not scope creep: filter the delta to the PR's paths (name-status -z, both rename sides).
  35. - Review headers must count still-open threads ("0 new, 1 still open"). Otherwise "0 findings" next to request_changes looks broken.
  36. - Findings outside the diff need a way to be answered (`@bot <text>`), or they block forever.
  37. - Long prompts go to a file the model reads (the argv limit is about 128 KB).
  38. - A second, independent comparison (vs CodeRabbit, 91 PRs, 2026-11-01):
  39. - the earlier reviewer: 74% valid, 2 min median. CodeRabbit: 59% valid, 8 min. Overlap only 10–18%.
  40. - Gaps: the earlier reviewer must **run the repo gates** (lint, typecheck, unused-code check, tests: 131 reviews said "deps missing"). It also misses cross-repo deploy order and contracts, caching/backfill/timeouts (a checklist helps), and its spec axis is too eager ("move to a separate PR" = most false alarms).
  41. - Ready-to-commit code suggestions are missing.
  42. ## What I'd do differently from day one
  43. Run the gates in a prepared workspace (deps installed). Diff locally from the start. Add a category checklist to the prompt. Keep a per-repo "accepted decisions" memory. Use an operator alert channel instead of PR comments for failures.
  44. ## Lanes (planned for the earlier reviewer, not yet used by it)
  45. On the earlier setup's review box there are 10 lanes: one full workspace per lane with every repo checked out and dependencies installable, each with a read-only app credential. Idea, not built: the reviewer leases a lane per PR, installs deps, and runs the repo gates (lint, typecheck, knip/unused, unit tests) against throwaway DBs. Gate results go into the prompt as facts, so the model does not guess. This is the top gap the CodeRabbit comparison found.

Branches

Latest commits

  • bd3591c7conductor: gates run on the live day44 binarymre
  • 47f747a7records: jukebox #9 fix livemre
  • 0a3169fdMerge branch 'vendored-size' into mainKunibert
  • e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
  • 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
  • 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
  • 50a1867estatus: jukebox #9mre
  • c57484e6log: jukebox #9 diff sizemre
  • 795a20carecords: guard fix live (PR 8)mre
  • 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
  • 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
  • f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
  • 10b2a49estatus: PR 314, guard fix proposedmre
  • e73995a3log: hycon PR 314 approved after fresh reviewmre
  • f60427falog: hycon PR 314 false tool errormre
  • 481974f7log: Hermes accepts PR 259 findingmre
  • bb0976acrecords: hycon PR 259 design findingmre
  • 5c637c24records: hycon PR 259 false tool errormre
  • a344c406log: routger 132 reviewedmre
  • 56e70dcbrecords: review time limit 1800 s (routger 132)mre