Repository navigation
fix(cli-rs): port the auth login order, AppImage env and run stdin abort - #67729
Conversation
ef3c3bc to
6177c23
Compare
There was a problem hiding this comment.
Looks good. I reproduced the stdin hang with the new C.10/sigterm-stdin scenario. On the base, the native run hits the shutdown deadline and exits 1 (shutdown did not finish … cancel the run). With this PR it exits 143 right away, makes only GET /api/info and creates no session, the same as TypeScript. The auth login priority matches packages/cli/src/commands/handlers/auth/login.ts, and the AppImage env stripping matches packages/client/src/service-contender.ts, with explicitly passed variables still winning. The spawn:: and commands:: tests pass, and fmt and clippy are clean.
The public API is unchanged: the regenerated client only adds 409 to the declared statuses of session.shell and experimental.session.skill in the native client.
One optional comment on the spawn.rs test; nothing blocking.
| } | ||
|
|
||
| #[test] | ||
| fn strips_inherited_appimage_env_unless_explicitly_set() { |
There was a problem hiding this comment.
Optional: this test re-runs its own test binary with an env probe so it can set the AppImage variables, which makes it hard to follow. If the code that builds the Command were split out of Contender::spawn, a short test could check Command::get_envs(): the four names show up as (name, None), and an explicit APPIMAGE overrides that. No subprocess or re-exec needed.
Ports faeb2d2 (#65910) from the TypeScript CLI: run stdin reads on a dedicated OS thread raced against the shutdown watch signal (and retry EINTR during the grace poll), returning early on abort before validating the message or preparing files so SIGINT/SIGTERM exits immediately instead of hitting the 10 s shutdown deadline.
6177c23 to
f612f23
Compare
There was a problem hiding this comment.
This push is a rebase onto newer dev. The auth-order, AppImage-env and stdin-abort commits are identical to what I reviewed, and the API-client regeneration was dropped because dev now has those 409 statuses itself. On the new head, C.10/sigterm-stdin still passes: SIGTERM with stdin left open and silent exits 143 and creates no session. The spawn:: and run/auth tests also pass.
The public API is unchanged. The earlier optional point about the re-exec test in spawn.rs is still open.
There was a problem hiding this comment.
This push takes up my earlier point. The Command setup now lives in a build_command helper, and the AppImage test checks get_envs() instead of re-running its own test binary. The behaviour is unchanged: the AppImage variables are removed first and an explicitly passed value still wins. The spawn:: tests pass, clippy and fmt are clean, and C.13/service-start still passes. The public API is unchanged.
What it does
Brings the native client level with three recent
devchanges. Each is its own commit.auth loginlists the Google AI Ultra plan second (fix(cli): rank the Google AI Ultra plan first in auth login #67597). The TypeScript CLI now ranksgoogle-ai-planright after OpenCode Go inauth login;commands/auth.rsgets the samePRIORITY. The TUI connect dialog keeps its own order (fix(cli-rs): list Google AI Ultra plan as popular in TUI connect dialog #67511), as in TypeScript.APPIMAGE,APPDIR,ARGV0andOWDon to it;service/src/spawn.rsnow removes them before the service's own environment is applied.runstops waiting on stdin when aborted (fix(cli): cancel stdin wait on abort in run #65910). With stdin open but silent, Ctrl-C or SIGTERM took effect only at the 10 s shutdown deadline. The stdin read now runs on its own thread and races the shutdown signal, an interrupted poll is retried, andrunreturns before validating the message or preparing files once it is aborted.Checks
auth.rspriority rows and theC.5/login-orderP-CLI scenario;spawn.rstest for the stripped variables andC.13/service-start,C.13/service-restart,C.8/start-running,C.8/status-*; arun.rsunit test and a newC.10/sigterm-stdinscenario (SIGTERM after the CLI's first request, with stdin open and silent: exit 143, no session).cargo fmt --check,clippy,check:drift. The merge lane's gate and full suites (P-CLI, P-PTY, ACP, P-TUI, drift, machines, Windows check, cargo deny) passed on this branch.