Repository navigation
feat: pull request review folders and sessions for GitHub (increment 4a, ADR-0144) - #107
Conversation
A review workspace is its own control record with fixed preferences, a scratch-only write rule at the file layer, and a closing record that stops every later binding and dispatch. Session journals gain the review.* events. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…eview into a folder Pure parsers for the PR URL, repository paths and unified diffs, the GitHub and GHES adapter with a paced request sender, the folder writer, and the fetch pipeline with per-version outcomes and a manifest. Tested against loopback fixtures only; no real host was contacted. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…logic Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ions A review session's turns now offer two more tools, run under the review workspace's fixed rules, refuse once the review is closed, and check the review record under the control lock at turn start and every dispatch. Also applies cargo fmt to the earlier review commits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… list a review's actions start_review parses the address against the recorded hosts, fetches into a new review folder, records the review workspace, and creates the session, removing the folder and closing the record on any failure. Adds turn-level tests for the fixed rules, scratch-only writes, the close, and the draft tool, and the actions list --review filter. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Closing a review ends its turns, deletes its folder only while it is still the recorded directory, and leaves the folder for a retry when a turn does not end in time. The host removal path now closes its reviews through the same steps. Tool mode and skill loading resolve an open review's workspace. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds ADR-0144, the changelog entry, the review journal events in the session storage guide, the review rules in the security coding rules, the review session's tool list in the instructions guide, and an "Increment 4a as implemented" section in the reviews contract that lists where the implementation differs from it. The delivery list now splits increment 4 into 4a (GitHub and GitHub Enterprise Server) and 4b (the other adapters). AGENTS.md swaps three long ADR link targets for plain ids to stay under the 32 KiB project-instructions cap. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…iew's summary Core and platform changes behind the review desktop (ADR-0144): - A host path is compared after a per-character simple uppercase and then lowercase fold, for `.git`, `.OMGCode` and the device names too (COM0 to COM9, LPT0 to LPT9). A name that the volume already holds, or that needs a directory where a file is, is an `unportable_path` collision, not a failed fetch (`CreateError::is_name_conflict` in the platform crate). A failed review folder create removes the folder. - A path over 256 bytes is unportable, including one given to the on-demand fetch tool, which refuses it before the host or the ledger is touched. - A review start is refused up front once 1,024 review records exist. - A review session refuses `workspace_git_read` with `git_read_disabled`. - `review::summary` reads the title, author, and state of an open review from `review.json`, through the recorded folders and only while the manifest has the digest that `review.started` recorded. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Adds the Rust side of the review desktop (ADR-0144): - Six `main` commands: `review_skills`, `review_start`, `review_progress`, `review_cancel`, `review_info`, and `review_remove`. A start runs on its own thread, at most two at once, and answers with an operation identifier. No command takes a host, a token, or a path, and every failure text is fixed. - `session_tree` lists review sessions in a `reviews` list, each session carries `review` (`open`, `closed`, or null), `terminal_open` refuses a review session, and `workspace_entries` lists an open review's folder and refuses a closed one with `review_closed`. - Removing a review host, or replacing its token, cancels every start in flight. A host removal reports each review whose folder was left, in the CLI and the desktop (`review_removal_incomplete`). Shutdown cancels starts and reports one that stays as `review_starts_still_running`. - `review_info` reads the title, author, and state of an open review from `review.json` through core, and never from a journal. - The command count is 93 (43 `main`, 3 `approvals`, 47 `settings`). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…the main window The UI side of the review desktop (ADR-0144). Every string from a host is a text node: a link or image in a pull request stays inert text. - **New Review** opens a dialog with the pull request address, a review skill, and the session's provider, model, and effort; it follows `review_progress` and can cancel. - The sidebar lists review sessions in a collapsible **Reviews** section, apart from the workspace groups, and a closed review's row says so. - A review session offers only Files, Context, and PR context. A header shows the pull request's title, author, and state and offers **Remove review...** with a retry when the folder was left; the transcript shows the `review.*` events as short text. - The mock backend answers the six commands so the interface runs without Rust, and the settings help no longer says that creating a review is not available. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Records what increment 4a does and does not do (ADR-0144, docs/reviews.md): the path and record limits, the known limits of the fetch, the desktop commands and panels, the journal events, the closing rules, and that no adapter has run against a real host and nothing posts. Bumps the workspace to 0.92.0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedToo many files! This PR contains 137 files, which is 37 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This organization's CodeRabbit subscription is cancelled. Resubscribe in Billing to continue reviews beyond the free-tier limit.
|
|
It won't be retried until the next push, or until someone asks for a review in the bot. |
There was a problem hiding this comment.
🤖 Automated review of e7f43a6
Bot review number 1 of 30.
This PR adds GitHub pull-request review folders and isolated review sessions, including fetching, validation, bounded storage, session lifecycle handling, UI integration, and documentation. It is not safe to merge: multiple major lifecycle and concurrency defects can leave reviews or starts permanently stuck, publish cancelled or failed reviews, delete swapped or protected data, lose retry paths, or mishandle credentials and cleanup. Additional risks include GitHub deleted-file handling, retry-delay overflow, ledger and storage-budget failures, URL fragment rejection, post-close access, and several documentation/UI contract inconsistencies.
Findings: 🟠 14 × [P2] MAJOR · 🟡 7 × [P3] MINOR (Defect) · 🔵 2 × [P4] MINOR (Quality)
🛑 Changes requested: 21 unresolved finding(s) at [P3] MINOR (Defect) or above. I'll withdraw this once they're fixed or resolved.
Files not reviewed (1)
Cargo.lock (ignored by pattern)
Model chatgpt · skill code-change-review · 129 files reviewed. Reply to an inline comment to discuss it.
Sixteen findings of a review of the review folders and sessions, each with a test (ADR-0144, Amendments): - The review header says "Partial: N of M changed files" and "Incomplete: K changed files without stored content", and a busy journal shows the loading line, not an error. - A start whose progress read answers busy no longer re-enables Start review, which could fetch the same review twice. - The PR context fences the description so it cannot forge a field. - review.json and pr/files.txt stay inside 1 MiB: the fetch counts the largest record of a file before it downloads the file. - The trusted CLI's review-host remove deletes no review folder, because it cannot see the desktop's turns. - Registering a workspace or granting a folder fails closed when the review folder root cannot be found. - review_fetch_file changes one ledger at a time, counts a file stored before a failed ledger save, and removes its temporary file; removal and the start sweep clear the ledger files. - A folder counts as deleted only when nothing is left at its place. - A path the review text escapes can no longer be stored; one predicate and an exhaustive code-point test keep the sets equal. - A request may have 48 path segments. - A draft body with a bidirectional override or isolate is refused, and a carriage return and line feed pair is a line feed. - A token change or host removal that will be refused cancels no start. - Remove review takes the settings-change flag after its confirmation. - Two different versions of more than 50,000 lines are not compared. No adapter has run against a real host. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The review bot opened 22 threads on the previous head. Two were already fixed by the previous commit, some read the code wrongly, and some are documented limits. These held up and are fixed, each with a test where one can reach it: - pr/ keeps 1 MiB of its 128 MiB free for pr/files.txt, which is written after the versions. - A start looks at a cancel once more before it records the review. - A rate-limit reset time from a host cannot overflow the wait. - The host help text no longer says that removing a host always deletes the folders. - A test pins that a rename, a delete, and an edit of a fetched file in pr/ are refused. - The contract says the PR context is recorded when the review starts, that four adapters (six kinds) remain, and three known limits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A start that failed before it had a session, and could not delete its folder, left a closed review record that no session could retry. The orphan sweep skipped it because a record named it, so the fetched pull request stayed on disk. A start now deletes the folder of a closed review a day after its last change, and only while it is still the folder the record names (the same identity check a removal makes). Tests: an old recorded folder goes, a young one stays, and a folder swapped for another directory stays. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…cked Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🤖 Automated re-review of af72aee
Bot review number 2 of 30.
New findings are only on code changed since the last review (e7f43a6); the rest was reviewed then.
This PR adds GitHub pull-request review folders and sessions, including isolated workspace handling, session metadata and ledgers, review tooling, desktop UI, lifecycle management, and updated documentation. The main risks are a manifest budget undercount for escaped unportable paths and ledger replacement failing on every second distinct fetch on Windows, both of which can break otherwise valid reviews. Additional issues include premature cancellation during host/token replacement, missing-root overlap checks, a non-UTF-8 diff validation gap, stale closed-review titles, inaccurate token-replacement documentation, and an outdated segment-limit error message.
Findings: 🟠 2 × [P2] MAJOR · 🟡 6 × [P3] MINOR (Defect) · 🔵 1 × [P4] MINOR (Quality)
🛑 Changes requested: 13 unresolved finding(s) at [P3] MINOR (Defect) or above. I'll withdraw this once they're fixed or resolved.
Files not reviewed (1)
Cargo.lock (ignored by pattern)
Model chatgpt · skill code-change-review · 136 files reviewed. Reply to an inline comment to discuss it.
Fixed: - A host's removal or a token's replacement cancels the review starts in flight once the change is recorded (or may be), not before: a change that core then refused, such as a revision another writer moved, had already cancelled starts that it did not need to. The shared removal calls `host_unbound` on the caller's `ReviewTurns`. - A review folder root that does not exist yet refuses a directory that contains the folder it will be created in, instead of passing it. A folder grant checks application storage first, so the data directory keeps the clearer `StorageOverlap` reason. - The review header drops the pull request's title the moment an open review is shown as closed, also when the read of the closed review fails. - The refusal for too many request path segments says 48, not 32. Contract: `review-host set-token` closes no review; a cancel is looked at for the last time just before the review is recorded and ends no start after it; a start that fails deletes the folder it created by name, without the record check; a summary read begun just before a closing may return once more. Pinned by new tests, because findings were wrong about the code or the behaviour was only implied: a path of control characters counts at its escaped size in the room budget, a second distinct file replaces the ledger that the first wrote, and a cancel from inside the session's preparation leaves the review open. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🤖 Automated re-review of e92d4b7
Bot review number 3 of 30.
New findings are only on code changed since the last review (af72aee); the rest was reviewed then.
This PR adds GitHub pull-request review folders and sessions, including review lifecycle management, isolation from normal workspaces, cancellation, UI state handling, expanded path limits, and related documentation/tests. The main risks are races during host removal or token replacement, where in-flight review starts may continue using credentials or writing to folders being deleted, and an isolation flaw that accepts ancestor directories before the review root exists. Cleanup is also aggregated across reviews, so one stuck review can prevent unrelated review folders from being removed.
Findings: 🟠 4 × [P2] MAJOR · 🟡 2 × [P3] MINOR (Defect)
🛑 Changes requested: 11 unresolved finding(s) at [P3] MINOR (Defect) or above. I'll withdraw this once they're fixed or resolved.
Files not reviewed (1)
Cargo.lock (ignored by pattern)
Model chatgpt · skill code-change-review · 137 files reviewed. Reply to an inline comment to discuss it.
Fixed: - A host removal that closes several reviews judges the turns of each on their own. `ReviewTurns::stop` returns the reviews whose turns ended, not one flag for the batch, so a turn that does not end within 60 seconds leaves only its own review's folder. One flag left every folder in place, against the contract that a review that cannot be finished does not stop the others. - The documents no longer say that a removal or a token replacement ends a review start. The start is asked to stop, a request already sent completes with the token it loaded, and the replaced token stays valid at the host until the operator revokes it there. They also say that a replacement whose journal write is uncertain cancels the starts and still reports the error. Contract: a start writes nothing into the review folder after the review is recorded (the files are written before), so a removal that deletes the folder meets no writer, and the removal does not join the starts. A new test deletes the folder from inside the session's preparation and checks that the start finishes and that nothing brings the folder back. Not changed: the finding that an ancestor of the review root is accepted before the root exists is wrong about the code. A directory that holds the folder the root will be created in, or any ancestor of it, is refused, and a sibling is allowed, which an existing test pins. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… deletion The test added for the third re-review deleted the review folder from inside the session's preparation and asserted that the deletion worked. On Windows it does not: the start keeps its own handle on the folder until it ends, so the deletion fails, the removal reports `review_removal_incomplete` for that review, and a retry deletes it. The test failed on the Windows filesystem job and locally. The test now pins what holds on both systems: after the record the start writes nothing into the folder, so a folder that a removal deleted stays gone and one that it could not delete is left exactly as the removal found it. The contract says what happens on Windows. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|



Summary
Increment 4a of the pull request review contract (docs/reviews.md, ADR-0144): review folders and review sessions for GitHub and GitHub Enterprise Server. The operator pastes a PR address into New Review; OMGCode itself (never the model) fetches the PR from the recorded review host into an isolated review folder and opens a review session. The model reads and lists the folder, writes only under
scratch/, can fetch one more listed file, and can record draft comments. Nothing posts to a host and no posting call exists. No adapter has run against a real host: the GitHub adapter is tested against loopback fixtures only.This is the first of two stacked PRs. Increment 4b (GitLab, Azure DevOps, Bitbucket; ADR-0145) follows on a branch from this one.
What changed
<data>/reviews-v1/<id>/withpr/(holdingbase/,head/anddiff/),fetched/,scratch/andreview.json; sequential, bounded fetch (1,000 files, 1 MiB a version, 128 MiB, 6,000 requests) honouring rate-limit signals; every host path parsed as a portable relative path (case fold, reserved names,.git/.OMGCode, 256-byte limit) before anything is written.scratch/only; ten tools (read, list, six file writes,review_fetch_file,review_draft_comment); no command, web, Git orAGENTS.md; the PR context message (at most 16 KiB) is recorded at start; fivereview.*journal events.review_removal_incompleteand a retry. Removing a review host closes its reviews, cancels review starts in flight, and reports each review whose folder was left.maincommands (93 in total).docs/reviews.md(what is implemented, limits, known limits),docs/desktop-interface.md,docs/session-storage.md,docs/security-coding-rules.md,CHANGELOG.md. Version 0.92.0.CHANGELOG.md):busyafter the fetch had finished ended the dialog's wait and re-enabled Start review, so the same review could be fetched twice. The dialog now asks again (at most 30 times) and then says the review may have been created. The header and the PR context tab also show the loading line, not an error, while the journal is busy.|, a line says where it ends), so a description cannot forge a field, its own end, or a file of the list.review.jsonandpr/files.txtstay inside their 1 MiB limits: the fetch counts a record's largest size before it downloads the file, drops the notes of a record that no longer fits, and ends the list as partial when even that does not fit.review.jsonis written compactly.review-host removecloses a host's reviews but deletes no folder (it cannot see a turn that the desktop runs); every review is reportedreview_removal_incompleteand the desktop's Remove review… finishes it.review_fetch_filechanges one ledger at a time (an exclusive lock,review_busyfor a second call), counts a file stored before a failed ledger save instead of failing it for good, and removes its temporary file on a failed save. Removing a review removes the ledger, temporary file and lock; a start sweeps them for a closed review whose folder is gone.\r\nis accepted as\n.too_large; both versions are stored), because the diff library cannot be cancelled. Debug timings only; release timings were not measured.pr/keeps 1 MiB free forpr/files.txt; a start looks at a cancel once more before it records the review; a rate-limit reset time cannot overflow the wait; the host help text no longer says that removing a host always deletes the folders; the contract says the PR context is recorded when the review starts, that four adapters for six kinds remain, and three known limits (a deletion by name after the identity check, a failed-start record that cannot be closed, a token replacement that cancels without waiting). Pinned by a test: a rename, delete, or edit of a fetched file inpr/is refused (the source of a rename was already checked). Not defects: thecontextmove inreview_info(the value isCopy), the start registered after its thread began (the table lock is held across both), GitHub'sremovedfile status (GitHub documentsremoved, notdeleted), the fragment check in the address parser (the fragment is cut first), and the spent single-use setup in the dialogs (Refresh models reads a new one).review-host set-tokencloses no review, a cancel after the review is recorded ends no start, a failed start deletes its own folder by name without the record check, and a summary read begun just before a closing may return once more. Not defects, each now pinned by a test: a path of control characters is counted at its escaped size by the room budget,std::fs::renamereplaces the ledger on Windows (a second distinct file is fetched and both are counted), and identical non-UTF-8 versions are refused asnot_utf8(an existing test already covered it). Documented, not changed: a fetch longer than the sweep's day, a folderless record, and the deletion by name.Why it changed
PR text and files are the most direct prompt-injection route the product has, so the review path is built so that the model's reach is smaller than an ordinary workspace's: OMGCode makes every request, a token only ever goes to the host's recorded REST origin, paths are validated before they touch the disk, writes reach
scratch/only, and a closed review cannot dispatch another call. The fixes close the ways the first version let PR text act as the review's own text, overran a file limit after the downloads, or ran a deletion or a second fetch beside a running turn.Tests
Updated:
New:
review_removal_incomplete, ledger files), the start sweep, the record cap, the compared-line limit, and the summary read.terminal_unavailable,review_closedlisting.e92d4b7, all passing:cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace(3,246 passed, 0 failed, 10 ignored),tsc, Biome, Vitest (1,404 tests), andtest:dist. Not run locally: any Linux test (CI runs Linux; the Linux VM could not be reached), and the release-build timing of the diff limit (debug only). No adapter was run against a real host, and no review host was contacted.🤖 Generated with Claude Code