Repository navigation
feat: show original pull requests in guest conversations - #178312
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesShows a prepared conversation’s original pull request and lets authorized guests read its status and CI details. Example: A guest opens a prepared conversation associated with synthetic/visitor-demo pull request 42 before publishing anything.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it delivers a useful, maintainer-approved guest capability, and inspection found no actionable introduced defect. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway resolves conversation bindings, checks current session and GitHub authority, and supplies scoped PR snapshots to the existing Control UI store and renderer. flowchart LR
A[Guest conversation] --> B[Session admission]
B --> C[Prepared PR binding]
C --> D[Own PR inspection]
D --> E[Scoped GitHub metadata]
E --> F[Guarded snapshot delivery]
F --> G[Existing PR card]
Technical reviewBest possible solution: Land the prepared-binding display through the existing session reader, credential transport, subscription owner, and card renderer after its prerequisite is ready. Do we have a high-confidence way to reproduce the issue? The baseline discovery path omits the prepared binding, and supplied baseline/candidate screenshots demonstrate the missing and restored card; no new execution was performed. Is this the best way to solve the issue? The change uses the existing authoritative binding and read owners, separates remote observations from prepared files, and preserves publication permissions without creating a competing display path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 73601c86e785. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +415, Tests +765, Docs +10. Total +1190 across 31 files. Added test files: 1. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (4 earlier review cycles)
Reviewed October 20, 2026, 9:18 PM ET / October 21, 2026, 01:18 UTC (Revision 5). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
816f726 to
b5bc8c4
Compare
57ba636 to
acd29b3
Compare
b5bc8c4 to
f6a4786
Compare
acd29b3 to
8058947
Compare
f6a4786 to
087a07f
Compare
A conversation prepared from an existing pull request shows that PR's card and sidebar badge before any new publication. The session PR reader consumes the prepared binding, verifies it against the own-PR inspection, and reads status and checks with the selected credential; a session-only guest may read only their own prepared PR in their own conversation. Withdrawn or inaccessible associations clear the displayed facts.
|
8058947 to
3abd535
Compare
|
Landed: a conversation prepared from an existing pull request now shows that PR's card and sidebar badge before any new publication, and a guest with session-only access can see their own prepared PR in their own conversation. |
…8312) A conversation prepared from an existing pull request shows that PR's card and sidebar badge before any new publication. The session PR reader consumes the prepared binding, verifies it against the own-PR inspection, and reads status and checks with the selected credential; a session-only guest may read only their own prepared PR in their own conversation, and the sidebar badge of that conversation follows the same read. Withdrawn or inaccessible associations clear the displayed facts; quota exhaustion keeps the verified card with a warning.
What Problem This Solves
A conversation prepared from an existing GitHub pull request (#178233's
prepare_pr) carries an explicit binding to that original PR, but the conversation's PR card and the sidebar badge are discovered from the local checkout branch and from publication receipts. A prepared conversation therefore shows no card until a new publication happens, and a guest with session-only scopes (the Visitor role:operator.sessions.readandoperator.sessions.write) cannot use the broad PR reader at all, even for a PR they authored themselves.This change makes the bound original PR visible in the conversation before any publication: the card in the conversation details and the badge in the sidebar, read through a narrow own-PR path that a session-only guest may use for their own prepared conversation. It builds on the workspace binding from #178233 and the own-PR identity gate from #178055, both now on
main.User Impact
A guest who prepared their own PR sees its link, state, counts, and available checks in that conversation from the first load, and the sidebar row of that conversation carries the PR badge. The badge comes from the snapshot the guest's own conversation read delivered; other checkout rows keep showing no PR facts to a session-only reader, as before. Reloading keeps the card; a newer remote commit on the PR keeps identifying the same PR without implying that the newer files are already prepared locally. When the identity is revoked, the PR becomes inaccessible, or the binding no longer matches the PR (host, number, repository identities, head branch), the previously displayed facts are cleared, including the sidebar badge and the retained conversation summary. Ordinary transient GitHub failures keep the existing stale-with-warning behavior, and GitHub quota exhaustion never discards the verified card: when only the counts or checks request is rate limited, the card shows the verified state without them and carries the rate-limit warning. A failed own-PR authorization clears the card until it can be verified again.
The read requires current conversation access, the guest's verified linked GitHub author identity, and current access to the repository. No scope is widened: the two existing subscription and check-detail methods admit a session-only caller only for its own authorized conversation; generic GitHub previews and details, publication, PR actions, source refresh and merge remain governed by their existing owners and are unchanged here. Administrators and ordinary operators with
operator.readsee no behavior change. No configuration, schema or migration is involved.Why This Change Was Made
The canonical session PR reader (
control-ui-session-pr-read.tsand its metadata, request, subscription and delivery owners) now consumes the prepared binding directly and verifies its host, PR number, base and head repository identities, and head branch against the own-PR inspection result before showing anything. It reuses the existing GitHub identity inspection from #178055 through a captured reader (github-publication-inspect-reader.ts) so the same selected credential serves private metadata and check reads, and it keeps commit observations separate from the immutable PR identity so a legitimate remote head advance does not hide the card. The parse and finish helpers that both the branch reader and the bound reader need moved to the metadata owner instead of being duplicated.On the method side,
controlUi.sessionPullRequests.subscribeandcontrolUi.sessionPullRequests.checksjoin the session-read methods and the direct session target policy, and thecontrolUi.sessionPullRequests.changedevent is guarded by the session-read scope, so delivery reaches the session-only subscriber while every other method and projection keeps its admission. Event delivery retains the current identity and session authority through response and queued delivery, and the shared public cache stays separate from private, credentialed facts. AdiscardPreviousmarker on the snapshot tells the UI store, the chat pane summary and the sidebar indicators to drop withdrawn facts instead of treating an empty result as a transient miss.In the Control UI, the store issues the own-session read when broad read is absent, stops passive sidebar reads that would need
operator.read, re-reads when the read scope changes on reconnect, and clears snapshots on session deletion, sharing or profile-identity changes for session-only readers. The sidebar indicators project the shared store for any admitted reader, so the guest's own conversation read also drives that row's badge, while catalog summaries of other checkout rows stay hidden from session-only readers (the rule from #160978). The e2e scope test was re-expressed on top of the test-removal batches that landed onmainso it checks the new own-session read instead of asserting that no read happens.Evidence
Baseline
On the base (
mainwith #178233),resolveSessionMethodScopereturns no session scope forcontrolUi.sessionPullRequests.subscribeandcontrolUi.sessionPullRequests.checks([null, null]), so a session-only guest cannot subscribe to its own conversation's PR facts at all; with this change both resolve tooperator.sessions.read. The decisive boundary testsrc/gateway/control-ui-session-prs-own.test.tsexercises the registered subscribe and checks owners with a session-only requester: real admission, selected credential, subscription ownership, queued delivery, revocation, and, new on this head, a cold rate limit on the check-runs request that keeps the verified state-only card withrateLimited: trueand no discard marker.Remote checks on the exact head
Checked on head 8058947986c567840cc53d07e223e166c6ec5e1b (tree
96fb2c53, Blacksmith Testbox) while this PR was stacked on #178233. After #178233 landed, the same single commit was rebased ontomainwithout changes (identical patch pergit range-diff), and none of the files or modules it relies on changed in between:session-pull-requests,app-sidebar-session-pr-indicators(new own-session badge case, parked-permissions case),chat-pane-pull-requests,chat-pull-requestsui/src/e2e/chat-scope-read-gates.e2e.test.ts(own-session read on reconnect, unavailable withdrawal, publication options with the own read)Two earlier candidates on this base found defects that the independent review and the remote run surfaced and this head corrects: the sidebar badge was still hidden from a session-only guest for a worktree-backed row, and a cold rate limit on the checks request discarded the verified card. The corrections were covered by the new test cases above, and the first badge attempt was itself caught by the existing parked-permissions case (broad snapshots must not survive a narrowed scope), which now passes again because the sidebar rebinds its store when broad read changes.
Hosted CI runs on the pushed head. The previous head's only CI failure (
checks-ui-e2e 8/9) was the unchanged mobile fling test inchat-widget-scroll.e2e.test.ts, whichmainhas since repaired in #178578, #178645 and #178856.Visual evidence on this head
The same mocked-Gateway scenario ran on two production UI builds with session-only guest scopes (
operator.sessions.read,operator.sessions.write): the base build (#178233's final head 087a07f, without this change) and this exact head. On the base the conversation issues no PR subscription, and neither the Details panel nor the sidebar row shows a PR. On this head the conversation's own-session read (session keys only, no passive sidebar keys) delivers the original PR: the card appears under Pull requests and the conversation's sidebar row carries the badge, both survive a reload, and a remote head/status update moves the same card to passing checks. No publish request is made.Visual evidence
Exact-head recording: initial card, reload, remote update
after-recording.webm
Visual verification
8058947986c567840cc53d07e223e166c6ec5e1bEarlier evidence from this PR's previous heads
The earlier production implementation
b52c866812f3on the old base carried the same reader, subscription and delivery owners; its mocked production-build captures (guest scopes, no publication receipt: card count before 0, after exactly 1, retained after reload, CI-details request moving to the updated head, 0 publish/confirm requests) and the live integration evidence on build45f7aa4da479(original private PR shown before any publication, retained after one reload, one external commit updating the same card through its subscription, an authorized current-head CI read returning ready/zero checks, a second Guest reading the shared chat without a card and receivingUNAVAILABLEfor CI) were reviewed and published on those heads. The transport-stage proof57ba636b5e69(nine-case fixture: selected own-PR credential on held check-runs pages, ownership replaced mid-read delivering no private event) is part of the own-PR test file on this head. The incognito reconciliation stands as before: the session entry filter rejects incognito entries before the own-reader identity is built, admin scope satisfies the general read and skips the session-only wrapper, and identityless or Gateway-owner browser callers have no operator profile.