feat(labctl): include the PR discussion thread in pr view #192
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab!192
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "afk/191"
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?
An agent catching up on a PR conversation (verdict findings, human replies) was blind:
labctl pr viewrendered everything but the comment thread, while the write path (pr comment) and the plumbing (tracker.PullComments, already read by the autoland poller) existed. This folds the thread into the existing read — no new verb, no new endpoint — per the grilled design on the issue.What shipped
/agent/v1/prs/{n}(prDetailResponse) gainscomments: author/body/created_at, the issue-view comment JSON shape, oldest first, content verbatim and unfiltered (autoland verdict markers included — a reject's body IS the findings a fix agent needs). Contract mirrorsreviews: always marshals[], never null; a failedPullCommentsread fails the whole response throughwriteTrackerError(no partial detail).PullCommentswrapsErrUnsupportedunconditionally (no CR comment thread yet, ADR-0048);handlePRGettreats exactly that sentinel as an empty thread instead of failing, so builtinpr viewkeeps answering 200 withcomments: []— the same shape a commentless forge PR yields — rather than 409ing. Any other error still fails whole. This is the one point where the implementation refines the issue's "whole response fails" rule; the alternative regressed every builtinpr view, and the carve-out stops firing on its own once the builtin tracker grows CR comments. The tracker seam is untouched, so the autoland poller's fail-closed read is unchanged.PRDetailgainsComments []Comment(the existing issue-comment client type);printPRrenders each comment after the reviews block, byte-for-byteprintIssue's--- comment by <author> (<time>)convention, slice order (server returns oldest first). Usage line updated. Zero comments leaves output byte-identical to before.contextfile.md.tmpl) now documentslabctl pr view <n>including reviews and comments; all three claude goldens updated byte-exact.PullCommentsreturns); inline file/line review comments stay out,pr liststays PullRef-cheap.Tests
TestPRViewComments_forge(new): two comments through in order withstore.FormatTimetimestamps; a verdict-marker comment passes verbatim; aPullCommentsfailure → 502 with the backend's words, no partial detail.TestPRViewAndList_forge/TestPRViewAndList_builtin(extended):commentspresent and[]non-nil on both bindings — the builtin assertion is the regression test for the carve-out.TestPRViewWithComments(new, labctl): full CLI drive against a JSON server — reviews block first, then both comment blocks in order, verbatim bodies.TestPRViewBuiltinRoundTrip(untouched, still green) covers the real builtin server → labctl path end-to-end.Verification
CGO_ENABLED=0 go build ./...,go vet ./..., gofmt clean;go test ./...green exceptinternal/tmuxx's integration tests, which fail identically on pristine main in this sandbox (tmux panes exit immediately — environment-only, package untouched). Also drove the freshly builtlabctl pr viewagainst the live lab server: renders cleanly with the field absent (wire compat both directions).Closes #191
🤖 Generated with Claude Code
GET /agent/v1/prs/{n} gains a comments array — the PR's discussion thread as tracker.PullComments returns it, oldest first, verbatim (autoland verdict-marker comments included: a reject's body IS the findings a fix agent needs). Same contract as reviews: always [], never null, and a failed read fails the whole response (no partial detail) — except the built-in binding's ErrUnsupported, which renders as an empty thread rather than 409ing every builtin pr view. labctl pr view renders the thread after the reviews block, byte-for-byte printIssue's "--- comment by <author> (<time>)" convention, restoring issue/PR read symmetry. The generated-context template now documents pr view (goldens updated), so agents learn the thread is one call away. Closes #191 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>[autoland] verdict: pass