Skip to content

fix(inspector): send workflow history as raw BARE bytes - #5576

Merged
jog1t merged 2 commits into
mainfrom
fix/inspector-workflow-history-bare-transport
Aug 20, 2026
Merged

fix(inspector): send workflow history as raw BARE bytes#5576
jog1t merged 2 commits into
mainfrom
fix/inspector-workflow-history-bare-transport

Conversation

@jog1t

@jog1t jog1t commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The inspector Workflow tab failed to render workflow history, reporting BareError: (byte:3) invalid UTF-8 string.

The inspector wire format carries raw BARE workflow-history bytes, but the native bridge ran them through the CBOR compat encoder, which rewrites an ArrayBuffer as ["$ArrayBuffer", "<base64>"]. The dashboard then read those CBOR bytes as BARE and failed at byte 3. Only the WebSocket/NAPI path was affected; the HTTP routes already serialized correctly.

  • Pass workflow history across the native bridge as raw bytes instead of CBOR compat encoding it, for both the history and replay callbacks
  • Add a branded WorkflowHistoryBytes type so these bytes cannot be handed to the CBOR compat encoder again, making a regression a compile error
  • Add a driver test asserting the inspector WebSocket delivers history that decodes as BARE, covering both the Init message and an explicit WorkflowHistoryRequest
  • Stop core from decoding workflow history as CBOR in its JSON inspector responses. Decoding BARE bytes as CBOR yields a garbage value rather than an error, so core now omits the field and logs instead, since the BARE codec lives in the TypeScript workflow engine
  • Surface a decode failure in the dashboard Workflow tab instead of silently rendering it as an empty workflow
  • Fix the dashboard's workflow replay request, which still expected the pre-2.1 response shape of raw history bytes and rejected the documented decoded JSON, so "Replay From Current Step" always failed. The tab already refreshes history over the websocket after a replay, so the response body no longer needs to carry it

@railway-app

railway-app Bot commented Aug 19, 2026

Copy link
Copy Markdown

🚅 Deployed to the actors-pr-5576 environment in rivet-frontend

Service Status Web Updated (UTC)
frontend-cloud 😴 Sleeping (View Logs) Web Aug 19, 2026 at 7:27 pm
frontend-inspector 😴 Sleeping (View Logs) Web Aug 19, 2026 at 7:26 pm
kitchen-sink 😴 Sleeping (View Logs) Web Aug 19, 2026 at 7:26 pm
website ❌ Build Failed (View Logs) Web Aug 19, 2026 at 7:17 pm
ladle ✅ Success (View Logs) Web Aug 19, 2026 at 6:54 pm
mcp-hub ✅ Success (View Logs) Web Aug 19, 2026 at 10:31 am

@claude

claude Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Review (updated)

The second commit addresses both points raised in my previous pass, plus lands the originally-described decode_cbor_json_or_null/dashboard-error-surfacing work:

  • Test coverage gap fixed. The new test now opens a second WebSocket after releasing the blocked step to assert on the Init message's workflowHistory field too (actor-inspector.test.ts:846-863), not just the explicit WorkflowHistoryRequest round-trip. This now matches what the PR description claims. Good call reusing a second connection rather than trying to race the first Init against the still-empty history.
  • encodeValue's distribution caveat. Left in place with an explanatory comment rather than removed, which is a reasonable resolution since encodeValue is genuinely unused for workflow bytes now (both real call sites use toUint8Array per native.ts:4828 and native.ts:4858).
  • Core-side fix is correct. warn_and_omit_workflow_history in inspector.rs cleanly replaces the old CBOR-decode-BARE-as-garbage path with a log + omit, and decode_cbor_json_or_null is still exercised by every other JSON inspector field (state, connections, params, schema, etc.) so nothing else regressed.
  • Dashboard error surfacing is correct and wired end-to-end. transformWorkflowHistoryFromInspector now returns {history, isEnabled, error}, and all three call sites that consume it (WorkflowHistoryUpdated, WorkflowHistoryResponse, WorkflowReplayResponse, and Init) plumb error through consistently. ActorWorkflowTab now renders a dedicated error state instead of falling through to "no workflow recorded."
  • Replay HTTP response fix is scoped correctly. WorkflowHistoryHttpResponse.history is now unknown and deliberately unread, with a comment explaining why (websocket refresh covers it, BARE bytes don't match the documented JSON shape). Minor/optional: since the field is never read, the type could drop it entirely rather than typing it unknown, but the current form with the comment is also fine and arguably clearer about the mismatch it's guarding against.

No new correctness, security, or performance issues found in the delta. This is inspector/dev-tooling code behind existing auth, byte-format correctness only, no new I/O or hot paths.

@abcxff
abcxff self-requested a review August 19, 2026 11:24
@jog1t
jog1t force-pushed the fix/inspector-workflow-history-bare-transport branch from a35d24a to df47889 Compare August 19, 2026 19:17
@jog1t
jog1t merged commit 977703b into main Aug 20, 2026
12 of 18 checks passed
@jog1t
jog1t deleted the fix/inspector-workflow-history-bare-transport branch August 20, 2026 18:01
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.

2 participants