Skip to content

fix(cli-rs): port the auth login order, AppImage env and run stdin abort - #67729

Merged
simonklee merged 3 commits into
devfrom
backport-95-96
Dec 2, 2026
Merged

simonklee merged 3 commits into
devfrom
backport-95-96

Conversation

@simonklee

@simonklee simonklee commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

What it does

Brings the native client level with three recent dev changes. Each is its own commit.

Checks

  • auth.rs priority rows and the C.5/login-order P-CLI scenario; spawn.rs test for the stripped variables and C.13/service-start, C.13/service-restart, C.8/start-running, C.8/status-*; a run.rs unit test and a new C.10/sigterm-stdin scenario (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.

Ports 2c3c40e (#67597) from the TypeScript CLI: add google-ai-plan at index 2 of auth login's PRIORITY list (under Popular, after opencode-go and opencode, before openai) and pin the order in auth unit tests and C.5/login-order.
@simonklee
simonklee enabled auto-merge (squash) December 2, 2026 08:05
@simonklee
simonklee disabled auto-merge December 2, 2026 08:06

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 18f5774 (#67594) from packages/client/src/service-contender.ts: strip inherited APPIMAGE, APPDIR, ARGV0, and OWD in Contender::spawn before applying explicit env entries so a service started from an AppImage environment does not inherit Desktop's AppImage variables.
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.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@simonklee
simonklee merged commit 19a6b78 into dev Dec 2, 2026
11 checks passed
@simonklee
simonklee deleted the backport-95-96 branch December 2, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant