Skip to content

[Web runtime] Add HTTP SSE action support (3/3) - #1598

Merged
minggangw merged 8 commits into
RobotWebTools:developfrom
minggangw:fix-1579-http-sse
Sep 20, 2026
Merged

minggangw merged 8 commits into
RobotWebTools:developfrom
minggangw:fix-1579-http-sse

Conversation

@minggangw

@minggangw minggangw commented Sep 11, 2026

Copy link
Copy Markdown
Member
  • Add HTTP action goal endpoints streaming accepted, feedback, result, and error events over SSE.
  • Share SSE headers, framing, heartbeats, and cleanup between dedicated subscription and action connection classes, using consistent request/response naming.
  • Support actions in HTTP-only clients while preserving WebSocket routing for explicitly configured HTTP/WS endpoint pairs.
  • Abort pending HTTP action requests and streams on client close, suppress late feedback, and reject results when streams end prematurely.
  • Handle LF, CRLF, CR, and mixed SSE line endings across response chunk boundaries.
  • Preserve terminal action status and document that HTTP cancellation is unsupported and disconnecting does not cancel ROS goals.
  • Extend OpenAPI with action goal, feedback, result, and rejection schemas, plus a shared JSON error schema for pre-stream failures.
  • Clarify that action response schemas describe individual SSE event payloads and that generic OpenAPI clients require SSE-aware parsing.
  • Update CLI transport reporting and TypeScript documentation.
  • Expand HTTP/SSE action and subscription lifecycle, SDK shutdown, stream parsing, and OpenAPI regression coverage.
  • Retry ROS setup once on Linux x64 and ARM64 for Humble, Jazzy, and Kilted, skipping retries on cancellation and keeping repeated failures fatal.

Fix: #1579

Copilot AI lite review requested due to automatic review settings September 11, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Several unresolved HTTP action correctness, reliability, and discoverability issues remain.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds HTTP Server-Sent Events support for action goals, including routing, client handling, tests, documentation, and CLI capability reporting.

Changes:

  • Adds HTTP action SSE streaming for feedback and results.
  • Updates the web client and TypeScript declarations.
  • Adds integration coverage and CLI support reporting.
File summaries
File Findings
web/index.d.ts No findings.
web/client.js Moderate: generate unique action handle IDs and reject undefined terminal results. Nit: update outdated HTTP action transport documentation.
test/test-web-action.js No findings.
lib/runtime/transports/http.js Moderate: map unavailable actions to 503, buffer feedback before acceptance, and add action-stream heartbeats. Nit: include action routes in the OpenAPI document.
bin/rclnodejs-web.js No findings.
Review details

Suppressed comments (3)

lib/runtime/transports/http.js:36

  • The dispatcher emits code: 'action_unavailable' when an exposed action server is unavailable, but this new mapping omits it, so HttpActionConnection falls through to HTTP 500. Map this backend-unavailable case to 503 so HTTP clients can distinguish it from an internal action failure.
  goal_rejected: 409,
  action_failed: 500,
  unknown_goal_id: 400,

lib/runtime/transports/http.js:425

  • feedback can arrive before _handleActionGoalResponse() sends the {ok:true} acknowledgement—the WebSocket client explicitly registers goals before sending to handle this race. This path writes that feedback immediately, so the HTTP stream can violate the documented accepted → feedback order and clients waiting for accepted can miss it; buffer feedback until the acceptance frame is emitted.
    // Feedback delivery — zero or more, only while streaming.
    if (frame.event === 'feedback') {
      this._ensureStream();
      this._writeEvent('feedback', frame.payload);

lib/runtime/transports/http.js:468

  • Unlike HttpSseConnection, this action stream has no heartbeat after the accepted event. A long-running goal that emits no feedback can therefore be closed by an idle proxy or client, causing _pumpActionStream to reject with connection_lost while the server continues the goal (HTTP disconnects do not cancel it). Reuse the configured SSE keep-alive behavior for action streams or provide an equivalent action heartbeat.
    this.res.writeHead(200, {
      'content-type': 'text/event-stream; charset=utf-8',
      'cache-control': 'no-cache, no-transform',
      connection: 'keep-alive',
      'x-accel-buffering': 'no',
  • Files reviewed: 3/5 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread web/client.js Outdated
Comment thread web/client.js
Comment thread lib/runtime/transports/http.js Outdated
Comment on lines +526 to +530
* Also exposes `action` capabilities as a one-shot streaming request:
*
* POST /capability/action/<name> (text/event-stream response)
*
* The goal is sent as the JSON body; the response streams `accepted`,
Comment thread web/client.js
@coveralls

coveralls commented Sep 11, 2026

Copy link
Copy Markdown

Coverage Status

coverage: 91.136% (+0.2%) from 90.956% — minggangw:fix-1579-http-sse into RobotWebTools:develop

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

In-flight client streams cannot be closed, and server streams lack configured heartbeats.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 5/7 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread lib/runtime/transports/http.js Outdated
Comment thread web/client.js
@minggangw minggangw changed the title [Web runtime] Add HTTP SSE action support [Web runtime] Add HTTP SSE action support (3/3) Sep 17, 2026
@minggangw
minggangw requested a balanced review from Copilot September 17, 2026 05:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The client does not parse valid SSE streams that use bare carriage-return line endings.

Get a fresh assessment by requesting another Copilot review.

Review details
  • Files reviewed: 7/9 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread web/client.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Public HTTP documentation still incorrectly states that the transport supports only calls and publications.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
Resolved since last review (1)

@minggangw
minggangw merged commit ff42de8 into RobotWebTools:develop Sep 20, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add action capability dispatch

3 participants