feat: submit inline diff reviews to coding agents #574
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
follow-up
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#574
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Let a user review code produced in an ocman session from either fullscreen diff viewer—Working Tree or Session Changes—attach feedback to changed lines, add an optional overall note, and submit the complete review to the displayed coding-agent session as one structured message.
This is user-to-agent feedback, not forge PR review. The normal session transcript remains the conversation and history after submission.
User experience
Require at least one inline comment or a non-empty overall note before enabling submission.
Review scope and anchors
Support only the two existing fullscreen diff sources:
working-tree: the current netgit diff HEAD, including staged, unstaged, and displayable untracked files.session-changes: the historical sequence of edits captured from session tool activity, including repeated patch sections for the same file.An inline comment attaches to one changed line on either the old/deletion side or new/addition side. Line ranges, unchanged-line comments, threads, replies, and multiple comments on one anchor are out of scope.
Each draft anchor must retain enough immutable context to remain meaningful even after a refresh:
Use a stable patch-section fingerprint plus the occurrence metadata already available while splitting/rendering patches. Do not identify a Session Changes comment by path and line alone: one session can edit the same numbered line several times.
Draft persistence
Persist drafts in browser
localStorage, following the existing composer-draft/bookmark patterns. Key drafts by compound session identity and source:platform + sessionId + (working-tree | session-changes)Keep Working Tree and Session Changes reviews separate. Drafts must survive closing the modal, switching files, and reloading the page. No
state.dbmigration or server-side draft API is required.Version the serialized local schema so malformed or future-incompatible values can be discarded safely. Never let one local or remote session read another session's draft.
Refresh and stale comments
Both diff sources refresh while the modal can remain open. Reconcile each draft anchor against the newly rendered patch section using its fingerprint and anchor context.
Do not silently retarget a comment to a nearby line.
If an API response reports truncation, preserve the existing truncation UI and do not imply that the review covers unseen content.
Agent message
Do not introduce a new review endpoint or platform operation. Thread a review-submit callback from
SessionDetailthroughRightPanelinto the fullscreen viewer and reuse the existing session send path. This preserves:Do not call
api.sendMessagedirectly from the modal.Serialize the review deterministically as Markdown, for example:
The exact serializer should:
Working TreeorSession Changes);Plain Markdown is the structured transport for this version. A dedicated backend DTO is deferred until reviews need server-side querying, sharing, or lifecycle state.
Implementation constraints
FullscreenDiffFile.body: ReactNodemodel only as far as needed to expose raw patch metadata and annotation callbacks to the shared fullscreen viewer.@pierre/diffsannotation/gutter capabilities available in the installed version where practical; add no diff or review dependency.splitPatchSectionsrather than flattening historical occurrences.session.platformthrough Session Changes requests/review identity. Bare session IDs can collide across machines.Likely touch points:
frontend/src/components/DiffFullscreenModal.tsxfrontend/src/components/RawDiffView.tsxfrontend/src/components/DiffView.tsxfrontend/src/components/diffOptions.tsfrontend/src/components/SessionChangesSidebar.tsxfrontend/src/components/WorkingTreeChangesSidebar.tsxfrontend/src/components/RightPanel.tsxfrontend/src/pages/session-detail/SessionDetail.tsxfrontend/src/pages/session-detail/useSessionActions.tsfrontend/src/lib/patchSections.tsfrontend/src/lib/Non-goals
Acceptance criteria
Verification
Add focused frontend tests covering at least:
Run:
Confirm frontend coverage does not fall under the repository coverage ratchet.