Skip to content

feat: show original pull requests in guest conversations - #178312

Merged
shakkernerd merged 1 commit into
mainfrom
imported-pr-card
Oct 21, 2026
Merged

shakkernerd merged 1 commit into
mainfrom
imported-pr-card

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

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.read and operator.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.read see 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.ts and 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.subscribe and controlUi.sessionPullRequests.checks join the session-read methods and the direct session target policy, and the controlUi.sessionPullRequests.changed event 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. A discardPrevious marker 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 on main so it checks the new own-session read instead of asserting that no read happens.

Evidence

Baseline

On the base (main with #178233), resolveSessionMethodScope returns no session scope for controlUi.sessionPullRequests.subscribe and controlUi.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 to operator.sessions.read. The decisive boundary test src/gateway/control-ui-session-prs-own.test.ts exercises 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 with rateLimited: true and 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 onto main without changes (identical patch per git range-diff), and none of the files or modules it relies on changed in between:

Stage Result
Formatting and lint of the changed files, Control UI i18n catalog passed, no warnings on the changed files
Type graphs (core test types, core, ui, extensions, extensions-test, scripts, test-root) all passed
25 Node test files: the own-PR boundary test, publication, subscription lifetimes, access, check details, host, retention, branch, mentions, staleness, task PRs, control-ui and sessions-github server methods, read authority, kernel startup, contract, repositories, plugin account/session-facts/user-profile, visitor revocation, inspect, method scopes 25 passed (239 s batch)
UI unit rows: session-pull-requests, app-sidebar-session-pr-indicators (new own-session badge case, parked-permissions case), chat-pane-pull-requests, chat-pull-requests all passed
Mocked browser scenario ui/src/e2e/chat-scope-read-gates.e2e.test.ts (own-session read on reconnect, unavailable withdrawal, publication options with the own read) passed

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 in chat-widget-scroll.e2e.test.ts, which main has 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

View Before After
Before any new publication Base build with guest scopes: no original PR card, no subscribe request Feature head with guest scopes: the original PR card from the own-session read
After one reload Base build after reload: still no card Feature head after reload: the same original PR card
After a remote head and status update Base build: no card to update Feature head: the same PR with the updated counts and passing checks

Exact-head recording: initial card, reload, remote update

after-recording.webm

Visual verification

  • Baseline: origin/prepare-existing-pr@087a07f56b43968d46e457ce0b351f3f7a76f44f
  • Exact head: 8058947986c567840cc53d07e223e166c6ec5e1b
  • Scenario: Open the guest's own prepared conversation with session-only scopes (operator.sessions.read/write), expand the Details pull-request section, reload the conversation once, then receive a remote status update (new head, +2, checks passing). The mocked Gateway delivers the original PR snapshot only through the own-session subscribe request; the base build (feat: prepare existing PR source in a managed workspace #178233's final head without this change) never issues that request.
  • Runtime/build: Source-built production Control UI bundle served by the repository's bundled UI e2e lane (Blacksmith Testbox tbx_01m5f58yq2cb24ysyyx2w6qvt4, system Chromium, 1280x800 light); head tree 96fb2c53 plus the task-only scenario file
  • Own-session subscribe request: before: 0 requests; after: sessionKeys [own session], no passiveSessionKeys
  • Conversation card count: before 0 -> after exactly 1, retained after reload
  • Publish requests: 0
  • Sidebar badge: before 0 -> after exactly 1 on the guest's own conversation row
  • Same scenario file, viewport, theme and fixture on the base build and the exact head
  • Focused browser scenario passed on both builds
  • Card absence on the base is enforced by the scenario (no subscribe request within 3 s)
  • Recording cues the reload and the fixture-delivered remote update
  • Base run asserted 0 subscribe requests, 0 cards, 0 badges; head run asserted 1 card, 1 badge, 0 publish requests

Earlier evidence from this PR's previous heads

The earlier production implementation b52c866812f3 on 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 build 45f7aa4da479 (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 receiving UNAVAILABLE for CI) were reviewed and published on those heads. The transport-stage proof 57ba636b5e69 (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.

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL labels Oct 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 20, 2026
@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Shows 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.

  • Before: The conversation has no original PR card.
  • After: One PR card shows the original link, status, checks, and diff counts.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Useful, scoped implementation with inspected user-visible evidence and distinct authority/lifecycle coverage; no introduced defect found.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected production-build before/after screenshots show the original card appearing; qualified live integration evidence shows reload retention, remote advancement, authorized private reading, and another guest’s denial. Registered production-owner scenarios additionally cover visibility retirement during paginated transport and original-guard retention through queued delivery. Video and gist inspection limitations are recorded separately; no live mid-request revocation is claimed.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: A guest continuing an existing PR cannot see its original link, status, or checks before another publication.
Reason: Maintainer authorship establishes direction, and the narrow capability fills a visible gap while reusing existing owners and retaining current write boundaries.

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
Reviewed head: 57ba636b5e693d606d4d7f772d2e036e25175f8c

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Session PR discovery and rendering keeps the original intent (2d54be3: Display PRs associated with the session checkout branch beside the conversation.)
  • Reader identity, source lifetime, and final delivery keeps the original intent (6b0b111: Prevent late PR results and CI details from crossing replaced workspaces or retired reader grants.)
  • Guest scope admission and UI retirement changes intended behavior with a stated reason (bf2883a: Stop broad PR reads without general read scope and retire cached facts when permissions change.)
  • Shared metadata and task publication projections keeps the original intent (ecb279c: Project recorded task publications through bounded, viewer-scoped subscriptions while keeping branch publication facts separate.)
  • Own-PR identity inspection keeps the original intent (ac2ea20: Verify linked authorship and repository access without adopting, publishing, or preparing the PR.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned scope and current state: The introduced comparison is 2d12aaa..57ba636. GitHub confirms the reviewed head, prepare-existing-pr target, and mergeable=true. The author is a MEMBER, so the keep-open guard applies. (57ba636b5e69)
  • Narrow guest admission: Session-only readers require the prepared binding, conversation creator identity, current linked GitHub identity, and existing session visibility; generic GitHub preview methods remain outside the narrow admission. (src/gateway/control-ui-session-pr-read.ts:331, 57ba636b5e69)
  • Authority through transport and delivery: Selected credentials and current reader guards reach metadata and CI requests. Registered-handler tests hold page one, retire session visibility through the real owner, and verify no page two or private delivery; unchanged-authority controls deliver all 101 checks. Queued snapshots retain their original authority guard. (src/gateway/control-ui-session-prs-own.test.ts:392, 57ba636b5e69)
  • Prior incognito concern reconciled: The earlier incognito identity-comparison concern is unreachable for supported session-only guests: the profile session filter rejects incognito rows before the own-reader wrapper, while administrator scope satisfies general read and skips that wrapper. (src/gateway/session-sharing-read.ts:421, 57ba636b5e69)
  • Inspected visual evidence: Directly inspected the linked baseline and candidate screenshots: the same production UI scenario changes from no card to one original PR card. Live integration screenshots show the same PR advancing to two additions and another guest retaining readable chat without the private card. The body separately records successful private CI reading and denied UNAVAILABLE responses. (57ba636b5e69)
  • Media inspection limitations: The prepared manifest contains prerequisite preparation images, which were inspected but do not prove this feature. Current PR images were fetched and inspected in memory because scratch downloads failed with curl error 23. Video inspection was unavailable: ffmpeg is absent and browser retrieval returned Cache miss; linked gist retrieval was proxy-blocked. These review-side limits create no contributor action. (57ba636b5e69)

Likely related people:

  • Shakker: Raw commit 6b0b111 adds src/gateway/control-ui-session-pr-read.ts:89 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6b0b11199466; files: src/gateway/control-ui-session-pr-read.ts)

PR surface

Source +415, Tests +765, Docs +10. Total +1190 across 31 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 19 631 216 +415
Tests 11 784 19 +765
Docs 1 10 0 +10
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 31 1425 235 +1190

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Adds useful status visibility for guests continuing an existing PR, with a limited affected surface and no demonstrated urgent regression.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (4 earlier review cycles)
  • reviewed 2026-10-20T09:54:28.993Z sha 772f3a0 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-20T23:37:16.052Z sha b52c866 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-21T00:00:26.538Z sha 57ba636 :: needs changes before merge. :: [P2] Compare matching identity representations for incognito guests
  • reviewed 2026-10-21T00:13:30.653Z sha 57ba636 :: needs maintainer review before merge. :: none

Reviewed October 20, 2026, 9:18 PM ET / October 21, 2026, 01:18 UTC (Revision 5).

@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Oct 20, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 21, 2026
@shakkernerd
shakkernerd force-pushed the prepare-existing-pr branch 2 times, most recently from 816f726 to b5bc8c4 Compare October 21, 2026 11:16
@openclaw-barnacle openclaw-barnacle Bot added the agents Agent runtime and tooling label Oct 21, 2026
Base automatically changed from prepare-existing-pr to main October 21, 2026 12:55
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.
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 3abd535199f6d1e3b1e377d3df7dc41e466e9b1d
  • Maintainer: @shakkernerd
  • Repository role: maintain

These security sensitive changes were made:

  • src/gateway/session-method-policy.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.
  • src/shared/session-method-scopes-base.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot removed the agents Agent runtime and tooling label Oct 21, 2026
@shakkernerd shakkernerd self-assigned this Oct 21, 2026
@shakkernerd
shakkernerd merged commit 81e6c65 into main Oct 21, 2026
146 of 148 checks passed
@shakkernerd
shakkernerd deleted the imported-pr-card branch October 21, 2026 13:07
@shakkernerd

Copy link
Copy Markdown
Contributor Author

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.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 22, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant