Skip to content

fix(nodes): cancel interrupted camera list and location reads - #199388

Merged
obviyus merged 5 commits into
openclaw:mainfrom
wangmiao0668000666:fix/nodes-read-cancel
Nov 15, 2026
Merged

obviyus merged 5 commits into
openclaw:mainfrom
wangmiao0668000666:fix/nodes-read-cancel

Conversation

@wangmiao0668000666

@wangmiao0668000666 wangmiao0668000666 commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

nodes camera list and nodes location get read a paired node through the Gateway, but neither passed an abort signal to the underlying RPC. Interrupting the CLI with Ctrl+C left the node.invoke request pending until its timeout, so the read hung instead of settling with the interrupt.

Follow the established read-cancel pattern from #197185 (runNodesReadCommand): thread the async work signal through callNodesGatewayCli(..., { signal }) so Ctrl+C owns the exit of these inventory reads.

Change

  • src/cli/nodes-cli/register.ts: camera list and location get now run through runNodesReadCommand and pass { signal } to callNodesGatewayCli("node.invoke", ...). Aborted interrupts are swallowed silently by runNodesReadCommand, matching status/list/pending/describe.
  • Tests: new register.read-cancel.test.ts drives the real runNodesReadCommand with an AsyncWorkScope closing mid-invoke and asserts no output/exit on interrupt; camera/location mocks updated.

Precedent: #197185

Evidence

Discriminant tests (base RED / head GREEN)

  • Base (origin/main): register.read-cancel.test.ts → 2 failed
  • Head: full src/cli/nodes-cli suite → 8 files, 76 passed (including the new cancel tests green)

Shipped CLI real-behavior proof (synthetic Gateway peer + PTY Ctrl+C)

Built the cliStartup dist for both base and head. A synthetic WebSocket peer completes the connect-challenge handshake, answers node.list with one fake node, and holds node.invoke so the RPC stays pending. A PTY driver runs openclaw nodes camera list / openclaw nodes location get against the peer, sends Ctrl+C (VINTR), and records exit latency and code. Inspectable captures (driver measurements + cleaned terminal transcript per run) and the peer transport log are on the fork at proof/nodes-read-cancel:

  • capture-head-camera.txt — head camera list: exit_after_ctrlc=0.10s, exit_code=130 (SIGINT)
  • capture-head-location.txt — head location get: exit_after_ctrlc=0.09s, exit_code=130 (SIGINT)
  • capture-base-camera.txt — base camera list: exit_after_ctrlc=2.03s, exit_code=-9 (SIGKILL)
  • capture-base-location.txt — base location get: exit_after_ctrlc=2.03s, exit_code=-9 (SIGKILL)
  • peer-run.log — transport across all four runs: connect challenge → hello-ok → node.list → held node.invoke (camera.list ×2 and location.get ×2) → connection close on Ctrl+C. CLI version: 2026.11.3 = head dist, version: 0.0.0 = base dist; the first two held invokes (head) are camera.list then location.get, the last two (base) are camera.list then location.get
  • drive_nodes_proof.py + nodes-synth-peer.mjs — reproduction harness
Command Dist Ctrl+C → exit Exit code
camera list base 2.03s (cleanup watchdog SIGKILL) -9
camera list head 0.10s 130 (SIGINT)
location get base 2.03s (cleanup watchdog SIGKILL) -9
location get head 0.09s 130 (SIGINT)

Head's signal aborts the pending node.invoke, so cleanup completes immediately and the CLI exits 130. Base has no signal: the RPC stays pending until timeout, the signal-exit cleanup watchdog force-kills after ~2s. Synthetic peer on 127.0.0.1, synthetic token, RFC-3849-style fake node id.

Impact

Behavior-preserving for normal operation; only interrupt handling changes for two read-only node commands.

nodes camera list and location get kept their node.invoke read alive after
Ctrl-C/SIGTERM, waiting out the invoke timeout before the launcher forced a
SIGKILL. Forward the ambient command signal through the shared read owner
(runNodesReadCommand) into the node.invoke RPC so an interrupted read settles
quietly with the normal SIGINT/SIGTERM exit code. The node resolution lookup
and mutation commands keep their existing custody.

Precedent: openclaw#197185 (nodes status/list/pending/describe reads), openclaw#198076.
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Nov 15, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Nov 15, 2026
@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR makes interrupted camera-list and location-read commands release their pending Gateway requests.

Example: Press Ctrl+C while openclaw nodes camera list --node fake-node awaits a reply.

  • Before: The CLI requires the cleanup watchdog to terminate it with SIGKILL.
  • After: The pending connection closes and the CLI exits promptly with code 130.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused repair with shipped CLI cancellation proof, meaningful regressions, and no identified defects; required current-head CI is still running.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): Inspected built-CLI PTY captures and real WebSocket transport traces exercise both interrupted commands; obviyus additionally records real Gateway/Linux-node SIGINT and SIGTERM results plus unchanged controls, and the exercised production code remains unchanged.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Interrupting a pending camera-list or location-read command leaves the CLI waiting until forced termination.
Reason: A demonstrated CLI lifecycle defect is repaired through the existing owner, with narrow production changes and preserved normal behavior.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a demonstrated cancellation bug still present on current main, with sufficient CLI proof and no identified patch defects; current-head CI remains in progress.

Priority: P2
Reviewed head: 26ea4b303566da277f686ae4eff48def3cc57b08

Before merge

None.

Findings

None.

Agent review details

How this fits together

The nodes CLI resolves a paired node, sends camera.list or location.get through Gateway node.invoke, and prints the returned inventory or location.

flowchart LR
  A[CLI interruption] --> B[Async work scope]
  B --> C[Nodes read command]
  C --> D[Gateway RPC client]
  D --> E[Paired node]
  E --> F[CLI output]
Loading

Technical review

Best possible solution:

Use the existing read-cancellation owner for these two pending RPCs and land this focused fix once required CI succeeds.

Do we have a high-confidence way to reproduce the issue?

Current-main source omits the signals, and inspected CLI captures demonstrate the failure; this read-only review did not execute target code.

Is this the best way to solve the issue?

The patch is the smallest complete repair for interruption during these node.invoke reads: it reuses existing lifecycle and transport owners without changing mutation custody.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 2e1b61901c5d.

Provenance checked

  • Read cancellation and mutation custody keeps the original intent (24f686d: The merged inventory-read repair lets interruption own read output while admitted node operations retain response custody; this patch preserves mutation paths.)
  • Location validation coverage keeps the original intent (467f072: Reject unsupported accuracy before Gateway access; consolidated tests retain that boundary and exercise the real command error handler.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit e668716 adds src/cli/nodes-cli/register.ts:309 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e66871691ddc; files: src/cli/nodes-cli/register.ts)

PR surface

Source +1, Tests -3, Other -2. Total -4 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 5 4 +1
Tests 2 40 43 -3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 2 -2
Total 4 45 49 -4

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Interruption fails to settle two advanced CLI reads cleanly, with limited impact outside those commands.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (5 earlier review cycles)
  • reviewed 2026-11-15T03:10:24.428Z sha 9ff01db :: needs real behavior proof before merge. :: [P2] Type the RPC mock before installing its four-argument implementation
  • reviewed 2026-11-15T10:36:01.427Z sha 8006bd9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-15T10:47:04.063Z sha 8006bd9 :: blocked before merge. :: none
  • reviewed 2026-11-15T11:53:27.598Z sha 16294a8 :: needs maintainer review before merge. :: none
  • reviewed 2026-11-15T12:14:35.753Z sha b1fa358 :: needs maintainer review before merge. :: none

Reviewed November 15, 2026, 8:16 AM ET / 13:16 UTC (Revision 6).

wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 15, 2026
Transport-side capture: connect challenge -> hello-ok -> node.list -> the
held node.invoke -> connection close on Ctrl+C. Shows the CLI version tag
(2026.11.3 head vs 0.0.0 base) distinguishing the two dists.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
wangmiao0668000666 added a commit to wangmiao0668000666/openclaw that referenced this pull request Nov 15, 2026
…nclaw#199388

Prior captures accidentally ran `nodes location get` for all four variants
(the driver's cmd selector fell through for non-exact labels). Re-run with
correct camera/location selectors: peer log now shows 2x camera.list + 2x
location.get invokes held, head (2026.11.3) vs base (0.0.0) dists, and each
held node.invoke followed by connection close on Ctrl+C.

Co-Authored-By: nebulacoder-v8.0 <[email protected]>
@wangmiao0668000666

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 15, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@obviyus

obviyus commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Natural Linux proof supersedes the earlier macOS-headless limitation. No held-reply proxy or injected delay was used.

Base: 5025db61e948; candidate: 16294a8ced06 (contributor commits retained; test-only consolidation added).

A secretless node:24.22.1 container ran a real token-auth Gateway and a paired Linux headless node. Installed Debian geoclue-2.0, geoclue-2-demo, and dbus; started the system D-Bus daemon; enabled plugins.entries.linux-node.config.location.enabled. The approved node advertised location.get. Real where-am-i -t 10 -a 6 waited 10.50 s without a fix. Uninterrupted nodes location get --node <paired-id> --json returned LOCATION_TIMEOUT: no fix in time on both builds.

Built CLI receipts, interrupted about one second after the real where-am-i process appeared:

Build Signal Exit Time after signal node.invoke socket close
Base PTY Ctrl-C -9 2.033 s 1006
Base SIGTERM -9 2.024 s 1006
Candidate PTY Ctrl-C 130 0.036 s 1005
Candidate SIGTERM 143 0.054 s 1005
base:      close code=1006 lastFrameMethod=node.invoke
candidate: close code=1005 lastFrameMethod=node.invoke
Command interrupted by SIGINT. Waiting for cleanup before exiting.
Command interrupted by SIGTERM. Waiting for cleanup before exiting.

No command output followed either candidate interrupt notice; only terminal-reset escape sequences were emitted. Exit code, stdout, and stderr were identical across all uninterrupted controls: location timeout, unavailable camera list, successful nodes invoke --command system.which, and camera snap's existing opt-in error. invoke, snap, clip, and run production paths are unchanged. Camera-list cancellation is covered by the regression table; no supported physical camera was available.

Vitest-source on the host: the consolidated test passes all four validation/forwarding cases on base, but fails both cancellation cases because late output is printed. Candidate: all 19 camera/location tests pass. Targeted lint passes. Full host tier: ocx build --dts passes. The packed candidate installs in the Linux container; --version reports 16294a8, and nodes location get --help succeeds.

Host eligibility passed for this head: only the nodes CLI source and tests differ, with no package, lockfile, workspace, lifecycle, hook, or scripts changes. No host hooks ran. Production delta +5/-4; tests +40/-43 (net -3), with the standalone cancellation fixture removed. Detailed receipts are retained in the task's proofs/199388/ directory.

@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. clawsweeper:intake:bug Preliminary submission classification; full source review pending. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. labels Nov 15, 2026
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Updated head b1fa3587b617156834f0bd91348ea16ad66af3f7 removes only the two stale register.location.test.ts entries from config/test-mock-exports-baseline.txt. Running the ratchet with --prune changed exactly those two lines; the subsequent ratchet passed (6320 grandfathered factories). All 76 nodes-cli tests passed. Full ocx build --dts and an isolated installed-tarball CLI smoke passed on this head. Production code and the test delta (net -3) are unchanged; the natural Linux interrupt proof above still applies. Host eligibility remains clear, and no host hooks ran.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Merged current main without rebasing at 26ea4b303566da277f686ae4eff48def3cc57b08. The merge resolved automatically. The PR still changes only four files; its baseline diff removes exactly our two stale entries. The mock-exports ratchet and nodes-cli suite pass again. Full build with declarations and an isolated installed-tarball CLI smoke also pass on this head. No additional repair changes were made; the production/test deltas remain +5/-4 and +40/-43.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 15, 2026
@obviyus
obviyus merged commit 52fd3d8 into openclaw:main Nov 15, 2026
115 checks passed
@obviyus

obviyus commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

Landed in 52fd3d8. Thanks @wangmiao0668000666.

@wangmiao0668000666
wangmiao0668000666 deleted the fix/nodes-read-cancel branch November 15, 2026 15:23
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 16, 2026
…aw#199388)

fix(cli): stop nodes camera list and location get on Ctrl-C and SIGTERM

`openclaw nodes camera list` and `nodes location get` called node.invoke through the wrapper that ignores the CLI's abort signal, so a Ctrl-C or SIGTERM while the node was still answering left the CLI waiting until the cleanup watchdog force-killed it. Both read-only commands now use the existing runNodesReadCommand wrapper that passes the signal, as the other node reads do since openclaw#197185. Commands that change node state (invoke, snap, clip, run) are unchanged. No new text.

Evidence: dist-nodts in a secretless Linux container with a real Gateway (token auth) and a real paired Linux headless node whose location.get waits for a GeoClue fix (`nodes location get` naturally took about 18 s before LOCATION_TIMEOUT); no proxy or held replies. SIGINT and SIGTERM about 1 s in: base was force-killed after about 2 s and the socket dropped (1006); this change exits 130 and 143 within 54 ms with a clean close (1005) and nothing printed after the interrupt notice. Uninterrupted output, `nodes invoke` and `camera snap` behave the same on both. Vitest-source: the cancellation cases fail on base and 76 nodes-cli tests pass here; full build and packed smoke pass. Net -3 test lines; two stale mock-baseline entries for the removed mocks are deleted. Receipts: openclaw#199388 (comment).

Thanks @wangmiao0668000666.

Co-authored-by: Ayaan Zaidi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants