Skip to content

refactor(evm-wallet-experiment): use new kernel-cli queueMessage subcommand#909

Merged
sirtimid merged 10 commits intomainfrom
sirtimid/use-new-cli-features
Apr 1, 2026
Merged

refactor(evm-wallet-experiment): use new kernel-cli queueMessage subcommand#909
sirtimid merged 10 commits intomainfrom
sirtimid/use-new-cli-features

Conversation

@sirtimid
Copy link
Copy Markdown
Contributor

@sirtimid sirtimid commented Mar 31, 2026

Summary

Leverages the new ocap daemon queueMessage <kref> <method> [args] syntax (from #896) across all evm-wallet-experiment scripts, docs, and the OpenClaw plugin.

  • Replace daemon exec queueMessage '["kref","method",[args]]' with the cleaner daemon queueMessage kref method '[args]' — eliminates nested JSON escaping and simplifies argument construction throughout setup-home.sh, setup-away.sh, and update-limits.sh
  • Remove parse_capdata() helper (~30 lines per script) — the new CLI auto-decodes CapData via prettifySmallcaps, so manual parsing is no longer needed
  • Simplify OpenClaw plugin — drop decodeCapData(), isCapDataLike(), and CapDataLike type (~60 lines) since the CLI handles CapData decoding; plugin just JSON.parses the decoded output
  • Add OCAP_HOME env var supporthome-interactive.mjs default db path, log messages in scripts, and docs all respect OCAP_HOME
  • Fix wrong OCAP_BIN path in update-limits.sh — was pointing to non-existent packages/cli/, now correctly points to packages/kernel-cli/
  • Fix error detection in update-limits.shprettifySmallcaps converts #error objects to strings like [TypeError: msg], so the old grep '"#error"' would never match; now uses string-prefix detection

Net result: -108 lines across 6 files.

Test plan

These are shell scripts and documentation — no automated test suite covers them directly. Verified by:

  • All four bash scripts pass bash -n syntax checks
  • Grepped the entire package to confirm zero remaining parse_capdata or daemon exec queueMessage references
  • Reviewed the new daemon queueMessage CLI source (packages/kernel-cli/src/commands/daemon.ts) to confirm argument handling matches the new script invocations
  • Reviewed prettifySmallcaps to confirm error object encoding and fix the detection logic accordingly

🤖 Generated with Claude Code


Note

Medium Risk
Medium risk because it changes the CLI invocation contract and output parsing used by setup/limits scripts and the OpenClaw plugin; failures would surface as broken automation or mis-detected daemon/vat errors rather than isolated unit changes.

Overview
Switches the wallet setup flows to the new kernel-cli daemon queueMessage interface. All docs and automation scripts replace daemon exec queueMessage nested-JSON calls with daemon queueMessage <kref> <method> <argsJson>, simplifying argument construction and updating the manual command examples.

Removes CapData unwrapping from consumers and updates error handling. The OpenClaw plugin and shell scripts drop CapData/parse_capdata decoding logic and instead JSON.parse the CLI’s decoded output, with new heuristics for detecting prettified vat errors (e.g. "[ErrorName: msg]").

Misc reliability/ops tweaks. Adds OCAP_HOME support for interactive DB/log paths, fixes update-limits.sh to point at packages/kernel-cli/dist/app.mjs, refactors remote comms JSON construction in scripts, and increases remote-comms e2e test timeouts/backoff to reduce CI flakiness.

Written by Cursor Bugbot for commit 70bf51b. This will update automatically on new commits. Configure here.

sirtimid and others added 2 commits March 31, 2026 15:00
…ommand

Leverage the new `ocap daemon queueMessage <kref> <method> [args]` syntax
from 2f7ecbc across all scripts, docs, and the OpenClaw plugin. This
eliminates the error-prone `daemon exec queueMessage '["kref","method",[args]]'`
pattern with its nested JSON escaping, and removes the manual `parse_capdata`
helper since the CLI now auto-decodes CapData via prettifySmallcaps.

Also adds OCAP_HOME env var support and fixes a wrong OCAP_BIN path in
update-limits.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… update-limits

prettifySmallcaps converts CapData #error objects to strings like
"[TypeError: msg]" rather than preserving the {"#error": "msg"} shape.
The old grep for '"#error"' would never match the decoded output,
silently ignoring revocation failures. Use string-prefix detection instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sirtimid sirtimid requested a review from a team as a code owner March 31, 2026 13:05
sirtimid and others added 4 commits March 31, 2026 15:09
- Add missing YELLOW color variable to setup-away.sh
- Clarify daemon_qm helper comments (--quiet shift + method capture)
- Simplify call()/rawCall() in home-interactive.mjs: close over kernel
  and rootKref to reduce from 4 positional args to 2
- Replace `any` with `unknown` for parameterized test rejection params
  in coordinator-vat.test.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…e dead code

- Fix error detection in openclaw plugin daemon.ts: prettifySmallcaps
  converts #error CapData objects to strings like "[TypeError: msg]",
  so the old object-shape check never matched. Use string-prefix check.
- Remove unused json_value() from setup-away.sh.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…JSON construction

Replace ad-hoc shell string interpolation for COMMS_PARAMS (relay
address, allowedWsHosts) and ENTROPY with node -e + env vars. The
old pattern was vulnerable to JSON injection if RELAY_ADDR contained
double-quote characters, and was inconsistent with the rest of the
scripts' JSON construction discipline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…CLI output

The new `daemon queueMessage` CLI auto-decodes CapData, so test mocks
must return plain JSON instead of CapData-wrapped responses. Also updates
spawn argument assertions to match the new CLI arg structure
(daemon queueMessage kref method argsJson) and the error test to use
prettified error strings ("[Error: msg]") instead of CapData #error objects.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

…st constants

prettifySmallcaps converts both #error objects and manifest constants
to strings starting with "[": errors become "[TypeError: msg]" while
constants become "[undefined]", "[NaN]", etc. Use a regex that checks
for the ": " separator to avoid false positives on void method returns.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 78.13%
🟰 ±0%
8235 / 10539
🔵 Statements 77.95%
🟰 ±0%
8368 / 10735
🔵 Functions 75.54%
🟰 ±0%
1937 / 2564
🔵 Branches 76.62%
🟰 ±0%
3511 / 4582
File CoverageNo changed files found.
Generated in workflow #4140 for commit 70bf51b by the Vitest Coverage Report Action

@sirtimid sirtimid enabled auto-merge March 31, 2026 16:27
rekmarks
rekmarks previously approved these changes Mar 31, 2026
@sirtimid sirtimid added this pull request to the merge queue Mar 31, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 31, 2026
@sirtimid sirtimid added this pull request to the merge queue Mar 31, 2026
@sirtimid sirtimid removed this pull request from the merge queue due to a manual request Mar 31, 2026
@sirtimid sirtimid enabled auto-merge March 31, 2026 23:48
The "rejects new messages when queue reaches MAX_QUEUE limit" test
sends 201 messages while disconnected, restarts a kernel, and resolves
all promises. In CI this can take >90s. Bump from NETWORK_TIMEOUT*3
(90s) to NETWORK_TIMEOUT*4 (120s) to avoid flaky timeout failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ction test

The "handles multiple simultaneous reconnections to different peers"
test has kernel1 redeem URLs on two peers that restart sequentially
through a relay. The default ackTimeoutMs of 2s gives only 8s for
URL redemption, which is too tight when two kernels are reconnecting
in CI. Use 5s (→ 20s redemption window) for the initiating kernel.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sirtimid sirtimid added this pull request to the merge queue Apr 1, 2026
Merged via the queue into main with commit 7fe14e2 Apr 1, 2026
32 checks passed
@sirtimid sirtimid deleted the sirtimid/use-new-cli-features branch April 1, 2026 00:50
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