Repository navigation
[Discovery] CLI: pascal architect run/status/cancel - #1111
Conversation
Aymericr
left a comment
There was a problem hiding this comment.
Docs review (README vs code). Looks accurate overall; a few fixes:
- Statuses: write
in_progress(that's what--jsonreturns). Suggest: "…queued,in_progress(shown as "in progress"),completed…" --max-credits: suggest "Stop the run before it spends more thanncredits (positive integer); sent asmetadata.pascal_max_credits." Matches the help text and doesn't overpromise, since paid service tools are billed separately.- Add the missing errors:
architect_insufficient_credits(account lacks credits),architect_run_not_found(no run with that ID visible to this key),architect_stream_interrupted(connection dropped but the run continues; check withpascal architect status <id>). All exit1. ARCHITECT_HELPlinks to/docs/developers/mcp; point it tohttps://editor.pascal.app/docs/developers/cli, which will be live before release.- Nit: Ctrl+C before the run is confirmed also exits
130with no run ID.
I'll publish docs/developers/cli.mdx once this merges and ships to npm.
7ee7040 to
6692cac
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6692cac. Configure here.
| } finally { | ||
| signal.removeEventListener('abort', abort) | ||
| reader.releaseLock() | ||
| } |
There was a problem hiding this comment.
Open stream keeps the CLI running
High Severity
After a terminal SSE event or a stream error, readServerSentEvents releases the reader lock without cancelling the fetch body. Node's fetch then keeps the HTTP connection open, so the process can sit there after it has already printed the result or the error and set exitCode.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 6692cac. Configure here.
| } | ||
| if (!type.startsWith('response.') || !isRecord(event.response)) continue | ||
| const run = toArchitectRun(event.response) | ||
| if (!run) throw invalidResponse() |
There was a problem hiding this comment.
Stream errors drop the run ID
Medium Severity
After a run has started, a malformed SSE event throws invalidResponse without the run ID and tells the user to try again. The background run keeps going and there is no list command, so a retry starts a second run while credits keep getting spent on the first.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 6692cac. Configure here.


What does this PR do?
Adds three commands to
@pascal-app/cli. Together they form a thin client over Pascal's hosted OpenAI-compatible Responses API (https://editor.pascal.app/api/v1/responses), authenticated with the agent'sPASCAL_API_KEY:pascal architect run "<brief>"creates a background run (background: true,store: true) and streams it over SSE while you stay attached. Text deltas go to stdout and progress goes to stderr. Ctrl+C detaches without cancelling (exit 130).--detachqueues the run and returns its ID straight away.--effort low|medium|high|proselects thearchitect-<effort>model. Without it, the run usesarchitect.--project <id>is sent asmetadata.project_id.--max-credits <n>is sent asmetadata.pascal_max_credits.--jsonprints a stable run object (schemaVersion: 1).pascal architect status <id>callsGET /responses/{id}.pascal architect cancel <id>callsPOST /responses/{id}/cancel.Errors. A
503withexecutor_unavailable, sent either as an HTTP error or as an SSEerrorevent, becomesarchitect_executor_unavailable, with a message saying no run was started. That error exits with75(EX_TEMPFAIL); so do 429 and other 503s, so scripts can tell when retrying will help.401and403point you topascal agent status. The CLI never echoes the key or the server's HTTP error bodies, and it strips control sequences from server text before printing it.Shared code.
agent-account.tsnow exportsrequireAgentApiKey, used by both the agent and architect commands.Docs. Only the CLI README changed, per the docs owner. It says the commands ship in the next
@pascal-app/clirelease after 1.0.5 and gives no credit estimates.How to test
cd packages/cli && bun test srcshould report 137 passing tests, including the newarchitect.test.tsand the CLI process tests incli.test.ts.bun run build, thennode dist/bin/pascal.js architect --helpshould print the architect usage.node dist/bin/pascal.js architect run "x" --effort maxshould fail withinvalid_optionand exit 2.PASCAL_API_KEY=sk_test_fake node dist/bin/pascal.js architect status resp_probe --jsonshould returnarchitect_unauthorized(HTTP 401) from the live endpoint.pascal architect run "A small cabin" --effort lowshould stream output; press Ctrl+C, thenpascal architect status <id>.Ran after rebasing onto main (CLI 1.0.5):
bun run check-typesandbun run buildinpackages/cli,bun test src(137 pass), and the repo-levelbun run check(passes with warnings only). Step 3 was run by hand. Step 5 was not run, because no real agent key was available.Screenshots / screen recording
N/A — non-visual change
Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
New hosted API surface authenticated with PASCAL_API_KEY and credit-spend metadata; mitigations include credential stripping from env, no echo of keys or error bodies, and input/output bounds.
Reviewed by Cursor Bugbot for commit 6692cac. Bugbot is set up for automated code reviews on this repo. Configure here.