Repository navigation
fix(cli): allow /cancel during an active coding-agent run - #7
Conversation
The interactive coding-agent-cli advertised /cancel, but the REPL awaited sendPrompt before the next question, so /cancel always ran after currentRun was cleared. Keep reading slash commands while events stream, cancel on SIGINT, and cover the path with a hanging-run REPL drive. Signed-off-by: Sebastien Tardif <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 5, 2026, 4:15 PM ET / 20:15 UTC. ClawSweeper reviewWhat this changesThe branch keeps the coding-agent CLI responsive during runs, handles cancellation and terminal shutdown, adds regression coverage and documentation, and includes dependency updates already present on main. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main still blocks command input during runs. The revised implementation resolves the three prior findings, and the new terminal evidence supports the changed CLI behavior. No blocking defect remains. Priority: P2 Review scores
Verification
How this fits togetherThe coding-agent CLI is a copyable terminal example that sends prompts through the cookbook’s workspace SDK shim. It streams run events and accepts commands to cancel work or close the client. flowchart TD
A[Terminal input] --> B[CLI command loop]
B --> C[Create agent run]
C --> D[Stream events and result]
B --> E[Cancel active or starting run]
E --> C
B --> F[Close terminal and client]
D --> G[Terminal output]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Keep cancellation within the existing CLI and SDK run API, preserving responsive input, retryable abort errors, and orderly client shutdown. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s input loop cannot read /cancel until the active run finishes; the supplied baseline PTY trace confirms that sequence. This review did not execute the CLI. Is this the best way to solve the issue? Yes. Decoupling prompt execution from terminal input fixes the owning layer, and the follow-up handles creation races, abort failures, and shutdown without adding a competing cancellation API. AGENTS.md: not found in the target repository. Codex review notes: model internal, reasoning medium; reviewed against afff52646498. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (15 earlier review cycles; latest 8 shown)
|
|
Live proof for This drove the actual compiled
Maintainer fixes preserve the original contributor commit and add an Unreleased thank-you to @SebTardif. No merge or release performed. |
The interactive Coding Agent CLI awaited each run before reading the next command, so the advertised
/cancelcould never reach active work. This PR keeps input available while streaming, retains cancellation requested during run creation, reports abort failures without terminating the terminal, and closes readline/the SDK client on idle Ctrl+C or EOF.The maintainer follow-up uses readline's line iterator to settle shutdown, deduplicates concurrent cancellation attempts, preserves retry after failure, and resolves the executable path before the direct-run check so symlinked invocations work. One-shot mode is preserved. The contributor's original commit remains in the branch, with thanks @SebTardif in Unreleased.
Validation on macOS / Node 24.20.0:
pnpm checkpassed: formatting, lint, types, all 17 tests, docs, four starter builds, and both compiled CLI smokes.node .../sdk/coding-agent-cli/dist/index.jsthrough the macOS/tmpsymlink. Baseline ignored/cancelduring the stream and later printedNo active run.The patched CLI invoked cancellation while streaming, printedaborted, thenrun.cancelled/status: cancelled, and exited 0.Prepared for maintainer approval; not merged. CLI JSON redaction remains a separate concern in #8.