Skip to content

fix(id): stop interrupted status reads - #197753

Closed
wangmiao0668000666 wants to merge 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/id-status-read-cancel
Closed

wangmiao0668000666 wants to merge 1 commit into
openclaw:mainfrom
wangmiao0668000666:fix/id-status-read-cancel

Conversation

@wangmiao0668000666

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes: interrupting openclaw id status leaves the pending openclawId.status (and the
follow-up openclawId.people) request alive, and when the reply lands during cleanup the
CLI still prints the key/binding/publication report after the user asked to stop.

The same shape was fixed this week for users/nodes/models/devices/cron/skills-library
reads by the interrupt family (#197322, #197185, #197174, #197110, #197315, #197281).
id status was a remaining callGatewayFromCli caller that did not pass the command
abort signal.

Precedent: #197322 (same shape; this PR only changes the call site).

Why This Change Was Made

runStatus now captures getAsyncWorkSignal() and forwards it into both status reads
through the existing transport calls; once the signal aborts, the command returns without
printing, and abort errors from the transport are swallowed only when the signal is
aborted. The rebind/publish write flows keep their receipt behavior and are not
guarded (waitForPublication still reads without a signal).

No new validator, option, config surface, or persistence change. Non-interrupted reads
print exactly as before, and the operator.read / operator.admin scopes are untouched.

Production LOC is +36/-9 in src/cli/id-cli.ts.

Classification: behavior-completing

User Impact

Interrupting id status no longer prints a late key/binding report after Ctrl+C or
SIGTERM; the CLI exits 130/143 without a late result or error. Uninterrupted reads and
the rebind/publish writes behave identically.

Evidence

Exact-head proof receipt

  • Product head SHA: 03fd8be0a1c31937045912c9612ea446d3f2526c
  • Current-main RED baseline: d2ca84fb7b67 (openclaw/openclaw main at verification time)
  • Production entry: real source CLI, node --import ./scripts/tsx.mjs src/entry.ts id status --url … --token … --json
  • Canonical owner exercised: runStatus / readPeopleLink in src/cli/id-cli.ts
  • Decision surface: id status output (JSON and human)
  • Recorder/readback boundary: process.stdout.write call count and process exit code
  • Acceptance RED: on base, the same command prints the late openclawId.status reply (marker L8E_MARKER_7f3a91 observed on stdout) after SIGINT
  • Acceptance GREEN: exact head exits 130 with empty stdout after SIGINT; late reply never printed
  • Legal control: all 8 pre-existing tests in the same file pass unchanged on the exact head (scope-gated status/rebind output, committed-failure reporting)
  • Cleanup: isolated OPENCLAW_STATE_DIR/OPENCLAW_CONFIG_PATH/OPENCLAW_HOME per run; no production Gateway, session, channel, token, or configuration was touched

Discriminative regression (remote vitest, node v24.22.1)

src/cli/id-cli.commands.test.ts gains a test that settles the status read only after the
command scope begins closing (AsyncWorkScope.beginClose()) and asserts stdout is empty
and no exit code is set.

Run Result
BASE d2ca84fb7b67 (test file only) prints no status reply that lands after Ctrl+C FAIL (report printed)
HEAD 03fd8be0a1c3 9 passed (includes the new Ctrl+C test)
node_modules/.bin/vitest run --config vitest.config.ts src/cli/id-cli.commands.test.ts --maxWorkers=1

Sibling suite on the exact head: src/cli/id-cli-rebind.test.ts 1 passed.

Shipped real-behavior proof (real CLI, synthetic loopback Gateway peer)

Same recipe as the accepted #197281/#197508 proofs: the real CLI entry runs against a
synthetic loopback peer (challenge → connect → hello-ok → held request → late legal
reply). On SIGINT the driver releases a late legal openclawId.status reply carrying
marker L8E_MARKER_7f3a91 and records stdout/exit.

Variant Exit code SIGINT→exit Late reply printed
BASE d2ca84fb7b67 130 810 ms yes (marker on stdout)
HEAD 03fd8be0a1c3 130 569 ms no (stdout empty)

Uninterrupted control: covered by the 8 pre-existing vitest cases on the exact head. No
watchdog kill in any run.

Verification

  • src/cli/id-cli.commands.test.ts — 9 passed on HEAD; the new Ctrl+C test red on BASE
  • oxfmt --check and oxlint clean on all touched files
  • tsc -p tsconfig.core.json --noEmit — no errors in touched files (donor tree shows pre-existing generated-code drift errors in unrelated files, identical on base)
  • check:line-cap-ratchet and check-test-lines-ratchet green with the exact 12-line allocation
  • git diff --check clean
  • Not tested: real Gateway round trip (peer is synthetic; the vitest boundary mocks only the transport); Windows/macOS; full repository CI

Scope and risk

  • Production LOC: +36/-9, one file
  • Test LOC: +12 (one file)
  • Existing-solutions preflight: reuses getAsyncWorkSignal() and the transport's existing signal hook; no new abstraction
  • Config/default, protocol/schema, authorization, storage, migration, upgrade impact: none
Maintainer edits
  • The abort guard is scoped to the read-only id status path; rebind and its
    waitForPublication polling deliberately keep their committed-receipt reporting.
  • readPeopleLink takes an optional signal; its only other caller (rebind publication
    wait) passes none, so that flow is byte-identical.
Maintainer options
  • Land-ready: single-owner change, precedented shape, red/green plus real-CLI proof above.
  • Alternative considered and rejected: guarding readPeopleLink unconditionally — would
    swallow the rebind publication read whose outcome the user still needs.
  • Scope declaration: no drive-by changes.

@clawsweeper

clawsweeper Bot commented Nov 12, 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 docs Improvements or additions to documentation cli CLI command changes size: S labels Nov 12, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. labels Nov 12, 2026
@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close this PR as a duplicate of #197747, which covers both interrupted status reads, has verified real-Gateway proof, and is cleanly mergeable with a successful CI gate.

Root-cause cluster
Relationship: duplicate
Canonical: #197747
Summary: Both PRs repair missing cancellation propagation and late output in the same ID status and people reads.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Consolidate the cancellation repair in #197747 and preserve this PR’s late-response reproduction by linking it.

So I’m closing this here and keeping the remaining discussion on #197747.

Review details

Best possible solution:

Consolidate the cancellation repair in #197747 and preserve this PR’s late-response reproduction by linking it.

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

Current-main source exposes the missing cancellation signal, and the canonical PR’s inspected baseline artifacts reproduce pending reads through the built CLI and real Gateway; this review executed no target code.

Is this the best way to solve the issue?

Reusing the existing command signal and transport cancellation is appropriate, but the earlier canonical PR already provides the complete repair with stronger boundary coverage.

Security review:

Security review cleared: The patch preserves RPC scopes and write behavior and adds no credential, dependency, or authorization changes.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • Josh Lehman: Raw commit 5f2f21a adds src/cli/id-cli.ts:74 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5f2f21a7ee19; files: src/cli/id-cli.ts)

Codex review notes: model internal, reasoning medium; reviewed against 8864d2764ded.

@clawsweeper

clawsweeper Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper recorded closeout evidence for this proposed close.

  • Action: close remains subject to final live verification.
  • Close reason: duplicate or superseded.
    Review evidence: durable ClawSweeper review.
  • Coverage proof: The source report describes concrete implementation, tests, and behavior proof for PR B at its unchanged current head. These directly carry PR A’s remaining repair; no independent regression test, human hold, or behavior remains unique to PR A. Covering PR: fix(cli): let interrupted ID status checks exit promptly #197747.

@clawsweeper clawsweeper Bot closed this Nov 12, 2026
@wangmiao0668000666
wangmiao0668000666 deleted the fix/id-status-read-cancel branch November 13, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant