Skip to content

feat(review): restore the review foundation that grounded /review builds on - #2297

Merged
akramcodez merged 2 commits into
Nano-Collective:feat/1287-grounded-reviewfrom
puri-adityakumar:review-1287/1-foundation
Nov 25, 2026
Merged

akramcodez merged 2 commits into
Nano-Collective:feat/1287-grounded-reviewfrom
puri-adityakumar:review-1287/1-foundation

Conversation

@puri-adityakumar

Copy link
Copy Markdown
Contributor

Description

Part 1 of 4 for #1287. Targets feat/1287-grounded-review, as agreed in the issue. Merge order: this PR, then grounded, deep and headless.

Problem. /review today hands the model a diff in one shot, and nothing checks that what it reports is real. Grounded review (#1287) needs a fixed, read-only view of exactly what is being reviewed before any model call. That groundwork landed in #1768, but #2032 removed it because nothing was using it yet.

What this PR does. It brings that foundation back, unchanged except for one bug fix, so the next PR can wire it into /review. /review itself behaves exactly as before.

  • source/review/review-request.ts reads what the user asked for: a branch, a PR, recent commits or the working tree.
  • source/review/review-resolver.ts turns that into exact commits before any model call, and asks when the request is unclear.
  • source/review/review-snapshot.ts reads the changed files from Git objects. Working-tree reviews go through a scratch index and git write-tree, so the real index and files are never touched. PR and remote refs are fetched into one fixed ref per source under refs/nanocoder/review/ and removed afterwards.
  • source/review/review-activity.ts and source/components/review-activity.tsx record each Git, gh and model step (with secrets redacted) for the live view in the next PR.
  • knip.json ignores these files for now, since only their specs use them. The grounded PR removes those ignores.

Bug fix. A working-tree review could miss an edit when the file kept its size and was saved in the same second as the last Git index write. The scratch index was a plain copy with a fresh modified time, so Git trusted its stale file info and skipped the change. The copy now keeps the real index's modified time, so Git re-checks those files. A new test pins all the timestamps to reproduce it; it fails without the fix and passes with it. This also fixed a flaky headless review test in part 4.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Changeset

  • Added a changeset (pnpm changeset) describing this change for the changelog

No changeset here: nothing user-facing changes until the grounded PR, which carries the changeset.

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Run on macOS, Node 22:

  • test:format, test:lint, test:types, test:knip, build: pass.
  • test:ava: 11,342 pass, 38 fail. The same 38 fail on plain feat/1287-grounded-review in the same setup, so none come from this PR: 34 in cli-value-flags.cli-integration (a React duplicate-key error), 2 --acp trust checks that need a trusted checkout, and 2 auto-commit tests.

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

GMI Cloud (zai-org/GLM-5.3-Flash) on a small fixture repo: /review works as before.

/review on this branch, top

/review on this branch, bottom

Checklist

  • If this was for an open issue, I was assigned to it
  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging (see CONTRIBUTING.md)

No docs change, because there is no user-facing change yet. Logging: each review step is recorded in the review activity store instead of the app log.

Part of #1287.

@will-lamerton will-lamerton left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @puri-adityakumar. I diffed every restored file against the versions #2032 removed (dfcea49e^): 9 of 12 are byte-identical, so "restored unchanged" holds. The one real change, copyIndexKeepingTime in review-snapshot.ts, is correct. Keeping the real index's mtime on the scratch copy means Git still re-hashes files edited in the same second the index was written, and removing a partial copy on failure safely falls back to an empty index. The new resolver test covers it. The knip.json ignores are temporary and #2298 removes them.

Two notes for the stack, not for this PR:

  • No CI runs on PRs into feat/1287-grounded-review, so this approval is based on reading the code, not on checks.
  • The feature branch is now 44 commits behind main. Rebasing it (as you asked on #1287) before merging the parts will keep #2298–#2300's conflicts small.

@puri-adityakumar

Copy link
Copy Markdown
Contributor Author

Hey @will-lamerton, quick question on the base branch: feat/1287-grounded-review is still 44 commits behind main. Would you prefer to sync it with main first (and I'll rebase the stack right after), or merge #2297 as-is and sync once the stack lands?

@akramcodez
akramcodez merged commit e0f9ab4 into Nano-Collective:feat/1287-grounded-review Nov 25, 2026
akramcodez added a commit that referenced this pull request Nov 26, 2026
…CLI (#2417)

* feat(review): restore the review foundation that grounded /review builds on (#2297)

* feat(review): restore the review foundation

* fix(review): catch same-second worktree edits in review snapshots

* feat(review): ground /review findings in the code and verify each one (#2298)

* feat(review): restore the review foundation

* fix(review): catch same-second worktree edits in review snapshots

* feat(review): make grounded review the default /review

* fix(review): show incomplete reviews as incomplete in the activity line

* refactor(review): run review agents on the shared turn engine

* fix(review): keep offered text tool calls beside quoted markup and bound unknown context sizes

---------

Co-authored-by: akramcodez <[email protected]>

* feat(review): add /review deep so one finder's blind spots don't go unreviewed (#2299)

* feat(review): restore the review foundation

* fix(review): catch same-second worktree edits in review snapshots

* feat(review): make grounded review the default /review

* fix(review): show incomplete reviews as incomplete in the activity line

* feat(review): add /review deep with specialist finders

* refactor(review): run review agents on the shared turn engine

* fix(review): keep offered text tool calls beside quoted markup and bound unknown context sizes

* fix(review): share the diff size limit so deep review and the verifier bound unknown context sizes

---------

Co-authored-by: akramcodez <[email protected]>

* feat(review): let nanocoder review run in CI and pipes without a terminal (#2300)

* feat(review): restore the review foundation

* fix(review): catch same-second worktree edits in review snapshots

* feat(review): make grounded review the default /review

* fix(review): show incomplete reviews as incomplete in the activity line

* feat(review): add /review deep with specialist finders

* feat(review): run nanocoder review without a terminal

* refactor(review): run review agents on the shared turn engine

* fix(review): keep offered text tool calls beside quoted markup and bound unknown context sizes

* fix(review): share the diff size limit so deep review and the verifier bound unknown context sizes

* fix(review): keep the cancelled report and exit code when a headless review is interrupted

---------

Co-authored-by: akramcodez <[email protected]>

* fix(review): align review specs and docs with main after merge

* fix(review): strip ANSI in review specs so they pass with color forced on

* fix(review): stop headless quick review passing on empty or partial output

---------

Co-authored-by: Aditya Kumar Puri <[email protected]>
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.

3 participants