Repository navigation
fix: preserve Gateway error reasons in text logs - #130645
Conversation
Print the existing formatted and redacted RPC error instead of a generic reachability claim. Preserve JSON output, selected-target details, fallback/recovery, auth and exit behavior. Verified with real loopback rejection and built CLI before/after proof. Closes #130616.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Land-ready at The root cause is the text terminal-error projection discarding its already-formatted/redacted reason. One argument replacement restores the reason through the existing safe stderr writer; JSON, auth, selected target, retries/fallback and exit handling remain unchanged. Production+1/-1; tests+21/-8; docs+2. Before: real built CLI accepted connect, received the logs.tail rejection, and hid its reason only in text mode; the expected text assertion failed. After: the same isolated loopback process probe retains Completed proof:175 focused tests; coordinator rerun49 owner/port tests including all9 real socket cases (overlaps175); full build; changed gates; formatting/docs/diff checks. The worker's socket tests were blocked before assertions by its sandbox; the coordinator's successful socket and process runs close that gap. Exact commands: node scripts/run-vitest.mjs src/cli/logs-cli.test.ts src/cli/logs-cli.port.test.tsnode scripts/check-changed.mjs -- src/cli/logs-cli.ts src/cli/logs-cli.test.ts src/cli/logs-cli.port.test.ts docs/cli/logs.mdnode --import tsx scripts/build-all.mtsgit diff --checkIndependent P1 review clean0.96. Current main has no affected owner/test/docs drift. The latest ClawSweeper comment is still a started placeholder, not a verdict; no rank-up list is published. No local proof gap remains for this CLI diagnostic change. Proceeding through native hosted-CI prepare/merge. |
|
Merged via squash.
|
…-retirement-v13 * origin/main: (243 commits) fix: preserve Gateway error reasons in text logs (#130645) refactor(video): deduplicate generation contracts (#130635) fix(agents): preserve direct-message sender identity (#124548) fix(agents): preserve silent reply after settled tools (#130675) fix(talk): preserve replacement speech when an old utterance is canceled (#130687) fix(browser): preserve literal names and formatter-owned snapshot refs (#130599) fix(auth): reset only the profile replaced by a successful login (#124014) fix: bind session creation to admitted Gateway (#130686) refactor(qa-lab): reuse model reference splitter (#130317) docs(gateway): clarify independent HTTP endpoint switches (#130690) fix(ui): Control UI smooth scrolling ignores the reduced-motion preference (#130428) refactor(lmstudio): remove unreachable catalog merge (#130689) fix(crabbox): restore cloud machine CPU and RAM (#130684) fix(secrets): compare proxy bearer tokens directly (#127054) fix(matrix): show recovery key availability in text status (#128051) fix(ios): restore approval settings navigation and remove duplicate shell state (#130651) refactor(agents): use fixed tool-loop defaults directly (#130681) refactor(qa-lab): share process tree metric reader (#130419) refactor(models): simplify prepared owner access (#130683) fix(parallels): main install and update smoke cannot complete (#130658) ...
Print the existing formatted and redacted RPC error instead of a generic reachability claim. Preserve JSON output, selected-target details, fallback/recovery, auth and exit behavior. Verified with real loopback rejection and built CLI before/after proof. Closes openclaw#130616.
Closes #130616
What Problem This Solves
Fixes an issue where operators using text-mode
openclaw logssaw only “Gateway not reachable” when a reachable Gateway rejectedlogs.tail. The actual server reason was discarded, making an RPC rejection look like a connection failure. JSON already retained the reason.Why This Change Was Made
The terminal-error owner already formats and redacts the authoritative error. Text output now sends that prepared string through its existing safe stderr writer instead of the generic reachability message. No new formatter, fallback, or control-flow branch is introduced. JSON shape and wording, selected-target diagnostics, auth, retries/recovery, broken-pipe handling, and exit behavior remain unchanged.
User Impact
Human-readable logs failures now show the actionable error alongside the selected Gateway details and doctor hint. The same terminal projection covers exhausted follow retries and non-recoverable failures. URL credentials stay redacted; stdout stays empty on the tested terminal rejection. The CLI reference documents the text behavior without changing the JSON contract.
Evidence
Before the repair, a real built CLI connected to a credential-free loopback WebSocket fixture and received
INVALID_REQUEST: logs unavailable for this client. Both text and JSON reachedconnectandlogs.tail, exited 1, and emitted no stdout. Only JSON retained the reason; the text assertion failed. The new focused redaction/reason assertion also failed on unchanged production.After the fix, the same rebuilt-CLI process probe passed: text stderr begins
logs unavailable for this client, followed by selected connection details and the doctor hint. JSON output remains unchanged. Temporary HOME/config/state and an ephemeral loopback port were used; no operator Gateway or external service was accessed.175 focused tests passed across logs, recovery, JSON, auth forwarding, error formatting, URL redaction, and safe-stream writing:
The worker sandbox denied loopback socket creation before assertions. The coordinator reran the original owner/port order through the normal local test path: 49 tests passed, including all nine socket-boundary cases. This overlaps the 175-test run; it is not an extra 49 unique tests.
All passed, along with targeted formatting and docs review. Full build completed in 5m 7.3s; existing dependency direct-eval warnings were nonfatal. Fresh independent P1 autoreview found no actionable findings (correct, confidence 0.96).
Exact-head CI 33040754720 is green on
4d129de6de72aa266da955775ed555ed30e4ad4f. Native review artifacts validate atREADY FOR /prepare-pr; current-main comparison found no changes in the affected owner/tests/docs. The earlier draft-only CI was skipped and is not counted as proof. The latest ClawSweeper comment remains a review-started placeholder, with no published verdict/rank-up list; it is not counted as completed review.Production +1/-1, net zero; tests +21/-8; docs +2/-0. Tests extend existing error/follow and WebSocket fixtures without a new production seam. No schema, protocol, configuration, dependency, or persistence change. AI-assisted repair; release-note context is the restored diagnostic behavior above.
Documentation: https://docs.openclaw.ai/cli/logs.