Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ the same way as a screenshot: a change keeps the GitHub check pending instead of
that approved it (`baselines.review_id`). Everywhere a review shows (the build's reviews, "approved on main",
`get_build`, the PR comment, the check summary) it reads "Claude Code for Ada Lovelace", "Ada Lovelace" (the web app)
or "a project token (CI)" (`models::reviews::by`): VisualCI is mostly used by agents, so an agent's approval never
reads as the person's own (Nathan, 2 Dec 2026).
reads as the person's own (Nathan, 2 Dec 2026). In the web app the build page's optional "Why?" field is the note for
whichever review is made from it (sc-8799).
- Two pull requests that change the same snapshot and merge separately leave an image neither showed. Between merged
approvals in a build's history the nearer merge wins, and a change whose every region is exactly a region a merged
PR's build changed and approved (the same box, the same old and new pixels) points at that build
Expand Down
2 changes: 1 addition & 1 deletion server/frontend/content/docs/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ failing in the repository instead of sending them.

**Reviews**

- `review`: approve or reject a build's changes, some snapshots' changes (`snapshots`), or only its new or only its changed snapshots (`only: "added"` or `"changed"`). Add a `note` saying why ("The new header, as the issue asked"): it's kept with the review and shown in the build's reviews, `get_build` and the pull request comment. Every review says who made it and how: "Claude Code for Ada Lovelace" for an agent signed in as its person, "Ada Lovelace" in the web app, or "a project token (CI)", so an agent's approval never reads as the person's own. When two pull requests change the same screen and merge separately, the screen after both is one neither showed, so it shows as changed until someone reviews it. If the change is exactly another pull request's approved change (the same regions, from the same old pixels to the same new ones), `get_build` marks it `matches` ("matches PR #8's approved change"), and `only: "matching"` approves those in one call. On a pull request's build whose base is a default-branch build nobody has reviewed yet, the changes that are main's own unreviewed ones are marked `on_main_unreviewed`, and `get_build`'s `inherited` says how many and which build: review those on main's build, and the pull request's own changes here.
- `review`: approve or reject a build's changes, some snapshots' changes (`snapshots`), or only its new or only its changed snapshots (`only: "added"` or `"changed"`). Add a `note` saying why ("The new header, as the issue asked"): it shows in the build's reviews, `get_build` and the pull request comment. Every review says who made it and how: "Claude Code for Ada Lovelace" for an agent signed in as its person, "Ada Lovelace" in the web app, or "a project token (CI)", so an agent's approval never reads as the person's own. When two pull requests change the same screen and merge separately, the screen after both is one neither showed, so it shows as changed until someone reviews it. If the change is exactly another pull request's approved change (the same regions, from the same old pixels to the same new ones), `get_build` marks it `matches` ("matches PR #8's approved change"), and `only: "matching"` approves those in one call. On a pull request's build whose base is a default-branch build nobody has reviewed yet, the changes that are main's own unreviewed ones are marked `on_main_unreviewed`, and `get_build`'s `inherited` says how many and which build: review those on main's build, and the pull request's own changes here.
- `review_page`: accept one page as a variant, or ignore one exact change in later builds too.

**Running a comparison**
Expand Down
2 changes: 1 addition & 1 deletion server/frontend/src/api/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ function useBuildAction<V>(org: string, project: string, n: number, fn: (v: V) =
}

export function useReview(org: string, project: string, n: number) {
return useBuildAction(org, project, n, (v: { action: 'approve' | 'reject'; snapshot_ids?: string[]; only?: 'added' | 'changed' | 'matching' }) =>
return useBuildAction(org, project, n, (v: { action: 'approve' | 'reject'; snapshot_ids?: string[]; only?: 'added' | 'changed' | 'matching'; note?: string }) =>
post<BuildSummary>(`${buildPath(org, project, n)}/review`, v),
)
}
Expand Down
61 changes: 61 additions & 0 deletions server/frontend/src/components/ReviewNote.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { NotePencilIcon, XIcon } from '@phosphor-icons/react'
import { useState } from 'react'
import { Button } from './ui'

/** A review's optional note: why, shown wherever the review appears (sc-8799). */
export function useReviewNote() {
const [open, setOpen] = useState(false)
const [text, setText] = useState('')
return {
open,
text,
setText,
show: () => setOpen(true),
/** What to send: the trimmed text, or nothing. */
value: text.trim() || undefined,
/** After a review is made: empty and hidden again. */
clear: () => {
setText('')
setOpen(false)
},
}
}

/** "Add note": shown until it's clicked, then the field ([`ReviewNoteField`]) takes over on a row of its own. */
export function ReviewNoteButton({ note }: { note: ReturnType<typeof useReviewNote> }) {
if (note.open) return null
return (
// On a phone, the pencil alone: the label would push the review buttons onto another row.
<Button variant="ghost" size="sm" onClick={note.show} title="Say why you approve or reject" aria-label="Add note">
<NotePencilIcon size={14} aria-hidden /> <span className="hide-sm">Add note</span>
</Button>
)
}

/** The note's field, on a row of its own under the review controls so nothing above it moves. It stays open, with
* what's typed, until a review is sent or its × removes it (which also drops what was typed, so a hidden note is never
* sent). */
export function ReviewNoteField({ note }: { note: ReturnType<typeof useReviewNote> }) {
if (!note.open) return null
return (
<div className="review-why">
<span className="review-why-field">
<label className="sr-only" htmlFor="review-note">
Why (optional)
</label>
<input
id="review-note"
className="input"
autoFocus
value={note.text}
maxLength={2000}
placeholder="Why? (optional)"
onChange={(e) => note.setText(e.target.value)}
/>
<button type="button" className="icon-btn review-why-close" onClick={note.clear} aria-label="Remove the note" title="Remove the note">
<XIcon size={14} />
</button>
</span>
</div>
)
}
23 changes: 17 additions & 6 deletions server/frontend/src/pages/BuildPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { errorMessage } from '../api/client'
import { QueryState } from '../components/QueryState'
import { PresignedImg, useExpiredRefetch } from '../components/PresignedImg'
import { BuildResult, Button, CodeBlock, Help, Pill, ReviewPill, StatePill, type Tone } from '../components/ui'
import { ReviewNoteButton, ReviewNoteField, useReviewNote } from '../components/ReviewNote'
import { fullDate, n, plural, shortSha, timeAgo } from '../lib/format'
import { usePersistentState } from '../lib/theme'

Expand Down Expand Up @@ -67,6 +68,10 @@ export function BuildPage() {
const q = useBuild(org, project, number)
const projectQ = useProject(org, project)
const review = useReview(org, project, number)
// The review's note (sc-8799): every review action on this page sends it, and it clears once one is made.
const note = useReviewNote()
const send = (v: { action: 'approve' | 'reject'; snapshot_ids?: string[]; only?: 'added' | 'changed' | 'matching' }) =>
review.mutate({ ...v, note: note.value }, { onSuccess: note.clear })
const onExpired = useExpiredRefetch(q.refetch)
const [order, setOrder] = useReviewOrder()

Expand Down Expand Up @@ -104,23 +109,25 @@ export function BuildPage() {
</div>
{canReviewBuild && (
<div className="build-actions">
<ReviewNoteButton note={note} />
<Button
variant="danger"
loading={review.isPending && review.variables?.action === 'reject' && !review.variables.snapshot_ids && !review.variables.only}
onClick={() => review.mutate({ action: 'reject' })}
onClick={() => send({ action: 'reject' })}
>
<XIcon size={15} weight="bold" /> Reject
</Button>
<Button
variant="approve"
loading={review.isPending && review.variables?.action === 'approve' && !review.variables.snapshot_ids && !review.variables.only}
onClick={() => review.mutate({ action: 'approve' })}
onClick={() => send({ action: 'approve' })}
>
<CheckIcon size={15} weight="bold" /> Approve all
</Button>
<Help>Approved snapshots become the baseline for later builds on {build.branch}.</Help>
</div>
)}
{canReviewBuild && <ReviewNoteField note={note} />}
</div>

<BuildMeta org={org} project={project} build={build} repo={repo} />
Expand Down Expand Up @@ -192,6 +199,7 @@ export function BuildPage() {
s={s}
onExpired={onExpired}
review={review}
send={send}
/>
))}
</ul>
Expand Down Expand Up @@ -221,7 +229,7 @@ export function BuildPage() {
size="sm"
variant="ghost"
loading={review.isPending && review.variables?.only === g.state}
onClick={() => review.mutate({ action: 'approve', only: g.state as 'changed' | 'added' })}
onClick={() => send({ action: 'approve', only: g.state as 'changed' | 'added' })}
>
<CheckIcon size={14} weight="bold" /> Approve all {g.state}
</Button>
Expand All @@ -231,7 +239,7 @@ export function BuildPage() {
size="sm"
variant="ghost"
loading={review.isPending && review.variables?.only === 'matching'}
onClick={() => review.mutate({ action: 'approve', only: 'matching' })}
onClick={() => send({ action: 'approve', only: 'matching' })}
title="Changes made only of changes merged pull requests approved"
>
<CheckIcon size={14} weight="bold" /> Approve all matching
Expand All @@ -248,6 +256,7 @@ export function BuildPage() {
s={s}
onExpired={onExpired}
review={review}
send={send}
/>
))}
</ul>
Expand Down Expand Up @@ -424,13 +433,15 @@ function SnapshotItem({
s,
onExpired,
review,
send,
}: {
org: string
project: string
build: BuildDetail
s: SnapshotRow
onExpired: () => void
review: ReturnType<typeof useReview>
send: (v: { action: 'approve' | 'reject'; snapshot_ids?: string[] }) => void
}) {
const KindIcon = kindIcon[s.kind] ?? FileTextIcon
const busy = review.isPending && review.variables?.snapshot_ids?.[0] === s.id
Expand Down Expand Up @@ -514,7 +525,7 @@ function SnapshotItem({
title="Approve this snapshot"
aria-label={`Approve ${s.name}`}
disabled={busy}
onClick={() => review.mutate({ action: 'approve', snapshot_ids: [s.id] })}
onClick={() => send({ action: 'approve', snapshot_ids: [s.id] })}
>
<CheckIcon size={16} weight="bold" />
</button>
Expand All @@ -525,7 +536,7 @@ function SnapshotItem({
title="Reject this snapshot"
aria-label={`Reject ${s.name}`}
disabled={busy}
onClick={() => review.mutate({ action: 'reject', snapshot_ids: [s.id] })}
onClick={() => send({ action: 'reject', snapshot_ids: [s.id] })}
>
<XIcon size={16} weight="bold" />
</button>
Expand Down
10 changes: 8 additions & 2 deletions server/frontend/src/pages/SnapshotPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { CommentButton, CommentHint, CommentsProvider, PageThreads, Pins } from
import { QueryState } from '../components/QueryState'
import { PresignedImg, useExpiredRefetch } from '../components/PresignedImg'
import { Button, Help, Kbd, Pill, ReviewPill, StatePill, type Tone } from '../components/ui'
import { ReviewNoteButton, ReviewNoteField, useReviewNote } from '../components/ReviewNote'
import { n, percent, plural } from '../lib/format'
import { usePersistentState } from '../lib/theme'
import { approvedElsewhereLabel, compareForReview, reviewable, useReviewOrder, type ReviewOrder } from './BuildPage'
Expand Down Expand Up @@ -155,12 +156,15 @@ export function SnapshotPage() {
el.scrollIntoView({ block: 'start', behavior: window.matchMedia('(prefers-reduced-motion: reduce)').matches ? 'auto' : 'smooth' })
}, [])

// The review's note (sc-8799): sent with approve or reject, then cleared.
const note = useReviewNote()
const doReview = useCallback(
(action: 'approve' | 'reject') => {
review.mutate(
{ action, snapshot_ids: [id] },
{ action, snapshot_ids: [id], note: note.value },
{
onSuccess: () => {
note.clear()
if (action === 'approve' && nextToReview) {
navigate({
to: '/$org/$project/builds/$number/snapshots/$id',
Expand All @@ -171,7 +175,7 @@ export function SnapshotPage() {
},
)
},
[review, id, nextToReview, navigate, org, project, number],
[review, id, nextToReview, navigate, org, project, number, note],
)

// Reset the page cursor when moving to another snapshot.
Expand Down Expand Up @@ -387,6 +391,7 @@ export function SnapshotPage() {
</button>
{canReview && (
<>
<ReviewNoteButton note={note} />
<Button
variant="danger"
size="sm"
Expand All @@ -410,6 +415,7 @@ export function SnapshotPage() {
</>
)}
</div>
{canReview && <ReviewNoteField note={note} />}
</div>

{help && <ShortcutHelp onClose={() => setHelp(false)} canReview={canReview} isText={isText} />}
Expand Down
32 changes: 32 additions & 0 deletions server/frontend/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1906,9 +1906,41 @@ textarea.input {
.page-head > .build-actions {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
gap: var(--space-2);
}

/* The review's optional note (sc-8799): opened by "Add note", a full-width row of its own at the end of the header (the
build page's head, the snapshot page's review bar), right-aligned, so nothing above it moves. */
/* `.page-head > .review-why`: `.page-head > div` (a grid) would otherwise win. */
.review-why,
.page-head > .review-why {
order: 10;
flex: 1 0 100%;
display: flex;
justify-content: flex-end;
min-width: 0;
}

.review-why-field {
position: relative;
width: min(28rem, 100%);
}

.review-why-field .input {
padding-right: calc(var(--space-3) + 28px);
}

/* The ×: hides the field (dropping its text) and brings "Add note" back. */
.review-why-close {
position: absolute;
top: 50%;
right: var(--space-1);
width: 26px;
height: 26px;
transform: translateY(-50%);
}

.build-meta {
display: flex;
flex-wrap: wrap;
Expand Down
2 changes: 1 addition & 1 deletion server/src/controllers/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ struct ReviewParams {
snapshot_ids: Option<Vec<Uuid>>,
/// `added` or `changed`: only the build's new, or only its changed, snapshots.
only: Option<String>,
/// Why, kept with the review.
/// Why: the review's note.
note: Option<String>,
}

Expand Down
2 changes: 1 addition & 1 deletion server/src/mcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ pub struct ReviewArgs {
/// With `reject`: why, as a comment thread on each rejected snapshot (Markdown), so the next person or agent sees
/// what's wrong. Approving a snapshot with an open thread is refused until the thread is resolved.
pub comment: Option<String>,
/// Why you approved or rejected, in a sentence: kept with the review and shown wherever it appears (the build's
/// Why you approved or rejected, in a sentence. It's shown wherever the review appears (the build's
/// reviews, the pull request comment). A note, not a thread: it never blocks anything.
pub note: Option<String>,
}
Expand Down
2 changes: 1 addition & 1 deletion skills/visualci-review/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ failing in the repository instead of sending them.

**Reviews**

- `review`: approve or reject a build's changes, some snapshots' changes (`snapshots`), or only its new or only its changed snapshots (`only: "added"` or `"changed"`). Add a `note` saying why ("The new header, as the issue asked"): it's kept with the review and shown in the build's reviews, `get_build` and the pull request comment. Every review says who made it and how: "Claude Code for Ada Lovelace" for an agent signed in as its person, "Ada Lovelace" in the web app, or "a project token (CI)", so an agent's approval never reads as the person's own. When two pull requests change the same screen and merge separately, the screen after both is one neither showed, so it shows as changed until someone reviews it. If the change is exactly another pull request's approved change (the same regions, from the same old pixels to the same new ones), `get_build` marks it `matches` ("matches PR #8's approved change"), and `only: "matching"` approves those in one call. On a pull request's build whose base is a default-branch build nobody has reviewed yet, the changes that are main's own unreviewed ones are marked `on_main_unreviewed`, and `get_build`'s `inherited` says how many and which build: review those on main's build, and the pull request's own changes here.
- `review`: approve or reject a build's changes, some snapshots' changes (`snapshots`), or only its new or only its changed snapshots (`only: "added"` or `"changed"`). Add a `note` saying why ("The new header, as the issue asked"): it shows in the build's reviews, `get_build` and the pull request comment. Every review says who made it and how: "Claude Code for Ada Lovelace" for an agent signed in as its person, "Ada Lovelace" in the web app, or "a project token (CI)", so an agent's approval never reads as the person's own. When two pull requests change the same screen and merge separately, the screen after both is one neither showed, so it shows as changed until someone reviews it. If the change is exactly another pull request's approved change (the same regions, from the same old pixels to the same new ones), `get_build` marks it `matches` ("matches PR #8's approved change"), and `only: "matching"` approves those in one call. On a pull request's build whose base is a default-branch build nobody has reviewed yet, the changes that are main's own unreviewed ones are marked `on_main_unreviewed`, and `get_build`'s `inherited` says how many and which build: review those on main's build, and the pull request's own changes here.
- `review_page`: accept one page as a variant, or ignore one exact change in later builds too.

**Running a comparison**
Expand Down
Loading