GeezerVison is showing github.com — feat(review): add pinned review scopes, snapshots, and activity tracking by puri-adityakumar · Pull Request #1768 · Nano-Collective/nanocoder
Conversation
This PR is part of a stacked series for #1287: Q (#1478, merged) → Foundation (this PR) → Grounded default → Deep → Headless. They merge in that order (plan). This PR doesn't close the issue on its own.
Overview
The grounded review in the next PR lets agents read files and check their claims against the code. For that to be safe and honest, the target has to be settled before any model call: which commits, which files, and nothing that changes halfway through. Today /review builds its diff on the fly. This PR adds the groundwork that resolves and pins a review target, plus the activity tracking the live view will use. None of it is connected to /review yet, so /review and /review quick behave exactly as on main. The next PR connects it.
- Reads review requests.
branch <name>, a remote branch, a PR number or URL, last N commits (optionally on branch <name>), and working tree. Anything else gets a usage hint instead of a guess.
- Pins the target before review. Each request resolves to exact commit IDs. A PR keeps its base tip, merge-base and head. If a name matches more than one candidate, or the working tree has changes while the branch also has commits ahead, it asks which one you mean.
- Reads files from Git, not the disk. Snapshots come from Git objects. A working-tree review copies the index to a scratch file and runs
git add --all and git write-tree against it, so the real index and files are never touched. Oversized files, too many files, or too much content fail the resolution instead of returning a partial scope.
- Keeps fetched refs tidy. PR and remote heads are fetched into one fixed ref per source under
refs/nanocoder/review/ and removed afterwards. Nothing is checked out.
- Records activity. Each Git,
gh and model step goes into a bounded event store with secrets redacted. The activity view shows a one-line summary, d for details, and Esc to cancel. It's tested here and appears in /review from the next PR.
- Decodes Git output once.
execGit and execGh decoded each stdout chunk on its own, which can break a multi-byte UTF-8 character split across two chunks. They now collect the bytes and decode once, and accept an abort signal. execGitBuffer returns raw bytes for snapshots.
/review on the same fixture repo and model (Groq openai/gpt-oss-20b). The findings are worded differently because the model's output varies from run to run; the scope line, layout and footer are the same.
main |
This PR |
 |
 |
Try it
/review and /review quick are unchanged. The new code runs through its tests:
pnpm run test:ava source/review/review-request.spec.ts source/review/review-resolver.spec.ts source/review/review-activity.spec.ts source/components/review-activity.spec.tsx source/tools/git/utils.spec.ts
Testing
- New unit tests for request parsing, target resolution, snapshots, review refs, the activity store and view, and byte-exact Git output. The 5 spec files above pass (64 tests).
- Format, lint, types, knip and build pass
- Full suite on Node 22, merged with current
main: 9,409 pass. The only 2 failures are macOS temp-path tests in gh-pr-worktree.spec.ts that also fail on main. Line coverage is 94.19% (main badge 94.2%).
- Checked by hand in the TUI with a real model:
/review and /review quick main show the same scope, layout and footer as main
- CI on this PR passes
Findings
- A working-tree snapshot hashes untracked, non-ignored files into the object store before the 1 MiB per-file limit is checked. Those objects are unreferenced and removed by normal
git gc.
- Two reviews of the same PR at the same time share one fixed ref. Head fetches check the expected commit ID, so the worst case is a newer tip of the same base branch or a failed resolution you can retry, never another target's commit.
- Review traces aren't saved in sessions yet. That comes with the next PR, when the review has a session to belong to.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @puri-adityakumar, this is carefully built.
I checked the security-sensitive parts: ref names are validated (leading "-", whitespace and special characters rejected, and "--" / "--end-of-options" used before user-influenced values), the fetch uses check-ref-format with no tags or submodules and an expected-commit check, temp refs are cleaned up, and all file contents come from git cat-file blob, so nothing is read from disk but a copy of the index.
I ran it locally: types, lint and knip are clean, and 63 of the 64 tests in the five specs pass (the one failure is the symlink test, which can't create a symlink on Windows: EPERM).
Three small things:
- Please skip the symlink test on Windows (or catch EPERM), so it doesn't fail for Windows contributors.
- review-snapshot.ts:391:
copyFile(...).catch(() => undefined) hides a failed index copy. Please record it in the activity log.
- A design question for the next PRs, for @will-lamerton and you: a working-tree review snapshots untracked, non-ignored files with
git add --all. A stray .env that isn't gitignored would be included, and later sent to the model. Should we exclude common secret filenames, warn, or ask first? It's worth settling before the grounded default PR connects a model.
No changes needed to merge this foundation as is; I'd like Will's sign-off on the design before it goes in.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @addyCooks, really appreciate you testing on Windows and the careful read.
My suggestions:
- Symlink test: skip it on Windows, the same way
lifecycle-hooks.spec.ts does. It still runs on macOS and Linux. Open to suggestions.
- Index copy: stay quiet only when there's no index yet (a fresh repo). For any other failure, log a warning to the review activity and carry on.
- Untracked
.env: keep untracked files in reviews, but skip ones that clearly look like secrets (.env / .env.* except .env.example, *.pem, *.key, id_rsa*, id_ed25519*) and show a line in the activity, e.g. "Skipped 1 file that looks like a secret: .env.local". No prompt, so headless runs keep working.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks so much @puri-adityakumar,
I really appreciate the quick and thoughtful reply.
All three proposals work for me:
- Skipping the symlink test on Windows, the same way lifecycle-hooks.spec.ts does: sounds good.
- Staying quiet only when there's no index yet, and otherwise logging a warning to the review activity and carrying on: that works well.
- Skipping secret-looking untracked files with a visible line in the activity and no prompt, so headless runs keep working: a great approach.
For the third one, if it's not too much trouble, here are a few small suggestions:
- A few more patterns could be worth covering:
.netrc, .npmrc, *.p12, *.pfx, *.keystore and .aws/credentials.
- Please apply it only to untracked files in working-tree reviews (committed content is reviewed as is), and keep file contents out of the activity line.
- It would be great to have a test for each of these: a secret-looking file is skipped and reported,
.env.example is kept, and a normal untracked file is kept.
Whenever you've pushed these, I'll happily take another look.
@will-lamerton, when you have a moment, could you also take a look at the overall design of the stack?
This PR is the foundation for the grounded review PRs that follow.
Thanks again for the careful work on this.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @addyCooks, pushed all three fixes (Windows symlink test skip, index copy warning, secret-looking untracked files left out with only names shown) and merged the latest main to clear the conflict.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @puri-adityakumar, I re-checked this at 9f7c80c.
All three of my points are addressed: the Windows symlink test is skipped, a failed index copy is reported, and secret-looking untracked files are excluded safely. The tests pass here and CI is green. Approving.
Non-blocking, for you or the next PRs:
- One file over 1 MiB (e.g. a changed lockfile) fails the whole review. Listing it as "skipped, too large" may be friendlier.
- Please add a direct test that
execGit (the string version) no longer corrupts split UTF-8; only execGitBuffer is tested today.
- The
update-ref -d cleanup swallows errors silently, so a leftover ref would go unnoticed.
validateRefName allows @{...} and ..; git check-ref-format --branch would match the "exact Git refs" wording.
- Redaction doesn't cover a bare token as a URL username, or
glpat-/xoxb-/AKIA keys.
@will-lamerton, could you take a look at the overall design of the stack before this merges?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hi @puri-adityakumar, thanks for this PR! It looks like a maintainer has left feedback
or review activity and there are still some outstanding items to wrap up.
Whenever you get a chance, could you take a look at the open comments?
If anything is unclear or you'd like a hand, just reply here and we'll help you get it across the line.
|
puri-adityakumar reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hi @puri-adityakumar, just a heads-up that this PR still has outstanding items
and hasn't seen any activity in a while.
If we don't hear back within about a week, we'll close it to keep the queue tidy.
You can always reopen it later. Happy to help if anything is blocking you - just say the word.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
akramcodez reacted with thumbs up emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
will-lamerton
added a commit
that referenced
this pull request
Nov 11, 2026
source/review/ (pinned review scopes, snapshots, activity store and the
ReviewActivity component) landed in #1768 as the first stage of a staged
review rewrite. The next stage that would have wired it into /review never
landed, so nothing outside its own specs imported it.
Delete the module and component, and rewrite docs/features/review.md to
document the /review command that actually ships instead of the staging
plan.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
will-lamerton
added a commit
that referenced
this pull request
Nov 11, 2026
source/review/ (pinned review scopes, snapshots, activity store and the
ReviewActivity component) landed in #1768 as the first stage of a staged
review rewrite. The next stage that would have wired it into /review never
landed, so nothing outside its own specs imported it.
Delete the module and component, and rewrite docs/features/review.md to
document the /review command that actually ships instead of the staging
plan.
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
jay23606
added a commit
to jay23606/nanocoder
that referenced
this pull request
Nov 12, 2026
…ing (Nano-Collective#1768)
* feat(review): add pinned review foundation
* docs(review): define session trace follow-up
* test(review): isolate review Git fixtures from host config
* fix(review): identify credentialed HTTPS GitHub remotes
* fix(review): discover untracked files from the repository root
* fix(review): select recent commits along first-parent history
* fix(review): accept www GitHub remote hostnames
* test(review): isolate binary Git fixture from host configuration
* refactor(review): simplify worktree snapshots and remote review refs
* docs(review): name the next stage instead of a fork PR number
* test(review): skip the symlink snapshot test on Windows
* fix(review): report Git index copy failures instead of hiding them
* fix(review): leave secret-looking untracked files out of worktree snapshots
---------
Co-authored-by: Cursor Agent <[email protected]>
jay23606
added a commit
to jay23606/nanocoder
that referenced
this pull request
Nov 12, 2026
…2032)
source/review/ (pinned review scopes, snapshots, activity store and the
ReviewActivity component) landed in Nano-Collective#1768 as the first stage of a staged
review rewrite. The next stage that would have wired it into /review never
landed, so nothing outside its own specs imported it.
Delete the module and component, and rewrite docs/features/review.md to
document the /review command that actually ships instead of the staging
plan.
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This was referenced Nov 17, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|