Skip to content

feat: show live session activity for running tasks#96672

Open
gauravprasadgp wants to merge 1 commit into
openclaw:mainfrom
gauravprasadgp:feat/session-activity
Open

feat: show live session activity for running tasks#96672
gauravprasadgp wants to merge 1 commit into
openclaw:mainfrom
gauravprasadgp:feat/session-activity

Conversation

@gauravprasadgp

Copy link
Copy Markdown
Contributor

What Problem This Solves

Resolves a problem where the control UI could not reliably know which background work was active for a session, making it hard to show loading state, running task details, or polling-style progress for exec calls, subagents, and other session-scoped work.

Why This Change Was Made

This adds a live session activity surface over the existing gateway WebSocket protocol instead of introducing a separate REST endpoint, so the UI can subscribe to activity changes using the same session state channel. The snapshot aggregates active task-registry entries and live tool calls, includes descendant sessions by default, and exposes metadata-only plugin hooks for other integrations to build on without leaking tool arguments or results.

User Impact

Users can now see when a session has active background work, including exec/tool activity and task activity from subagents or related session work. The control UI can show a loading controller and running task list from the new session activity stream, while plugin authors get hook events for task and tool lifecycle changes.

Evidence

Focused validation passed:

OPENCLAW_LOCAL_CHECK=0 PATH=/Users/gauravprasad/.nvm/versions/node/v22.22.2/bin:$PATH corepack pnpm test src/gateway/session-activity.test.ts src/gateway/session-activity.snapshot.test.ts src/gateway/server-methods/session-activity.test.ts src/tasks/task-registry.store.test.ts ui/src/ui/controllers/session-activity.test.ts ui/src/ui/app-gateway.node.test.ts

Results covered:

gateway: 3 files / 6 tests passed
tasks: 1 file / 12 tests passed
ui: 2 files / 36 tests passed

Additional checks passed:

pnpm plugin-sdk:api:check
git diff --check

pnpm check:changed completed the static lanes successfully during local validation; I would let CI provide the final full-gate confirmation.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XL triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Jun 25, 2026
@clawsweeper

clawsweeper Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 11, 2026, 3:17 AM ET / 07:17 UTC.

Summary
The PR adds a sessions.activity Gateway RPC and session.activity event, seven task/tool lifecycle plugin hooks, and a web Control UI chat strip for live background work.

PR surface: Source +1017, Tests +667, Docs +3, Generated 0. Total +1687 across 35 files.

Reproducibility: yes. at source level for the PR defect: applySessionToolActivityEvent mutates the activity strip on exact session-key equality before the existing selected-global alias and agent-scope filters execute.

Review metrics: 1 noteworthy metric.

  • Public Activity Contracts: 1 RPC, 1 event, 7 plugin hooks added. These durable Gateway and plugin SDK surfaces overlap the task activity APIs now on current main and require explicit acceptance.

Stored data model
Persistent data-model change detected: serialized state: packages/gateway-protocol/src/schema/sessions.ts, serialized state: src/gateway/server-methods/session-activity.test.ts, serialized state: src/gateway/server-methods/session-activity.ts, serialized state: src/gateway/session-activity.snapshot.test.ts, serialized state: src/gateway/session-activity.test.ts, serialized state: src/gateway/session-activity.ts, and 12 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #52960
Summary: This PR is an implementation candidate for the Control UI progress request, with partial overlap against the broader Gateway activity contract and the merged task ledger.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🦪 silver shellfish
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Route activity updates through the canonical selected-session alias and agent-scope matcher.
  • Rebase onto current main and consolidate with the merged task activity contracts before retaining any new RPC, event, or hooks.
  • [P1] Add redacted live Gateway and web UI chat proof showing activity appears for the correct session, includes intended descendants, and clears after completion and reconnect.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body contains tests and static checks only, with no after-fix live Gateway or web Control UI proof; add redacted screenshots, a recording, terminal/live output, or logs showing correct selected-session activity and cleanup, then update the PR body for automatic re-review or ask a maintainer to comment @clawsweeper re-review.

Mantis proof suggestion
A web UI chat recording would materially prove the visible running-work strip, selected-session scoping, descendant inclusion, and cleanup. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis web UI chat proof: verify and record that task/tool activity appears only for the selected session, includes descendant work, and clears after completion.

Risk before merge

  • [P1] The branch is conflicting with current main, including activity-related Gateway and Control UI work merged after this PR was opened.
  • [P1] The new RPC, event, and seven plugin hooks would become parallel public compatibility contracts beside the task activity surface already on main.
  • [P1] The PR has no real setup evidence for live activity, descendant inclusion, cleanup, reconnect behavior, or upgrade behavior.

Maintainer options:

  1. Rebase and Consolidate (recommended)
    Resolve conflicts by reusing current-main task summaries/events and remove parallel public surfaces not required for the chat experience.
  2. Approve the Additional Contract
    Accept the new session and plugin APIs only after owner review and focused authorization, reconnect, lifecycle, and compatibility proof.
  3. Pause for API Design
    Pause or close this implementation if the broader session activity issues should define the permanent contract first.

Next step before merge

  • [P1] The contributor must repair the repeated scope defect, rebase, and add live proof, while maintainers must select the canonical Gateway/plugin activity contract.

Maintainer decision needed

  • Question: Should the chat activity feature extend the task activity contracts merged in feat(ui): show background tasks live in the web Control UI #100789, or should OpenClaw also support this separate sessions.activity/session.activity and plugin-hook family?
  • Rationale: Both choices create durable Gateway and plugin SDK obligations, and repository policy requires explicit owner direction before adding a parallel public contract.
  • Likely owner: steipete — The recently merged Tasks implementation creates the immediate current-main overlap and is the best available routing point for the contract choice.
  • Options:
    • Extend Existing Task Surface (recommended): Rebase onto current main, reuse task summaries/events, and add only the missing selected-session tool activity needed by the chat strip.
    • Accept Separate Session Contract: Keep the new RPC, event, and hooks after explicit Gateway/plugin API approval plus compatibility and lifecycle proof.
    • Pause This Direction: Leave the canonical issues open and pause or close this branch until maintainers settle the activity contract.

Security
Cleared: No concrete security or supply-chain regression was found; the patch exposes bounded metadata rather than tool arguments or results, while authorization and session scope remain functional correctness concerns.

Review findings

  • [P1] Preserve selected-global agent scope before updating activity — ui/src/pages/chat/session-activity.ts:46
  • [P1] Defer the plugin hooks until the activity contract is accepted — src/plugins/hook-types.ts:118-124
Review details

Best possible solution:

Rebase onto current main, build the chat strip on the existing task summary/event contract, route tool events through uiSessionEventMatches, and add only the smallest missing session-scoped tool API after explicit Gateway/plugin owner approval and live proof.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level for the PR defect: applySessionToolActivityEvent mutates the activity strip on exact session-key equality before the existing selected-global alias and agent-scope filters execute.

Is this the best way to solve the issue?

No; the user-facing goal is valuable, but the current patch is not the narrowest maintainable solution because it duplicates current-main task contracts and bypasses the canonical session-event matcher.

Full review comments:

  • [P1] Preserve selected-global agent scope before updating activity — ui/src/pages/chat/session-activity.ts:46
    The new activity helper accepts exact sessionKey equality and is called before the existing tool-stream handler applies selected-global alias and agent-scope filtering. A selected-global chat can therefore show another agent's live tool under the same global key; route this update through uiSessionEventMatches before mutating sessionActivity.
    Confidence: 0.94
  • [P1] Defer the plugin hooks until the activity contract is accepted — src/plugins/hook-types.ts:118-124
    These seven new hook names turn the proposed activity shape into a shipped plugin SDK contract, while the permanent activity API is still unresolved and now overlaps the task event surface merged in feat(ui): show background tasks live in the web Control UI #100789. Remove the hooks from this PR or obtain explicit plugin API approval and define the compatibility contract before merge.
    Confidence: 0.9

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4fcee4f4fdc1.

Label changes

Label justifications:

  • P2: This is a useful but non-urgent Control UI and Gateway feature with limited current user impact.
  • merge-risk: 🚨 compatibility: The PR adds parallel public Gateway and plugin SDK contracts beside task activity contracts already merged on current main.
  • merge-risk: 🚨 session-state: The new activity aggregation and UI mutation can mis-associate live work across selected-global aliases, agents, or descendant sessions.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body contains tests and static checks only, with no after-fix live Gateway or web Control UI proof; add redacted screenshots, a recording, terminal/live output, or logs showing correct selected-session activity and cleanup, then update the PR body for automatic re-review or ask a maintainer to comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source +1017, Tests +667, Docs +3, Generated 0. Total +1687 across 35 files.

View PR surface stats
Area Files Added Removed Net
Source 24 1028 11 +1017
Tests 7 683 16 +667
Docs 3 10 7 +3
Config 0 0 0 0
Generated 1 2 2 0
Other 0 0 0 0
Total 35 1723 36 +1687

What I checked:

Likely related people:

  • BunsDev: Commit 4935e24 introduced compact Control UI run-status and composer status paths that this chat activity display extends. (role: adjacent Control UI run-status contributor; confidence: high; commits: 4935e24c7a7f; files: ui/src/ui/views/chat.ts, ui/src/ui/chat/status-indicators.ts, ui/src/ui/app-gateway.ts)
  • vincentkoc: The broader session activity contract is assigned to this person, and recent history touches the affected session schema, Gateway chat, and protocol documentation. (role: canonical issue assignee and recent Gateway/protocol contributor; confidence: high; commits: 2b75806197ab; files: packages/gateway-protocol/src/schema/sessions.ts, src/gateway/server-chat.ts, docs/gateway/protocol.md)
  • lanzhi-lee: Recent merged work touches the public hook type and runner contracts where this PR adds seven hook names. (role: recent plugin API contributor; confidence: medium; commits: bd479958c04a; files: src/plugins/hook-types.ts, src/plugins/hooks.ts, src/plugin-sdk/index.ts)
  • clay-datacurve: Commit 7b61ca1 introduced session management and streaming surfaces that this PR builds upon. (role: session and dashboard feature introducer; confidence: high; commits: 7b61ca1b0615; files: src/gateway/server-methods/sessions.ts, src/gateway/server-methods-list.ts, src/gateway/server-chat.ts)
  • steipete: Merged PR feat(ui): show background tasks live in the web Control UI #100789 established the closest current-main task event, summary, and Control UI boundary. (role: recent adjacent task activity contributor; confidence: high; commits: f623d81f5261; files: src/gateway/server-runtime-subscriptions.ts, src/gateway/server-methods/task-summary.ts, ui/src/pages/tasks/tasks-page.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (1 earlier review cycle)
  • reviewed 2026-06-26T16:22:03.221Z sha 832a1ed :: needs real behavior proof before merge. :: [P1] Preserve agent scope before mutating activity | [P1] Defer hooks until the activity contract is accepted

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 25, 2026
@gauravprasadgp
gauravprasadgp force-pushed the feat/session-activity branch 2 times, most recently from f1b398f to 832a1ed Compare June 26, 2026 16:10
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 26, 2026
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 merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XL stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant