Skip to content

fix(status): enable Terminal RPC module and TCP streaming for devnet - #463

Merged
RetricSu merged 4 commits into
masterfrom
fix/status-devnet-missing-data
Jul 23, 2026
Merged

fix(status): enable Terminal RPC module and TCP streaming for devnet#463
RetricSu merged 4 commits into
masterfrom
fix/status-devnet-missing-data

Conversation

@humble-little-bear

Copy link
Copy Markdown
Collaborator

Problem

On devnet, several offckb status (ckb-tui) panels were always empty / N/A. Cross-checking with the ckb-tui README, ckb-tui has two node-side requirements that our bundled devnet config did not meet:

  1. The Terminal RPC module — it provides get_overview (system metrics: CPU/memory/disk/network). Without it the overview dashboards show N/A. Upstream CKB (incl. v0.207.0, our default node) now enables Terminal in its default rpc.modules, but our bundled ckb/devnet/ckb.toml predates that.
  2. The TCP subscription service (rpc.tcp_listen_address + passing -t to ckb-tui) — it streams the new_transaction / rejected_transaction / log topics. It was commented out in our template and the status command never passed -t, so the mempool (recent/rejected transactions) and logs dashboards had nothing to read.

Fix

  • ckb/devnet/ckb.toml: add Terminal to rpc.modules and enable tcp_listen_address = "127.0.0.1:18114".
  • src/cmd/status.ts: for devnet, read tcp_listen_address from the running node's ckb.toml and pass it to ckb-tui via -t (wildcard binds are dialed as 127.0.0.1). Best-effort: if the key is missing or the config unreadable, -t is omitted and ckb-tui degrades gracefully. Testnet/mainnet are unchanged — their proxied public RPCs expose no local TCP stream.

The existing tests still pass; added coverage for the -t behavior (present, wildcard-normalized, absent, non-devnet).

Note for existing installs

The bundled config is only copied when the devnet config dir is first initialized. Nodes created with an older OffCKB keep their old ckb.toml; to pick up the fix, either re-initialize the devnet (offckb node stop, then reset/clean the devnet data dir and start again) or hand-edit <offckb-data>/devnet/ckb.toml to add "Terminal" to rpc.modules and set rpc.tcp_listen_address, then restart the node.

Verification

  • pnpm exec jest — 24 suites, 185 passed
  • tsc --noEmit, eslint, prettier — clean

ckb-tui panels were always empty on devnet because the bundled devnet
ckb.toml did not meet ckb-tui's two data requirements:

- the Terminal RPC module (provides get_overview system metrics), which
  upstream CKB now enables by default, was missing from rpc.modules, so
  the overview dashboards showed N/A
- rpc.tcp_listen_address was commented out and the status command never
  passed -t, so the mempool (new/rejected transactions) and logs
  dashboards had no subscription stream to read from

Enable both in the devnet config template and have the status command
read tcp_listen_address from the running node's ckb.toml and pass it to
ckb-tui via -t (wildcard binds are dialed as localhost). Testnet and
mainnet keep HTTP-only behavior since their proxied public RPCs expose
no TCP stream.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b0bf546-57fe-4550-acca-b43b0ed43004

📥 Commits

Reviewing files that changed from the base of the PR and between fa8c994 and 300b09f.

📒 Files selected for processing (2)
  • .changeset/olive-donkeys-cheer.md
  • src/tui/devnet-reference-templates.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/olive-donkeys-cheer.md

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Devnet status now forwards the configured TCP streaming endpoint to ckb-tui (only on devnet), omitting it when the listener is missing or invalid.
    • Wildcard TCP binds (e.g., 0.0.0.0) are normalized to loopback (127.0.0.1) for reliable connections.
    • Devnet RPC is now bound to loopback only (127.0.0.1), and the Terminal RPC module is enabled to improve devnet overview metrics.
  • Tests

    • Expanded status command tests to cover -t wiring, normalization, and omission cases.

Walkthrough

Devnet RPC configuration now enables Terminal TCP streaming and binds HTTP RPC to localhost. The status command reads the devnet TCP listener, normalizes wildcard addresses, and passes it to ckb-tui. Tests cover configured, missing, wildcard, and public-network cases.

Changes

Devnet TCP metrics streaming

Layer / File(s) Summary
TCP listener configuration and parsing
ckb/devnet/ckb.toml, src/tui/devnet-reference-templates.ts, src/cmd/status.ts
Devnet RPC enables the Terminal module and TCP listener, HTTP RPC binds to localhost, and status reads and normalizes wildcard listener addresses.
Status-to-ckb-tui argument wiring
src/cmd/status.ts
The devnet status flow conditionally passes -t with the TCP endpoint to CKBTui.run.
Status behavior validation and release metadata
tests/status.test.ts, .changeset/olive-donkeys-cheer.md
Tests cover configured, wildcard, missing, and public-network cases; the changeset declares a patch release and documents the configuration updates.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant status as status command
  participant config as ckb.toml
  participant tui as CKBTui.run
  status->>config: read rpc.tcp_listen_address
  config-->>status: return TCP listener address
  status->>tui: run with -r URL and optional -t address
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main devnet status fix by enabling the Terminal RPC module and TCP streaming.
Description check ✅ Passed The description is directly related to the changeset and explains the devnet status fixes and verification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

✅ Changeset file detected.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ckb/devnet/ckb.toml`:
- Around line 88-90: Restrict the devnet RPC listener before enabling the
Terminal module: update the listen_address configuration from the externally
reachable 0.0.0.0 binding to loopback 127.0.0.1, or leave Terminal disabled
unless the RPC port is protected by authentication or a firewall.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 439087ab-06e2-44bf-a48e-a04e893fe173

📥 Commits

Reviewing files that changed from the base of the PR and between 19d04ef and 94e40be.

📒 Files selected for processing (3)
  • ckb/devnet/ckb.toml
  • src/cmd/status.ts
  • tests/status.test.ts

Comment thread ckb/devnet/ckb.toml
Address CodeRabbit review on PR #463: with the Terminal module enabled,
binding the unauthenticated JSON-RPC to 0.0.0.0 exposes host system
metrics (and the rest of the RPC surface) to any host on the network.
Bind to 127.0.0.1 by default; all offckb-internal consumers (proxy,
ckb-tui, miner, forks) already talk to 127.0.0.1:8114. Users who need
remote access can edit rpc.listen_address via the config editor.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tui/devnet-reference-templates.ts`:
- Line 83: Update the embedded devnet configuration template near listen_address
to include "Terminal" in the modules list and enable tcp_listen_address with
127.0.0.1:18114, keeping it aligned with the devnet configuration used by the
TUI.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4ae18c30-940a-48da-ac8a-ad67d742d665

📥 Commits

Reviewing files that changed from the base of the PR and between cd94530 and fa8c994.

📒 Files selected for processing (3)
  • .changeset/olive-donkeys-cheer.md
  • ckb/devnet/ckb.toml
  • src/tui/devnet-reference-templates.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/olive-donkeys-cheer.md

Comment thread src/tui/devnet-reference-templates.ts
Add Terminal to rpc.modules and enable tcp_listen_address in the config
editor's embedded template so configurations based on it also provide the
metrics stream that offckb status needs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@RetricSu
RetricSu merged commit 0cdf9f8 into master Jul 23, 2026
7 checks passed
@RetricSu
RetricSu deleted the fix/status-devnet-missing-data branch July 23, 2026 03:16
RetricSu pushed a commit that referenced this pull request Jul 23, 2026
…463) (#464)

* fix(status): enable Terminal RPC module and TCP streaming for devnet

ckb-tui panels were always empty on devnet because the bundled devnet
ckb.toml did not meet ckb-tui's two data requirements:

- the Terminal RPC module (provides get_overview system metrics), which
  upstream CKB now enables by default, was missing from rpc.modules, so
  the overview dashboards showed N/A
- rpc.tcp_listen_address was commented out and the status command never
  passed -t, so the mempool (new/rejected transactions) and logs
  dashboards had no subscription stream to read from

Enable both in the devnet config template and have the status command
read tcp_listen_address from the running node's ckb.toml and pass it to
ckb-tui via -t (wildcard binds are dialed as localhost). Testnet and
mainnet keep HTTP-only behavior since their proxied public RPCs expose
no TCP stream.



* chore: add patch changeset for status devnet fix

* fix(devnet): bind RPC to loopback instead of 0.0.0.0

Address CodeRabbit review on PR #463: with the Terminal module enabled,
binding the unauthenticated JSON-RPC to 0.0.0.0 exposes host system
metrics (and the rest of the RPC surface) to any host on the network.
Bind to 127.0.0.1 by default; all offckb-internal consumers (proxy,
ckb-tui, miner, forks) already talk to 127.0.0.1:8114. Users who need
remote access can edit rpc.listen_address via the config editor.

* fix(devnet): align embedded reference template with devnet ckb.toml

Add Terminal to rpc.modules and enable tcp_listen_address in the config
editor's embedded template so configurations based on it also provide the
metrics stream that offckb status needs.



---------

Co-authored-by: claude-bear <noreply@anthropic.com>
RetricSu added a commit that referenced this pull request Jul 26, 2026
* fix(status): enable Terminal RPC module and TCP streaming for devnet (#463) (#464)

* fix(status): enable Terminal RPC module and TCP streaming for devnet

ckb-tui panels were always empty on devnet because the bundled devnet
ckb.toml did not meet ckb-tui's two data requirements:

- the Terminal RPC module (provides get_overview system metrics), which
  upstream CKB now enables by default, was missing from rpc.modules, so
  the overview dashboards showed N/A
- rpc.tcp_listen_address was commented out and the status command never
  passed -t, so the mempool (new/rejected transactions) and logs
  dashboards had no subscription stream to read from

Enable both in the devnet config template and have the status command
read tcp_listen_address from the running node's ckb.toml and pass it to
ckb-tui via -t (wildcard binds are dialed as localhost). Testnet and
mainnet keep HTTP-only behavior since their proxied public RPCs expose
no TCP stream.



* chore: add patch changeset for status devnet fix

* fix(devnet): bind RPC to loopback instead of 0.0.0.0

Address CodeRabbit review on PR #463: with the Terminal module enabled,
binding the unauthenticated JSON-RPC to 0.0.0.0 exposes host system
metrics (and the rest of the RPC surface) to any host on the network.
Bind to 127.0.0.1 by default; all offckb-internal consumers (proxy,
ckb-tui, miner, forks) already talk to 127.0.0.1:8114. Users who need
remote access can edit rpc.listen_address via the config editor.

* fix(devnet): align embedded reference template with devnet ckb.toml

Add Terminal to rpc.modules and enable tcp_listen_address in the config
editor's embedded template so configurations based on it also provide the
metrics stream that offckb status needs.



---------

Co-authored-by: claude-bear <noreply@anthropic.com>

* build(deps): bump tar, brace-expansion, js-yaml, hono, fast-uri, body-parser for security advisories (#465)

- tar ^7.5.3 -> ^7.5.19 (locked 7.5.21): fixes GHSA-23hp-3jrh-7fpw (critical),
  GHSA-8x88-c5mf-7j5w (high), GHSA-w8wr-v893-vjvp / GHSA-gvwx-54wh-qm9j (moderate)
- brace-expansion -> 1.1.16 / 5.0.7 via overrides: fixes GHSA-3jxr-9vmj-r5cp (high)
- js-yaml 4.x -> 4.3.0 via override: fixes GHSA-52cp-r559-cp3m (high)
- hono -> 4.12.27 via override: fixes GHSA-xgm2-5f3f-mvvc, GHSA-hvrm-45r6-mjfj,
  GHSA-w62v-xxxg-mg59 (moderate, dev-only)
- fast-uri -> 3.1.4 via override: fixes GHSA-v2hh-gcrm-f6hx, GHSA-4c8g-83qw-93j6
  (high, dev-only)
- body-parser 2.x -> 2.3.0 via override: fixes GHSA-v422-hmwv-36x6 (low, dev-only)

Not fixed: elliptic GHSA-848j-6mx2-7j84 (no patched release published) and
@hono/node-server GHSA-frvp-7c67-39w9 (fix requires breaking 1.x -> 2.x bump that
violates @modelcontextprotocol/sdk's ^1.19.9 range; dev-only, Windows-only).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* fix: rename mainnet-fork override flag and apply leftover 0.4.9 review fixes (#466)

* fix: rename mainnet-fork override flag and apply leftover 0.4.9 review fixes

- Rename --allow-mainnet-replay-risk to --allow-external-key-on-mainnet-fork (#460)
- Enforce the Mainnet-fork replay guard in transfer-all, udt issue/destroy,
  and deploy, threading the fork boundary into input selection (#462)
- Validate --tx-hash before it is used in debug cache paths
- Only read the fork boundary after the spawned process binds the RPC port
- Reject symlinked entries when copying fork source chain data
- Accept extended xUDT type args (owner hash + flags/extension)
- Per-kind UDT scan budgets, deep-cloned settings fallbacks, accurate
  config-set errors, preserved devnet-config error, execFile process lookup,
  aligned ckb-tui download timeouts, EXDEV-safe install, README TOC entry

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: address PR #466 review comments

- Keep --allow-mainnet-replay-risk as a hidden deprecated alias folded into
  --allow-external-key-on-mainnet-fork (with a deprecation warning) so 0.4.9
  scripts keep working under a patch release
- Treat lsof probe failures with stderr output as indeterminate (null)
  instead of "not listening"; only an empty-stderr exit is a genuine
  no-match, so permission errors fall back to the weaker genesis signal
- Reject a symlinked data root before enumerating source chain data
- Stage cross-device ckb-tui installs inside binDir and publish with an
  atomic rename, so concurrent installs never see a truncated binary

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix: bound the lsof port probe with a timeout

A hung lsof would block execFileSync (and with it daemon startup)
indefinitely, and its empty-stderr timeout error would be misread as a
genuine no-match. Cap the probe at 5s and classify ETIMEDOUT as
indeterminate (null) so the genesis fallback proceeds.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test: make lsof probe tests platform-independent

isProcessListeningOnPort short-circuits to null on win32, so the lsof
outcome-mapping tests failed on the Windows CI runner (mock never
called). Force a unix platform for the lsof-probing cases, cover the
win32 short-circuit explicitly, and pin the probe timeout to exactly
5000 ms per review feedback.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* Merge pull request #468 from ckb-devrel/agent/claude-bear/6b0ed58e

fix(devnet): offer Terminal module in config editor and migrate legacy ckb.toml

* chore: version packages for 0.4.10 release (#469)

* fix: default devnet log filter to info,ckb-script=debug (#471)

A healthy devnet emits almost no warn-level logs, so with the previous
default filter (warn,ckb-script=debug) the `offckb status` Logs panel
stayed permanently empty and looked broken. Switch the devnet ckb.toml
and ckb-miner.toml templates (and the config editor's embedded reference
templates) to info,ckb-script=debug so the per-block log stream is
visible while script debug output is preserved.

Existing chains keep their current filter; edit [logger] filter in the
devnet ckb.toml to opt in.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>

* chore: add new change log (#472)

---------

Co-authored-by: humble-little-bear <retric@ckba.build>
Co-authored-by: claude-bear <noreply@anthropic.com>
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.

3 participants