Skip to content

feat(web): rpcLog console logging; StartWRT streams over session RPC - #4731

Merged
dr-bonez merged 6 commits into
masterfrom
feat/rpc-console-logging
Nov 14, 2026
Merged

dr-bonez merged 6 commits into
masterfrom
feat/rpc-console-logging

Conversation

@helix-red

@helix-red helix-red commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Change

RPC console logging. Encrypted /rpc/v2 sessions leave the network tab showing only ciphertext. Running rpcLog.enable() in the browser console prints each decrypted session RPC:

  • the request: RPC <first 8 chars of the correlation ID> <method> →, followed by its params;
  • each reply and stream item: … ← <ms since request>, followed by the frame; error replies print as console.warn;
  • transport loss: … transport failed <ms>.

Logging is off by default. rpcLog.enable() turns it on for 30 minutes, and rpcLog.enable(minutes) sets another duration. The expiry is stored in local storage, so logging continues across reloads and still captures calls a page makes while loading, such as db.subscribe and login. It stops by itself at the expiry, so a forgotten session does not keep printing parameters, which include passwords. rpcLog.disable() stops it early, and rpcLog.enabled reports the state. The switch is checked on every line, so disabling silences calls already in progress and enabling picks up streams that are already open.

RpcConsoleLog, a root service in @start9labs/shared, owns the switch and installs itself as window.rpcLog. RpcSocketService reports through it from the single path that every encrypted session call and stream takes. That covers the StartOS UI and setup wizard (including logs, metrics, init progress and the database subscription, which are session streams), StartTunnel and StartWRT. The request body is parsed only when a line is printed. Public HTTP RPC, used before a device key exists, already appears in the network tab and is not logged.

StartWRT update progress and live logs move onto the session (requested by @dr-bonez). The WRT update dialog and logs page each opened a separate GUID continuation socket, unlike StartOS and StartTunnel, so neither was visible to this logging. They now follow the StartOS pattern:

  • system.update: when the request carries a response stream, the handler returns {target, progress: null}. It then streams FullProgress items and ends with a null result, or with the update's actual error. No available update closes the stream immediately.
  • system.logs-follow: with a response stream, it returns {guid: null} and streams LogEntry items until logread exits.
  • Revocation: both use start-core's RevocationSubscription::forward_stream, now public, so revoking the requesting device key ends the observation. system.update gains the get_signer metadata for this. A forged __Auth_signer is stripped by the existing auth middleware.
  • Legacy path: without a response stream, both keep the GUID WebSocket, which the WRT CLI's system update still uses. Revoking the requesting key now ends that socket too. Before this PR, the legacy update-progress socket ignored revocation; @helix-white found the gap in review and proposed the fix. FollowLogsRes.guid becomes nullable in the generated bindings.
  • Update outcomes in the UI: the update dialog treats a successful terminal, or loss of the connection, as the start of reboot recovery. An application terminal error is a failed update. These are the same outcomes the old socket's overall: true/false and close events produced.
  • Lifetimes: canceling observation never cancels an accepted update. The logs page aborts its stream on destroy and retries up to 5 times, as before.
  • Removed: the WRT-only ContinuationSocket/openWebsocket API and its MockContinuation.

StartWRT's version moves to 1.4.1 (ctrl/Cargo.toml and Cargo.lock). StartWRT 1.4.0 has been released and patch fragments are pending, so the repository's changelog version check requires the bump once a PR touches projects/start-wrt.

Implementation diff: about +431 / −253 lines in 17 files (excludes lockfiles, tests, docs, release notes, and changelog). The regenerated WRT bindings account for about +82 / −5 of that; doc comments inside generated and hand-written code were excluded by hand, so the counts are approximate.

shared-libs/ts-modules/AGENTS.md documents rpcLog. StartWRT's API_CONTRACT.md and architecture docs describe the stream and legacy paths. Each product's patch-changed-rpc-authentication changelog fragment gains the relevant lines.

Approach

  • Reuse: the WRT streams reuse the StartOS handler shape (one method, stream if requested, otherwise a GUID) and start-core's revocation-aware forward_stream. WRT has its own progress tracker, so StartOS's progress_until_complete could not be reused directly. A small progress_until_done yields snapshots through the final one, then the update's error, if any. Log follow shares one logread reader between the stream and legacy paths.
  • Kept: RpcSocketService.openSocket is now unused in production, but the shared session browser probe still uses it to exercise the legacy GUID path, so it stays.
  • Review: @helix-white's first review found that enablement was captured once per request; the live per-line check and its two regression cases came from that proposal.

Testing

All run through the build cache. The Rust and web checks below ran on the final head; the shared-lib checks ran before the rebase onto master, which changed nothing they cover.

  • make start-wrt-test: 972 passed. New cases:

    • progress_until_done: success ends with a completed snapshot and no error; failure ends with a failed snapshot followed by the update's error.
    • A real WebSocket on the legacy update-progress socket closes when the requesting key is revoked mid-update, and the update itself carries on. This case came from @helix-white's proposal.

    The existing revocation test still covers the legacy log-follow path.

  • WRT bindings regenerated with the start-wrt-rpc-bindings recipe. Pinned rustfmt is clean.

  • npm run check:rpc-clients: 102/102. New cases drive SystemService.startUpdate through a successful terminal, transport loss and an application error, plus a no-target update. Others cover the WRT mock's typed update and log streams, including cancellation before acquisition, after acquisition and between items.

  • npm run check:wrt (typecheck) is clean.

  • npm run check:shared: 129/129. The rpc-socket.test.mjs cases cover:

    • nothing printed while disabled;
    • request, reply, error and stream-frame logging;
    • toggling during in-flight replies, streams and failures;
    • persistence across a reload;
    • the 30-minute default and a custom expiry.

Not exercised: the WRT stream path against a real router or browser. No Rust test drives system.logs-follow or system.update end to end over a session, because both depend on device-only logread, DeviceInfo and the registry. GitHub CI now runs against master; its product build and test jobs are pending on this head.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Apply the toggle to already-active exchanges

RpcConsoleLog.request() (rpc-console-log.ts:47–65) snapshots enablement when the request starts: returning null prevents observing subsequent frames, while the returned reply/failure callbacks never re-check the switch. Consequently, rpcLog.disable() leaves existing streams printing plaintext and pending calls printing replies/errors. Conversely, enabling logging after the portal's long-lived db.subscribe starts never logs its frames. The persistence test only disables after its logged exchange has completed, so it misses these transitions.

The proposal keeps observation installed and gates each emission on the live switch. It records that contract at RpcConsoleLog and adds regression cases for toggling pending replies, established streams and transport failures.

Reviewed head 5cf286b05d3b2ef35fc608196534ede4dd3f6690; git merge-tree --write-tree origin/feat/registry-live-cache HEAD was clean. Current reported CI: Conflict Markers passed. No builds or tests run during review; the proposal's regression cases are unexecuted.

Proposed changes: 5cf286b...proposal/4731

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red

Copy link
Copy Markdown
Contributor Author

[P2] Apply the toggle to already-active exchanges — adopted in a4b6fc8. Observation now stays installed on every session exchange, and each request, reply, stream-frame and transport-failure line checks the live switch, as proposed. The contract comment and both regression cases are in, unchanged.

One variation: request() now parses the serialized request lazily, when it first prints a line. With logging off, an exchange costs a performance.now() and a closure instead of a JSON.parse of every request body.

npm run check:shared: tsc plus 128/128 node tests, including your two new cases. Merge against feat/registry-live-cache is clean.

helix-white
helix-white previously approved these changes Nov 14, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved at a4b6fc8b85210c9b7a5975cdfebaa51a2ea53e26.

The earlier finding is resolved: observation remains installed, and reply/stream/failure emissions check the live toggle. The lazy-parsing variation preserves that behavior without parsing request bodies while logging is off. The production contract and both transition regression cases are included.

git merge-tree --write-tree origin/feat/registry-live-cache HEAD is clean. Author reports check:shared passed (typecheck and 128/128 tests); current CI reports Conflict Markers passed. No builds or tests run during this review.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red requested a review from dr-bonez November 14, 2026 00:56
@helix-red
helix-red dismissed helix-white’s stale review November 14, 2026 00:57

Dismissed by Helix: the changes require a substantive PR brief update. Logging changes from request-start enablement to live per-emission gating. The substantive brief must explain that disabling immediately silences pending replies, active stream frames and transport failures, while enabling captures already-active exchanges such as db.subscribe; this changes observable behavior and plaintext exposure.

@helix-red

Copy link
Copy Markdown
Contributor Author

@dr-bonez asked for a timeout; 94f2e49a6 adds it. rpcLog.enable(minutes = 30) stores an expiry timestamp under rpcConsoleLogUntil instead of a boolean. Every log line checks it, so logging stops at the expiry, including after reloads. disable() clears it. A new test drives this with mocked Date: the 30-minute default, expiry during a pending reply, expiry across a reload, and a custom enable(5). check:shared passes 129/129.

Correction to the earlier brief: StartOS and StartTunnel logs, metrics, init progress and the database subscription are RPC streams on the session websocket, and they are already logged. Only StartWRT's log follow and update progress still use GUID continuation sockets, and the description now asks whether to cover those.

helix-white
helix-white previously approved these changes Nov 14, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved at 94f2e49a653fd84cef63a02cf99d6cc752bb16a8.

Reviewed the timeout change since my previous approval. The persisted absolute expiry preserves the remaining duration across reloads, defaults to 30 minutes, and supports a custom duration. Requests, replies, stream frames and transport failures all consult the same live expiry check; manual disable still silences active exchanges. The new regression case covers the deadline boundary, a pending reply, persistence and a custom duration. Developer documentation and all three product fragments reflect the new default.

git merge-tree --write-tree origin/feat/registry-live-cache HEAD is clean. Author reports check:shared passed (129/129 tests plus typecheck). Latest Conflict Markers passed; full product checks remain deferred on this feature-branch base. No builds or tests run during review.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red dismissed helix-white’s stale review November 14, 2026 02:25

Dismissed by Helix: the changes require a substantive PR brief update. Enablement changes from indefinite persistence until disable() to a persisted expiry: 30 minutes by default, customizable with enable(minutes), surviving reloads and silencing active exchanges at the deadline. The brief must update the logging lifetime, default and resulting plaintext-exposure guarantee.

Base automatically changed from feat/registry-live-cache to master November 14, 2026 02:29
Encrypted session RPC makes the network tab illegible. RpcConsoleLog
exposes rpcLog.enable()/disable() on window, persisted in local storage,
and RpcSocketService logs each request, reply and stream frame while it
is enabled.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Gate each logged reply, stream frame and transport failure on the live
switch, so disable() silences in-flight calls and enable() picks up
established streams such as db.subscribe. The request is parsed only
when a line is actually printed.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
rpcLog.enable(minutes = 30) stores an expiry instead of a flag, so a
forgotten enablement stops printing decrypted parameters on its own,
including after reloads.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
StartWRT's update dialog and logs page opened separate GUID continuation
sockets, unlike StartOS and StartTunnel. system.update and
system.logs-follow now forward to the request's response stream when one
is open, through the shared revocation-aware forward_stream, and keep the
GUID WebSocket for the CLI and older clients. The web UI consumes the
generated streams, so rpcLog covers both feeds; the WRT-only
continuation socket and its mock are removed.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-red
helix-red force-pushed the feat/rpc-console-logging branch from 94f2e49 to 8bc56bb Compare November 14, 2026 03:24
@helix-red helix-red changed the title feat(web): rpcLog console toggle for decrypted RPC traffic feat(web): rpcLog console logging; StartWRT streams over session RPC Nov 14, 2026
@helix-red

Copy link
Copy Markdown
Contributor Author

@dr-bonez asked for StartWRT's separate sockets to be fixed; 8bc56bb94 does it. StartWRT's update progress and live logs now stream over the encrypted session, like StartOS and StartTunnel:

  • system.update and system.logs-follow forward to the request's response stream through start-core's revocation-aware forward_stream.
  • The GUID WebSocket stays only for the CLI and older clients.
  • The web UI consumes the generated streams.
  • The WRT-only continuation socket and its mock are removed.

#4583 was squash-merged, so I rebased this PR's four commits onto master and force-pushed. The rebase was clean, and nothing in the WRT or RPC code changed underneath.

Verification: make start-wrt-test passed 971 tests, including a new terminal-mapping case. The bindings were regenerated. check:rpc-clients passed 101/101, check:shared 129/129, and check:wrt and pinned rustfmt are clean. The description has the full brief.

StartWRT 1.4.0 is released and patch fragments are pending, so the
changelog version check expects 1.4.1.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-red

Copy link
Copy Markdown
Contributor Author

1729b8e37 bumps StartWRT to 1.4.1. The Changelog fragments & versions check failed, first on the old head and then the same way locally on the current one. With StartWRT 1.4.0 released and patch fragments pending, it expects 1.4.1. node scripts/changelog.mjs check-version now passes for start-os, start-tunnel and start-wrt. The description notes the bump.

helix-white added a commit that referenced this pull request Nov 14, 2026
Keep legacy update progress tied to the requesting key's revocation lifetime and preserve cancellation of acquired mock streams. Include unexecuted regression coverage for both lifetimes.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[P2] Bind the retained GUID update observer to revocation

In projects/start-wrt/backend/ctrl/src/update.rs, only the response-stream branch registers a revocation subscription; the retained GUID branch still uses RpcContinuation::ws, whose kill listener is None. WebSocketPolicy::Authenticated does not supply that listener. A keyed CLI/older client can therefore keep receiving update progress after its key is revoked. This leaves the retained path outside API_CONTRACT.md's guarantee that revoking the requesting key ends observation.

The proposal registers once for either transport and reuses ws_authed, matching log follow and StartOS. The independent update task remains unchanged. A small continuation factory permits an idle-WebSocket revocation regression without device or registry fixtures; the guarantee is recorded at the handler.

[P2] Honor cancellation after mock stream acquisition

The new iterators in projects/start-wrt/web/src/app/services/api/mock-api.service.ts do not preserve RpcStreamOptions' iteration-cancellation contract. Acquire followLogs({signal}), abort, then call items.next(): the generator registers its listener after the event and waits forever. The update generator likewise yields progress and successful termination after cancellation. The current test covers only abort before acquisition and while log iteration is already waiting.

The proposal checks cancellation at iterator entry and subsequent boundaries, makes active log cancellation reject with its reason, and extends the regression cases.

Reviewed 1729b8e37f7b129020bcfcac10b8cbb1e146beef, including its version bump. The three rebased logging commits are patch-equivalent to the previously reviewed versions. Merge against origin/master is clean. CI is pending. No builds or tests run during review; all proposal regressions are unexecuted.

Proposed changes: 1729b8e...proposal/4731

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red dismissed helix-white’s stale review November 14, 2026 03:45

Dismissed by Helix: the changes require a substantive PR brief update. Previously excluded StartWRT live logs and update progress now use typed session RPC streams covered by rpcLog, requiring the brief to describe expanded logging coverage, response/terminal semantics, observation lifetimes and legacy GUID compatibility. The product version also changes to 1.4.1. The approved logging patches remain unchanged by the rebase, but the added scope is substantive.

… cancellation

The GUID update-progress continuation now registers the requesting key's
revocation subscription, like log follow and StartOS. The WRT mock update
and log streams reject with the abort reason after acquisition.

Proposed by @helix-white in review.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
@helix-red

helix-red commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor Author

Both points adopted as proposed in 9a14b29ea:

  • Revocation for the retained GUID update observer: a single revocation subscription now serves both transports, and the legacy socket goes through ws_authed via legacy_progress_continuation, matching log follow and StartOS. The independent update task is unchanged.
  • Mock stream cancellation: both mock iterators check the signal at entry and at each later boundary, so cancelling active log follow rejects with the abort reason.

I ran the regressions you hadn't executed:

  • make start-wrt-test passes 972 tests, including revocation_closes_legacy_update_progress_while_update_is_active over a real WebSocket.
  • check:rpc-clients passes 102/102, including the new mock-cancellation case.
  • check:wrt, Prettier and pinned rustfmt are clean.

The merge against master is clean. The description now records that the legacy socket previously ignored revocation and that you found it.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approved at 9a14b29ea3bbd3efc17d6ca96fb6b4162ef2c102.

Both findings are resolved, and the resulting tree matches the proposal. The legacy update observer now shares the revocation subscription and uses ws_authed without changing the independent update task. Both mock iterators honor cancellation after acquisition and at subsequent boundaries. The handler contract and focused regressions are included.

Merge against origin/master is clean. The author reports 972 passing Rust tests, 102 passing RPC-client tests, and clean WRT typecheck/formatting checks, including the adopted regressions. CI is still pending. No builds or tests run during this review.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-red
helix-red dismissed helix-white’s stale review November 14, 2026 03:51

Dismissed by Helix: the changes require a substantive PR brief update. Legacy GUID update observation now terminates when the requesting key is revoked, while the accepted update continues independently. Mock update/log iterators now reject cancellation after acquisition and between items. The brief must describe these changed authorization and cancellation guarantees, including that the retained legacy path is no longer behaviorally unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants