You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cli: select the remote connection record and provider once, before authentication #4858
A command that materializes a remote connection can check one provider at admission and then use a different connection record at materialization, because the effective state directory changes between the two steps.
Repro from the review:
Connect session ci in state directory B with a profile whose stateDir is B and leaseProvider is limrun.
Change that profile's provider to cloud. Connect ci in directory A with --state-dir A. Leave the B record in place.
Run AGENT_DEVICE_STATE_DIR=A agent-device apps --session ci with no Limrun plugin and no token.
Defaults come from the A record, but the profile's stateDir replaces the environment default during the merge (src/cli.ts around lines 399-415 and 839-849). Admission checks cloud from A and the auth step returns UNAUTHORIZED. With auth available, materialization reads the Limrun record in B and refuses it only afterward (src/cli/commands/connection-runtime.ts 57-88, 186-192).
Required behavior
The provider and the record that materialization will use are selected once, before authentication, from the effective state directory and session. That selection is passed into materialization. The stored provider takes precedence over the profile fallback (#4846 already gives admission and materialization one shared precedence helper).
Completion conditions
A test with two state directories and a profile edited between connects: admission, authentication and materialization all use the same record; a missing plugin for that record reports the install command before any authentication.
No second read of the state directory default between admission and materialization.
The issue reports that a remote CLI command can check one provider at admission while materialization later reads a different record because the effective state directory changes, with concrete repro steps and a required fix for selecting provider and record once before authentication.
Activity
apex-sentinel-staging commentedon Nov 20, 2026
Apex Sentinel · Issue review
Suggested label:
bugThe issue reports that a remote CLI command can check one provider at admission while materialization later reads a different record because the effective state directory changes, with concrete repro steps and a required fix for selecting provider and record once before authentication.
Required sections