Skip to main content

Module review

Module review 

Source
Expand description

Review-conversation tools (Phase 2).

Worker-facing MCP tools that turn a submitted review set into a two-way conversation. The reviewer submits comments via /diff; the worker reads them, replies, and resolves through mcp__forge__review__*, and each reply appends to the comment thread and flips it Open -> Addressed.

This module holds the JSON view shapes the tools return plus the pure mappers from the durable forge_primitives::review types. The store I/O lives in crate::store::review; the Workspace::review_* wrappers surface it; the Tool impls + caller resolution live beside this (the facade submodule and the tool structs).

Re-exports§

use std::sync::Arc; 🔒
use serde::Deserialize; 🔒
use serde::Deserialize; 🔒
use serde::Serialize; 🔒
use serde::Serialize; 🔒
use forge_sdk::mcp::server::McpServerBuilder; 🔒
use forge_sdk::mcp::tool::Tool; 🔒
use forge_sdk::mcp::tool::ToolInput; 🔒
use forge_sdk::mcp::tool::ToolOutput; 🔒
use forge_sdk::mcp::tool::ToolOutputBlock; 🔒
use forge_primitives::review::ReviewAuthor; 🔒
use forge_primitives::review::ReviewSet; 🔒
use forge_primitives::review::ReviewSide; 🔒
use forge_primitives::review::ReviewStatus; 🔒
use forge_primitives::review::ReviewThread; 🔒
use forge_primitives::review::is_doc_scope; 🔒
use forge_primitives::review::is_tree_scope; 🔒
use forge_primitives::review::tree_scope_ref; 🔒
use crate::SessionSlot; 🔒
use crate::mcp::review::facade::ReviewFacade; 🔒
use crate::mcp::review::facade::ReviewScope; 🔒

Modules§

facade
The narrow workspace surface the review-conversation tools call, plus the production impl on Workspace and a mock for unit tests.

Structs§

CommentAnchorView
What review__reply and review__resolve answer with: where the comment is anchored and the review round its latest turn belongs to, alongside the state it now holds. number is the review’s 1-based ordinal, null while the thread is filed in no round.
GetArgs 🔒
ListArgs 🔒
ReplyArgs 🔒
ResolveArgs 🔒
ReviewActivity 🔒
One worker review action recorded during a turn, accumulated per caller and drained at the turn’s end into a single notice per review.
ReviewCommentView
One comment in review__get, carrying the anchored code so the worker can locate the spot regardless of the comment’s diff scope (a commit-scoped comment’s line may not match the current working tree).
ReviewDetail
review__get: a review’s overview plus the comments filed under it.
ReviewGet 🔒
review__get - the comments of one review, with anchored code.
ReviewList 🔒
review__list - the submitted reviews on the caller’s (project, branch), or on an explicit scope.
ReviewReply 🔒
review__reply - append a reply to a comment thread; flips it Open -> Addressed.
ReviewResolve 🔒
review__resolve - mark a comment resolved.
ReviewSummary
One row of review__list: a submitted review plus its member-comment tally by state.
ReviewTurnView
One turn in a comment thread: author is "you" for the reviewer or the agent’s label for a worker reply. review is the number of the review that sealed the turn, so a thread spanning several rounds shows which turns belong to which; None on agent replies and on a turn no review has sealed yet.

Functions§

add_tools 🔒
Attach the four review-conversation tools to an existing builder. The parent module’s build_forge_server calls this so they share the forge server name with the agents tools.
author_str 🔒
comment_anchor 🔒
Build the anchor echo for thread, whose state just became status.
comment_view 🔒
Map one thread to its review__get view. The whole conversation is carried, not just the requested review’s turns, so the worker reads a later round with the earlier exchange as context; each turn’s review says which round it came from.
detail 🔒
Build the review__get detail for review_id, or None when no such review exists on the branch.
json_or_error 🔒
list_output 🔒
The caller’s rows, plus the project’s other review-bearing branches when there are any. A branch-scoped list is indistinguishable from the project’s whole set, and a review on the caller’s own branch is no reason to leave the one beside it unseen.
merge_newest 🔒
Branch rows and seat-tree rows as one list, newest first. Review ids are uuids, so none collide across the two scopes; number is per-scope and CAN repeat, which is why the tree’s rows come with the scope note beside them.
notice_message 🔒
The reviewer-facing one-line summary a worker’s review turn produces: worker addressed review #N - A replied, B resolved, C open. Open /diff. open is the review’s current open-comment count after the turn, and scope names the review itself, because each scope’s comments open in a door of their own: the document viewer, the files page, or the diff overlay (the lead’s gate, 2026-10-17: a tree scope pointed at /diff, which never carries one - the same hole the doc scope’s door had closed).
rfc3339_now 🔒
RFC3339 timestamp for the current instant, matching the peers helper.
scope_or_error 🔒
Resolve the caller’s review scope or a ready-to-return tool error naming the step that failed (see ScopeError).
seat_tree_scope 🔒
The caller’s seat-tree scope, derived from its resolved branch scope: project, author label and caller carry over; the key is the seat’s own tree (a worker’s worktree, the lead’s checkout), which is where the files page’s reviews live. The tools consult it beside the branch on their default (no scope argument) path.
side_str 🔒
status_str 🔒
summarize 🔒
Build the review__list rows for reviews given every thread on the branch, newest review first. A review’s members are the threads with a turn filed into it, so a thread the reviewer replied on across rounds counts under each of them.
tool_error 🔒