Repository navigation
fix(cli): render task flow JSON failures - #127080
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 21, 2026, 4:34 AM ET / 08:34 UTC. ClawSweeper reviewWhat this changesThis PR makes a missing TaskFlow lookup emit the standard JSON CLI error in JSON mode while preserving human-mode errors and keeping terminal reset bytes off JSON stdout. Merge readinessKeep open. The branch fixes current main’s missing-TaskFlow JSON failure path, and the prior sibling terminal-reset finding is addressed on the latest head; no blocking patch defect was found. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe task CLI resolves task or TaskFlow lookups and formats results for either people or automation. Lookup failures pass through the runtime exit path, whose terminal cleanup must not corrupt JSON written to stdout. flowchart LR
A[CLI lookup request] --> B[Task or TaskFlow command]
B --> C{Lookup found?}
C -->|Yes| D[Render command result]
C -->|No| E[Canonical CLI failure]
E --> F[JSON stdout or human stderr]
F --> G[Terminal cleanup]
G --> H[Exit status]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +5, Tests +46. Total +51 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the lookup-owner split: reuse the canonical failure formatter for JSON mode, retain human stderr otherwise, and preserve the focused built-CLI regression as the durable contract. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s TaskFlow lookup branch ignores JSON mode, and the added built-CLI case provides a deterministic missing-lookup command; it was not executed during this read-only review. Is this the best way to solve the issue? Yes. The repair belongs in the TaskFlow lookup owner and reuses the direct-task canonical failure formatter; changing generic runtime exit behavior would incorrectly make command-output policy global. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 627f862e8e64. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
Land-ready review complete. The final branch repairs the full task-family invariant: missing TaskFlow and direct-task lookups emit canonical JSON failures, exit 1, and route terminal reset bytes to stderr in JSON mode. Human-mode stderr and cleanup behavior remain unchanged. Production delta is +10/-5 (net +5); tests are +46/-0. Proof:
ClawSweeper findings addressed:
The exact-head ClawSweeper re-review is still publishing. Per repository policy, a late re-review does not block landing once all prior actionable findings are addressed and exact-head CI is green. |
|
Merged via squash.
|
* fix(cli): render task flow JSON failures * test(cli): stabilize entry console capture * fix(cli): keep JSON terminal resets off stdout * fix(cli): keep task JSON resets off stdout
What Problem This Solves
Fixes an issue where
openclaw tasks flow show <missing> --jsonexited with empty stdout and a human-only stderr message, leaving automation without a parseable failure document.Why This Change Was Made
The TaskFlow lookup owner now follows the existing sibling
tasks showcontract: JSON mode writes the shared canonical CLI failure envelope before exiting, while human mode retains the same stderr text and exit status.User Impact
Scripts and agents can reliably parse missing TaskFlow lookups as one JSON document instead of receiving no machine-readable output.
Evidence
{ "ok": false, "error": { "type": "cli_error", ... } }document.node scripts/run-vitest.mjs test/cli-json-stdout.e2e.test.ts -t 'renders a missing TaskFlow as one canonical JSON document without stderr'— passed on the final rebased head.node scripts/run-vitest.mjs src/commands/flows.test.ts src/cli/program/register.tasks.test.ts— 70 passed.entry.run-main.test.tsinstalled itsconsole.errorspy before the production path could install console capture. The test now establishes that precondition first without weakening its assertions; the refreshed compact shard is green.process.stderr, with focused owner-boundary coverage.AI-assisted: yes. I reviewed the implementation and validation results.