Skip to content

Commit 662abec

Browse files
authored
feat(gateway): push session PR indicators to subscribed clients (#115643)
* feat(gateway): push session PR indicators to subscribed clients * test(gateway): fix PR indicator drift * chore(protocol): allowlist PR-indicator event for native apps (Control UI surface) * test: align PR indicator lifecycle coverage * fix(ui): scope session PR store listeners to active watchers
1 parent b6f70ea commit 662abec

44 files changed

Lines changed: 2315 additions & 1191 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/android/app/src/main/java/ai/openclaw/app/gateway/GatewayProtocol.kt‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ enum class GatewayMethod(
457457
PluginsSetEnabled("plugins.setEnabled"),
458458
PluginsUninstall("plugins.uninstall"),
459459
PluginsRefresh("plugins.refresh"),
460-
ControlUiSessionPullRequests("controlUi.sessionPullRequests"),
460+
ControlUiSessionPullRequestsSubscribe("controlUi.sessionPullRequests.subscribe"),
461461
GatewaySuspendPrepare("gateway.suspend.prepare"),
462462
GatewaySuspendStatus("gateway.suspend.status"),
463463
GatewaySuspendResume("gateway.suspend.resume"),
@@ -521,6 +521,7 @@ enum class GatewayEvent(
521521
SessionTyping("session.typing"),
522522
SessionTool("session.tool"),
523523
SessionsChanged("sessions.changed"),
524+
ControlUiSessionPullRequestsChanged("controlUi.sessionPullRequests.changed"),
524525
Presence("presence"),
525526
Tick("tick"),
526527
TalkMode("talk.mode"),

‎docs/.generated/plugin-sdk-api-baseline.sha256‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ e5e67ddf3cab38fcbf9220bc3160715897e2709d9a9ff6ff36f1ecc9453c2367 module/agent-c
66
74daa746deb548379d3f0d6eac3c4d082df1034c4360cc03bf51fee0f10a2e4d module/agent-harness
77
9285d1fee755e391a85f5ba892144684ee5b2c09d42410781324b4ddf9b36852 module/agent-harness-runtime
88
5168648cd946abad8a92822889f13ceacc87ed502314a66190d0b1eb8ebe76ea module/agent-media-payload
9-
2dcb4d62d90e5d71594f6b843c97534509a154784e378fb1c75bd86b5122b710 module/agent-runtime
9+
8a8b011fc9128301bfea6d7cd16023441fd4343696ef8cf63084dcc1f4fa5d4b module/agent-runtime
1010
56b6d5fb6af3d95af1200065aca2e7d4f59e5fa59740505fe6ff433077ef6646 module/allow-from
1111
55cea5390d68839ca7768b4a0cc570b17b65fa0fa3bc4d76130ef0f16cb79ede module/allowlist-config-edit
1212
7ddd81bd5f55de9adf64bf4d92d012f24b37b6da0a72805a3a220d8feff24ca3 module/approval-auth-runtime

‎docs/web/control-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ The macOS app keeps its native link-browser sidebar for links clicked in the das
447447
- The session header shows a small facepile beside the workspace chip when other people are viewing the same session; it lists up to four viewer avatars with an overflow count and disappears when you are alone.
448448
- Consecutive duplicate text-only messages render as one bubble with a count badge. Messages that carry images, attachments, tool output, or canvas previews are left uncollapsed.
449449
- User-message bubbles carry transcript actions: a hover rewind button (confirm popover with a "Don't ask again" option) plus right-click **Rewind to here** and **Fork from here**. Rewind repoints the session to the state just before that message and returns its text to the composer for edit and resend (`sessions.rewind`, `operator.admin`); fork creates a new session from the active-path prefix before the message, opens it, and seeds its composer with the same text (`sessions.fork`, `operator.write`). Both actions disable with an explanatory tooltip while the agent is working, apply only to persisted user messages, and are rejected for sessions whose conversation is owned by an external agent harness. Rewind moves chat context only — files and other tool side effects are not reverted — and the pre-rewind transcript remains preserved in the append-only session store. When that store contains multiple transcript branches, the chat title bar shows a branch menu with each branch's latest message, message count, and recency; selecting an inactive branch switches the current session back to that preserved path (`sessions.branches.list`, `operator.read`; `sessions.branches.switch`, `operator.admin`). Branch switching is also unavailable while the agent is working, and selecting the already-active branch is a typed no-op error at the RPC boundary. The separate hide action on user bubbles hides a message in the current browser only; the message stays in the transcript and the agent still sees it.
450-
- When a session's checkout sits on a non-default branch of a GitHub repository, the chat view pins pull request chips above the composer: PR number, repo, branch, diff counts, a CI pill, and draft/merged/closed state, each linking to the PR. The row shows at most two chips — live (open/draft) PRs first — and a "Show more" button reveals collapsed merged/closed history. The CI pill opens a small CI monitoring popover with passed/failed/running/skipped check counts and a link to the PR's checks page. Detection runs server-side through `controlUi.sessionPullRequests`, which reuses the Gateway's `GH_TOKEN`/`GITHUB_TOKEN` when set. When the GitHub API rate limit is hit, chips keep the last known status and show a warning that the status may be out of date; dismissing a chip hides it for that session in the current browser profile. Before any PR exists, the row shows the branch itself — repo, branch name, and the +/− size of the diff against the default-branch merge base (committed and uncommitted work). Once the pushed branch has commits to compare, the row adds a Create PR button that opens GitHub's new-pull-request page; before that, a session with changed files (committed, uncommitted, or untracked) still gets the row without the button. The row hides itself while an open or draft PR exists; once the branch's PR is merged and the pushed tip still matches the merged head, the row disappears too (returning without the Create PR button only when new local work appears, and with it once new commits are pushed past the merged head). The branch row comes from local git only, so it stays available while GitHub is rate limited and carries the same stale-status warning, since "no PR found" cannot be trusted until the limit resets.
450+
- When a session's checkout sits on a non-default branch of a GitHub repository, the chat view pins pull request chips above the composer: PR number, repo, branch, diff counts, a CI pill, and draft/merged/closed state, each linking to the PR. The row shows at most two chips — live (open/draft) PRs first — and a "Show more" button reveals collapsed merged/closed history. The CI pill opens a small CI monitoring popover with passed/failed/running/skipped check counts and a link to the PR's checks page. The Gateway polls only sessions visible in a connected Control UI and pushes changed snapshots through `controlUi.sessionPullRequests.changed`; it reuses `GH_TOKEN`/`GITHUB_TOKEN` when set. When the GitHub API rate limit is hit, chips keep the last known status and show a warning that the status may be out of date; dismissing a chip hides it for that session in the current browser profile. Before any PR exists, the row shows the branch itself — repo, branch name, and the +/− size of the diff against the default-branch merge base (committed and uncommitted work). Once the pushed branch has commits to compare, the row adds a Create PR button that opens GitHub's new-pull-request page; before that, a session with changed files (committed, uncommitted, or untracked) still gets the row without the button. The row hides itself while an open or draft PR exists; once the branch's PR is merged and the pushed tip still matches the merged head, the row disappears too (returning without the Create PR button only when new local work appears, and with it once new commits are pushed past the merged head). The branch row comes from local git only, so it stays available while GitHub is rate limited and carries the same stale-status warning, since "no PR found" cannot be trusted until the limit resets.
451451
- The session diff panel shows what a session's checkout actually changed: the branch button in the workspace rail or chat title bar opens the detail panel with a per-file diff of branch, uncommitted, and untracked work against the checkout's default-branch merge base — status dot, rename arrow, per-file +/− counts, collapsible files, and "N unmodified lines" markers between hunks. Diffs are computed server-side through the `sessions.diff` Gateway method (`operator.read` scope); binary and oversized files degrade to stats-only entries, and the button only appears when the connected Gateway advertises `sessions.diff`.
452452
- Every Chat pane has a title bar. Click the session title to rename it; the workspace chip copies the checkout path or branch and can reveal local Gateway workspaces in the host file manager. Remote and exec-node sessions keep copy actions but hide reveal.
453453
- The thread workspace rail in each Chat pane lists thread files, project files, and artifacts. It docks to the pane's right edge by default; drag its header (or use the dock button) to move it to the bottom, and the choice is stored in the current browser profile. A collapsed rail takes no space at all: reopen it with ⇧⌘B or the files toggle in the title bar, which carries a changed-file count badge. The separate file, tool, and Canvas detail panel is unaffected.
Lines changed: 39 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,65 @@
11
{
22
"$comment": "Gateway events each mobile client intentionally does not handle yet, with a one-line reason. Consumed by scripts/check-protocol-event-coverage.mjs (pnpm check:protocol-coverage). Adding a gateway event without a client handler requires either handling it or adding an entry here; the check also fails when an entry goes stale (event removed or now handled).",
33
"ios": {
4-
"session.operation": "Chat UI derives run state from chat/agent events; no session.operation consumer yet.",
5-
"session.tool": "Session tool stream is not rendered by the iOS chat surface yet.",
6-
"task.suggestion": "Task suggestion cards are a Control UI-only surface; iOS does not render them.",
7-
"ui.command": "Web Control UI-only layout commands; iOS does not consume them.",
8-
"presence": "Presence roster is a control-UI (web/desktop) surface; iOS does not render it.",
9-
"shutdown": "iOS relies on socket close plus reconnect/backoff instead of the shutdown notice.",
10-
"heartbeat": "iOS liveness uses tick and WebSocket-level ping; heartbeat is unused.",
4+
"controlUi.sessionPullRequests.changed": "Sidebar PR indicators are a Control UI surface; native apps do not render session PR chips.",
115
"cron": "Cron run activity is not surfaced in the iOS app.",
12-
"task": "Background task activity is not surfaced in the iOS app.",
6+
"device.pair.requested": "Device pairing flows poll via device.pair.* methods on iOS.",
7+
"device.pair.resolved": "Device pairing flows poll via device.pair.* methods on iOS.",
8+
"heartbeat": "iOS liveness uses tick and WebSocket-level ping; heartbeat is unused.",
139
"node.pair.requested": "Node pairing state is fetched on demand; no push consumer on iOS yet.",
1410
"node.pair.resolved": "Node pairing state is fetched on demand; no push consumer on iOS yet.",
1511
"node.presence": "Node activity is reported by macOS nodes and consumed by gateway routing; iOS has no presence reporter yet.",
16-
"device.pair.requested": "Device pairing flows poll via device.pair.* methods on iOS.",
17-
"device.pair.resolved": "Device pairing flows poll via device.pair.* methods on iOS.",
18-
"skills.changed": "Skills settings is a macOS operator surface; iOS does not expose skill management yet.",
19-
"voicewake.routing.changed": "iOS only consumes voicewake.changed trigger updates; routing changes are not surfaced.",
20-
"plugin.approval.requested": "Plugin approval prompts are not implemented on iOS.",
21-
"plugin.approval.resolved": "Plugin approval prompts are not implemented on iOS.",
2212
"openclaw.approval.requested": "OpenClaw system-agent config approvals are a web/desktop operator surface; iOS has no operator-approval prompt.",
2313
"openclaw.approval.resolved": "OpenClaw system-agent config approvals are a web/desktop operator surface; iOS has no operator-approval prompt.",
24-
"terminal.data": "Embedded terminal is a web/desktop surface; iOS has no terminal client.",
25-
"terminal.exit": "Embedded terminal is a web/desktop surface; iOS has no terminal client.",
26-
"update.available": "Gateway self-update notices do not apply to iOS; app updates ship via the App Store.",
14+
"plugin.approval.requested": "Plugin approval prompts are not implemented on iOS.",
15+
"plugin.approval.resolved": "Plugin approval prompts are not implemented on iOS.",
16+
"presence": "Presence roster is a control-UI (web/desktop) surface; iOS does not render it.",
2717
"session.approval": "Native approval review uses exec.approval push/nudge delivery; the session-scoped approval stream is a Control UI chat surface.",
18+
"session.operation": "Chat UI derives run state from chat/agent events; no session.operation consumer yet.",
2819
"session.sharing": "Session visibility/membership management is a Control UI operator surface; iOS reads visibility/sharingRole from session rows and has no sharing editor.",
2920
"session.suggestion": "The suggestion queue is a Control UI collaboration surface; iOS does not render or resolve session suggestions.",
30-
"session.typing": "Collaborative typing state is a Control UI-only ephemeral indicator; iOS does not render it."
21+
"session.tool": "Session tool stream is not rendered by the iOS chat surface yet.",
22+
"session.typing": "Collaborative typing state is a Control UI-only ephemeral indicator; iOS does not render it.",
23+
"shutdown": "iOS relies on socket close plus reconnect/backoff instead of the shutdown notice.",
24+
"skills.changed": "Skills settings is a macOS operator surface; iOS does not expose skill management yet.",
25+
"task": "Background task activity is not surfaced in the iOS app.",
26+
"task.suggestion": "Task suggestion cards are a Control UI-only surface; iOS does not render them.",
27+
"terminal.data": "Embedded terminal is a web/desktop surface; iOS has no terminal client.",
28+
"terminal.exit": "Embedded terminal is a web/desktop surface; iOS has no terminal client.",
29+
"ui.command": "Web Control UI-only layout commands; iOS does not consume them.",
30+
"update.available": "Gateway self-update notices do not apply to iOS; app updates ship via the App Store.",
31+
"voicewake.routing.changed": "iOS only consumes voicewake.changed trigger updates; routing changes are not surfaced."
3132
},
3233
"android": {
33-
"session.operation": "Chat UI derives run state from chat/agent events; no session.operation consumer yet.",
34-
"session.tool": "Session tool stream is not rendered by the Android chat surface yet.",
35-
"task.suggestion": "Task suggestion cards are a Control UI-only surface; Android does not render them.",
36-
"ui.command": "Web Control UI-only layout commands; Android does not consume them.",
37-
"presence": "Presence roster is a control-UI (web/desktop) surface; Android does not render it.",
38-
"talk.mode": "Android toggles talk mode locally; gateway talk.mode sync is not consumed.",
39-
"shutdown": "Android relies on socket close plus reconnect/backoff instead of the shutdown notice.",
40-
"heartbeat": "Android liveness uses tick and WebSocket-level ping; heartbeat is unused.",
34+
"controlUi.sessionPullRequests.changed": "Sidebar PR indicators are a Control UI surface; native apps do not render session PR chips.",
4135
"cron": "Cron run activity is not surfaced in the Android app.",
42-
"task": "Background task activity is not surfaced in the Android app.",
36+
"device.pair.requested": "Device pairing flows poll via device.pair.* methods on Android.",
37+
"device.pair.resolved": "Device pairing flows poll via device.pair.* methods on Android.",
38+
"heartbeat": "Android liveness uses tick and WebSocket-level ping; heartbeat is unused.",
39+
"node.invoke.cancel": "Cancel targets streaming agent.cli.claude.run.v1 invokes; app nodes never advertise agent runs, so no cancel can address them.",
40+
"node.invoke.input": "Carries terminal keystrokes/resize to a node PTY relay invoke; the relay runs on gateway/CLI node hosts and app nodes never host it, so Android has no consumer.",
4341
"node.pair.requested": "Android's bounded operator session lacks operator.pairing; onboarding refreshes node approval with explicit node.list requests.",
4442
"node.pair.resolved": "Android's bounded operator session lacks operator.pairing; onboarding refreshes node approval with explicit node.list requests.",
4543
"node.presence": "Node activity is reported by macOS nodes and consumed by gateway routing; Android has no presence reporter yet.",
46-
"device.pair.requested": "Device pairing flows poll via device.pair.* methods on Android.",
47-
"device.pair.resolved": "Device pairing flows poll via device.pair.* methods on Android.",
48-
"skills.changed": "Skills settings is a macOS operator surface; Android does not expose skill management yet.",
49-
"voicewake.routing.changed": "Android reads voicewake state on demand via voicewake.get; no push consumer yet.",
50-
"plugin.approval.requested": "Plugin approval prompts are not implemented on Android.",
51-
"plugin.approval.resolved": "Plugin approval prompts are not implemented on Android.",
5244
"openclaw.approval.requested": "OpenClaw system-agent config approvals are a web/desktop operator surface; Android has no operator-approval prompt.",
5345
"openclaw.approval.resolved": "OpenClaw system-agent config approvals are a web/desktop operator surface; Android has no operator-approval prompt.",
54-
"terminal.data": "Embedded terminal is a web/desktop surface; Android has no terminal client.",
55-
"terminal.exit": "Embedded terminal is a web/desktop surface; Android has no terminal client.",
46+
"plugin.approval.requested": "Plugin approval prompts are not implemented on Android.",
47+
"plugin.approval.resolved": "Plugin approval prompts are not implemented on Android.",
48+
"presence": "Presence roster is a control-UI (web/desktop) surface; Android does not render it.",
5649
"session.approval": "Native approval review uses exec.approval push/nudge delivery; the session-scoped approval stream is a Control UI chat surface.",
50+
"session.operation": "Chat UI derives run state from chat/agent events; no session.operation consumer yet.",
5751
"session.sharing": "Session visibility/membership management is a Control UI operator surface; Android reads visibility/sharingRole from session rows and has no sharing editor.",
5852
"session.suggestion": "The suggestion queue is a Control UI collaboration surface; Android does not render or resolve session suggestions.",
53+
"session.tool": "Session tool stream is not rendered by the Android chat surface yet.",
5954
"session.typing": "Collaborative typing state is a Control UI-only ephemeral indicator; Android does not render it.",
60-
"node.invoke.cancel": "Cancel targets streaming agent.cli.claude.run.v1 invokes; app nodes never advertise agent runs, so no cancel can address them.",
61-
"node.invoke.input": "Carries terminal keystrokes/resize to a node PTY relay invoke; the relay runs on gateway/CLI node hosts and app nodes never host it, so Android has no consumer."
55+
"shutdown": "Android relies on socket close plus reconnect/backoff instead of the shutdown notice.",
56+
"skills.changed": "Skills settings is a macOS operator surface; Android does not expose skill management yet.",
57+
"talk.mode": "Android toggles talk mode locally; gateway talk.mode sync is not consumed.",
58+
"task": "Background task activity is not surfaced in the Android app.",
59+
"task.suggestion": "Task suggestion cards are a Control UI-only surface; Android does not render them.",
60+
"terminal.data": "Embedded terminal is a web/desktop surface; Android has no terminal client.",
61+
"terminal.exit": "Embedded terminal is a web/desktop surface; Android has no terminal client.",
62+
"ui.command": "Web Control UI-only layout commands; Android does not consume them.",
63+
"voicewake.routing.changed": "Android reads voicewake state on demand via voicewake.get; no push consumer yet."
6264
}
6365
}

0 commit comments

Comments
 (0)