Repository navigation
refactor(limrun): ship Limrun as the @agent-device/limrun plugin - #4846
Conversation
|
Live Limrun evidence at Setup: branch CLI ( Commands per platform: Packed check on |
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
|
Reply to the Sentinel finding "Ended Limrun lease stays stored when the command never primes the plugin store" ( The finding is correct. Route: Fixed in 82fd39f:
@apex-sentinel-staging review |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 82fd39f. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 1c803c8. The verdict and the full list are in the summary comment.
This comment has been minimized.
This comment has been minimized.
|
Reviewed 997f851: a second independent pass found three problems to fix before merge, all where Limrun is now an optional plugin and stored state or the install hint is affected. The first is in cloud-profile.ts. Run The second is in cli.ts. Take a named Limrun remote profile with an HTTP daemon URL that triggers cloud authentication, no current CLI session, and no plugin. Both The third is in connection-runtime.ts. Upgrade a state directory that has a named pending Limrun connection A and a newer providerless connection B, with no record named For a follow-up issue, not for this PR:
Not blocking, and fine to take or leave: the stored The two earlier inline threads on ended-lease policy are fixed at this head and can be resolved: #4846 (comment) and #4846 (comment). CI is unclear. The failing jobs are the advisory mutation shards kernel-errors-3 and kernel-errors-4, which this PR triggers because it touches package manifests and the lockfile. The diff does not touch Required evidence is present. Before merge, the three fixes above are needed, and the mutation shards need a re-run or an explanation. |
Mutation shards
|
|
Reply to the review of 1. 2. Provider admission after remote authentication — fixed in cf9e4d4. 3. A catalog read changing the active connection — fixed in 5d14a0d with the simpler option. The stored Known limit after dropping the field: a third-party plugin that declares Not changed, per the review: provider-name normalization, the daemon-side hint, and the plugin showing as failed without Checks on the new head: typecheck, lint, format, layering, |
This comment has been minimized.
This comment has been minimized.
|
Correction to my note above on the mutation shards: the cause of the slow test is not the 250 ms sleeps (those were already mocked). The contention loop runs 300 iterations, and each one re-reads the daemon registration; reading a held lock takes one host The fix is up as #4856 (against |
|
Two problems remain at cf9e4d4, and both are about when the CLI admits the Limrun provider. The two earlier inline threads on the ended-lease policy are fixed at this head and can be resolved: #4846 (comment) ( A second independent pass found that interactive cloud discovery saves a CLI session before it refuses Limrun. Run A second independent pass also found that an inherited profile can select a different connection during materialization (provider-admission.ts:37). Connect session Not blocking, and fine to take or leave: admission derives the provider as The code needs the two fixes above. CI shows one red check, the |
|
Scope note for the review at cf9e4d4 (#4846 (comment)):
The author's per-point reply with SHAs follows after the push. |
|
Reply to the review of Point 1, a new login saved before Limrun is refused — fixed in 2240079. The fix is in the auth-session owner. A login that One consequence to know: a Point 2, an inherited profile selecting a different connection during materialization — not fixed in this PR. 37b7e68 adds one helper, Optional items, taken in 37b7e68: the shared helper above, and Checks on the new head: typecheck, lint, format, layering, |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 37b7e68. The verdict and the full list are in the summary comment.
37b7e68 to
6d735ae
Compare
|
Update to my reply on the review of Point 1, a new login saved before Limrun is refused — fixed. The final shape is in 6d735ae (it replaces the per-site commits of the earlier push). One limit on test (c) as asked: no device command can approve a login, because only Point 2, an inherited profile selecting a different connection during materialization — not fixed in this PR. 9d55d0d adds one helper, Optional items — both taken in the same commit: the shared helper, and the Checks on 6d735ae: typecheck, lint, format, layering, |
This comment has been minimized.
This comment has been minimized.
|
The earlier findings from cf9e4d4 are fixed at 6d735ae, and a second independent pass found three login-timing defects that remain. Login is no longer discarded on non-refusal failures (auth-session.ts:91-101), A second independent pass found that cloud discovery can save a login that admission then refuses. Set the user config to valid JSON with The same pass found that admitted connect persists state and reports success before the login is saved. Create a writable private state directory with The same ordering problem affects explicit The two open inline threads on provider-selection and ended-lease handling no longer apply and can be resolved: login is no longer discarded on non-refusal failures (#4846 (comment)), CI shows 26 checks with none failing at 6d735ae. The earlier kernel-errors-4 dry-run failure was fixed upstream by #4856, which arrived with the rebase. There are no conflicts. This was a read-only review, so no local test run was done. Not verified here: that the new tests pass, which rests on green CI and the author's report. Live device evidence is from 50a0163, and the changes since then touch only CLI auth-state timing and the provider-precedence helper, so no new device run is needed. Merge needs the three fixes above, with a test for each failing route. |
|
Reply to the round-three review at 6d735ae (#4846 (comment)). No push yet; this asks for the scope decision. Classification. None of the three belongs in #4858 (that issue is the cross-state-directory record selection). All three are consequences of the deferred-login change this PR added in round two:
Two ways to resolve, maintainer's choice:
I will implement the one you choose and not push before that. |
R84 test-colocation judges a unit test against the modules beside it. `auth-login-write-timing.test.ts` sits in `src/cli/__tests__`, where no module is named `auth-login-write-timing`, and `connect-provider-credential-order.test.ts` sits in `src/cli/connection` with no such module either. Each is renamed for the module whose behavior it pins: `auth-session.ts` holds the login save timing, and `provider-admission.ts` owns the admission that precedes the credential. Part of #3311
A `connect` that learns its provider from the control plane holds the login it approves until that provider is admitted. An explicit `auth login` or `auth logout` completed in that gap was overwritten when the connect resumed, so the older approval won and a logout left the state directory signed in. Every write of one state directory's auth state now passes one guard: a revision record beside the session it governs, republished by each write. A held login reads that revision before its device authorization and saves only while it still stands, which logs the stand-down rather than failing the command. The record counts writes rather than reading the stored session, because a logout leaves no session, which is what a first login finds too. Name the Limrun plugin in the README Cloud / remote install instruction, since a clean core install refuses a Limrun profile without it. Refs #4846 (review 7068516663)
Remove the deferred-login scope and the auth revision record. A login is written when the cloud approves it, so explicit auth commands and concurrent connects keep the base ordering. The cloud route still admits a discovered Limrun provider before it generates a profile or connection record.
The Run anywhere card printed the bare package name, which the plugin store resolves to latest: the runtime-free placeholder. Use the nightly selector the docs and the CLI hints use, and point readers at the printed command.
A saved or explicit Limrun connection whose daemon is configured elsewhere was refused with plugin-not-installed before it authenticated or dispatched, which no base release did. The plugin is needed where the device is driven: keep the refusal for a direct connect and for a connection with no configured daemon, and let the daemon's own provider registration decide runtime admission otherwise. The connection's metadata is still read and saved either way.
The Limrun SDK echoes a request body in its error message, so an endpoint that answers a verification with an unlabeled body naming the API key put that key in the cause the CLI prints, which pattern redaction cannot see. Answer with the typed verification error, its status and hint, and carry no cause.
An instance that answers an authenticated download or an XCTest start with an unlabeled body naming the bearer token it was given put that token in the error details the daemon publishes. Remove each value sent to the endpoint from the response text before publishing it; the status and typed reason answer for the failure.
A remote Limrun connection whose host has no plugin was answered from generic remote capabilities, so `apps` allocated a lease, `lease_allocate` sent the daemon's default TTL, and `open <app>` dropped the initial app. The plugin catalog now carries the provider's whole declared `ConnectionProviderCapabilities` and its admission policy, and `declaredConnectionCapabilities` falls back to that copy before the daemon's own routing, so a connection's lease policy is its provider's whether or not this host loads the plugin. The predicate, its without-refusal variant and the three duplicated if/else sites collapse into `admitProviderForRoute(provider, route, env)`, which primes the store, refuses only where this host must supply the provider, and answers capabilities from the plugin when loaded, else from the catalog. `providerRouteForConnection` reads the same two settings the daemon client reads.
The SDK, an attached instance and a forwarding service in front of one all answer with their own text, and this plugin authenticates each of them with an account key or an instance token. An unlabelled echo of a bare credential survives core's pattern redaction, so each path that published peer text is closed at its owner: - Every client this plugin builds logs nothing: `off` on the organization client and `none` on an instance client, which outranks `LIMRUN_LOG`, so the SDK cannot write a failed response body that carries an account key or an instance token. - The scrubber drops a credential however brief — the reader of an attached instance accepts any nonempty token — and takes the credential out of both a header value and its bare credential. - A download publishes its typed reason, its status and a transport code: no URL, no peer body, and no fetch message, since an attached instance answers with its token as the download URL. - An account-API failure is re-raised as an `AppError` carrying status and reason before a create, an asset list, a recovery list, a reconnect lookup or a delete records or returns it, keeping the 404 answer a caller acts on. A termination reason is bounded to one line and scrubbed. - The runner's forwarded credential reaches its response, its cause and its log redaction boundary, including a credential split across stream chunks, and a `/sync` field this upload did not name stays out of the upload failure. - An instance client's own failures are answered through one wrapper, so `listApps`, `pressKey` and a remote install cannot return the peer's frame with the session token in it. Only a failure that names a sent value is re-raised, so a clean SDK failure keeps the reason and cause the command that caught it publishes.
b47f92a to
e710efb
Compare
|
Rebased through #4977 onto Layering and typecheck passed on |
Apex Sentinel · ✅ Approve · review of
|
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
|
Cleanup after merge: both worktrees used for this PR (t3-3d81a0af, t3-22e4abfd) are removed, along with their local branches ( |
* refactor(limrun): ship Limrun as the @agent-device/limrun plugin Limrun leaves the core package. The runtime, the connection, the iOS runner orchestration, the file download and the Limrun SDK dependency now live in packages/provider-limrun, published as @agent-device/limrun and installed through `agent-device plugins add`. - Core adds device capabilities to every provider `setup` host: the Android lease interactor and ADB mechanics, the shared Apple XCTest runner with its tool-provider scope, and the host's retry and archive mechanics. Each facet loads on first use. - The Android interactor is the core-owned one, bound to the lease's provider-owned executor. A host that supplies no capabilities gets a typed `provider_host_capability_missing` failure. - `connect limrun` without the plugin answers `plugin-not-installed` with the install command. The built-in candidate, its reserved id and the `@limrun/api` bundling are removed. Part of #3311 * chore(gates): admit the Limrun plugin package and its own SDK dependency The Limrun package publishes its own artifact and installs `@limrun/api` itself, so the root matches only the dependency ranges it also declares. The packed-plugin check reads a plugin's own dependencies from its fixture. The root module zones drop the removed built-in provider modules and place the provider host capabilities with the platform runtime host. * fix(connection): forget an ended lease without loading the provider plugin `close` and `session` skip connection materialization, so they never load the plugin store. The ended-lease check read the provider's declaration from that store and kept the stored lease of an installed Limrun plugin. `connect` and connection materialization now record the declaration on the stored connection. The ended-lease check reads the recorded value, so it needs no plugin, installed or not. Part of #3311 * fix(connection): keep a recorded ended-lease policy as the authority A device command after the provider's plugin was uninstalled read the plugin-less default and persisted `false` over a recorded `true`. The policy is now recorded once, from the provider's own declaration, and a provider whose plugin is not loaded records nothing. Part of #3311 * fix(connection): read an unrecorded ended-lease policy from the plugin catalog A connection stored before the policy was recorded has no value, and `close` loads no plugin store, so it kept an ended Limrun lease. The plugin catalog now carries a copy of the plugin's declaration. One lookup answers without loading a plugin: the provider's own declaration, then the catalog. A recorded value stays the authority. A test holds the catalog equal to the declarations of the workspace plugins. Part of #3311 * fix(connection): answer the ended-lease policy at the point of use Recording the policy on the stored connection made materialization write a named connection and repoint the active-session pointer on an upgraded state directory. The stored field, its writer and the extra state write are removed. The ended-lease check asks the one lookup that needs no plugin: the provider's loaded declaration, then the plugin catalog. A record that still carries the field reads as before. Part of #3311 * fix(connect): admit the provider plugin before authentication and before cloud state `connect cloud` saved a Limrun session when the control plane chose Limrun and the plugin was missing. The provider the cloud response names is now admitted after the fetch and before the profile or any state is written. `connect --remote-config` and device commands that materialize a connection started remote authentication before the provider check. The provider is now admitted first, so a missing plugin answers with its install command and no login starts. Cleanup commands admit no provider. Part of #3311 * fix(auth): keep a new connect login in memory until its provider is admitted `connect` approved a device login and wrote `auth/cli-session.json` before cloud profile discovery named the provider. With Limrun chosen and its plugin missing, the refused route left new auth state behind. A login `connect` approves is now pending in the auth-session owner. The cloud profile route stores it after it admits the discovered provider, and `connect` stores it after its provider profile resolves. This covers `connect cloud`, plain `connect`, and the route where `--daemon-base-url` starts login in the generic auth step. `auth login` stores at once, as before. Part of #3311 * refactor(connection): read the connection provider from one helper Admission read the remote config profile's provider first and materialization read the stored connection's first. Both now call `connectionLeaseProvider`: the stored connection's provider, then the profile's. The unprimed `close` test no longer rewrites records with a field no released build wrote, and its name states the catalog route. Part of #3311 * fix(auth): store a pending login unless the provider plugin is refused A `connect` that approved a device login and then failed for any reason other than provider admission, such as a failed profile fetch, stored no login, so every retry started device auth again. The login-bearing part of a command now runs in one login scope. A login approved inside it is stored when the command ends, on success or on failure. Only the typed `plugin-not-installed` refusal discards it. The scope is per command invocation, so a pending login cannot reach another command in the same process. The per-site commits are removed. Part of #3311 * fix(connect): hold a login only until its provider is admitted A `connect` saved a login it approved before it knew the provider that login was for, so a run whose Limrun plugin was missing reported success and kept a session it could not use. A pending login now exists only between its approval and the provider admission of that same run: the cloud-discovery route saves it right after the provider check, and a route whose provider is already known saves it in its auth step. No command-wide finalizer defers anything else, so explicit `auth login` saves before it reports success. The plugin store is read through `@agent-device/contracts` reasons, so both `plugin-not-installed` and `plugin-unavailable` discard the pending login and keep the install or store-repair diagnostic. The core ships no Limrun runtime, so Limrun is the only provider the CLI admits itself: it answers from the positional or the `--remote-config` profile before that run resolves a credential-bearing option or registers one for redaction. A named provider the core can supply, such as BrowserStack, keeps the admission of its connect handler, and a discovered profile keeps the cloud adapter that reads it. Part of #3311 * test(connect): name the new tests for the modules they pin R84 test-colocation judges a unit test against the modules beside it. `auth-login-write-timing.test.ts` sits in `src/cli/__tests__`, where no module is named `auth-login-write-timing`, and `connect-provider-credential-order.test.ts` sits in `src/cli/connection` with no such module either. Each is renamed for the module whose behavior it pins: `auth-session.ts` holds the login save timing, and `provider-admission.ts` owns the admission that precedes the credential. Part of #3311 * test(cli): drop an unused helper export * perf(cli): load the connect preflight and pre-command failure modules on demand * chore(release): make @agent-device/limrun public * fix(cli): keep a deferred cloud login from overwriting newer auth state A `connect` that learns its provider from the control plane holds the login it approves until that provider is admitted. An explicit `auth login` or `auth logout` completed in that gap was overwritten when the connect resumed, so the older approval won and a logout left the state directory signed in. Every write of one state directory's auth state now passes one guard: a revision record beside the session it governs, republished by each write. A held login reads that revision before its device authorization and saves only while it still stands, which logs the stand-down rather than failing the command. The record counts writes rather than reading the stored session, because a logout leaves no session, which is what a first login finds too. Name the Limrun plugin in the README Cloud / remote install instruction, since a clean core install refuses a Limrun profile without it. Refs #4846 (review 7068516663) * refactor(cli): save a connect login when it is approved, as on the base Remove the deferred-login scope and the auth revision record. A login is written when the cloud approves it, so explicit auth commands and concurrent connects keep the base ordering. The cloud route still admits a discovered Limrun provider before it generates a profile or connection record. * docs(website): list Limrun with the plugin providers on the Run anywhere card * fix(website): install the Limrun plugin the 0.22 nightly reader needs The Run anywhere card printed the bare package name, which the plugin store resolves to latest: the runtime-free placeholder. Use the nightly selector the docs and the CLI hints use, and point readers at the printed command. * fix(cli): let a remote daemon answer for a provider this host lacks A saved or explicit Limrun connection whose daemon is configured elsewhere was refused with plugin-not-installed before it authenticated or dispatched, which no base release did. The plugin is needed where the device is driven: keep the refusal for a direct connect and for a connection with no configured daemon, and let the daemon's own provider registration decide runtime admission otherwise. The connection's metadata is still read and saved either way. * fix(provider-limrun): keep a verification failure's cause in the plugin The Limrun SDK echoes a request body in its error message, so an endpoint that answers a verification with an unlabeled body naming the API key put that key in the cause the CLI prints, which pattern redaction cannot see. Answer with the typed verification error, its status and hint, and carry no cause. * fix(provider-limrun): strip the instance token from error details An instance that answers an authenticated download or an XCTest start with an unlabeled body naming the bearer token it was given put that token in the error details the daemon publishes. Remove each value sent to the endpoint from the response text before publishing it; the status and typed reason answer for the failure. * fix(cli): keep a provider's lease policy on every route A remote Limrun connection whose host has no plugin was answered from generic remote capabilities, so `apps` allocated a lease, `lease_allocate` sent the daemon's default TTL, and `open <app>` dropped the initial app. The plugin catalog now carries the provider's whole declared `ConnectionProviderCapabilities` and its admission policy, and `declaredConnectionCapabilities` falls back to that copy before the daemon's own routing, so a connection's lease policy is its provider's whether or not this host loads the plugin. The predicate, its without-refusal variant and the three duplicated if/else sites collapse into `admitProviderForRoute(provider, route, env)`, which primes the store, refuses only where this host must supply the provider, and answers capabilities from the plugin when loaded, else from the catalog. `providerRouteForConnection` reads the same two settings the daemon client reads. * fix(provider-limrun): keep credentials out of published errors The SDK, an attached instance and a forwarding service in front of one all answer with their own text, and this plugin authenticates each of them with an account key or an instance token. An unlabelled echo of a bare credential survives core's pattern redaction, so each path that published peer text is closed at its owner: - Every client this plugin builds logs nothing: `off` on the organization client and `none` on an instance client, which outranks `LIMRUN_LOG`, so the SDK cannot write a failed response body that carries an account key or an instance token. - The scrubber drops a credential however brief — the reader of an attached instance accepts any nonempty token — and takes the credential out of both a header value and its bare credential. - A download publishes its typed reason, its status and a transport code: no URL, no peer body, and no fetch message, since an attached instance answers with its token as the download URL. - An account-API failure is re-raised as an `AppError` carrying status and reason before a create, an asset list, a recovery list, a reconnect lookup or a delete records or returns it, keeping the 404 answer a caller acts on. A termination reason is bounded to one line and scrubbed. - The runner's forwarded credential reaches its response, its cause and its log redaction boundary, including a credential split across stream chunks, and a `/sync` field this upload did not name stays out of the upload failure. - An instance client's own failures are answered through one wrapper, so `listApps`, `pressKey` and a remote install cannot return the peer's frame with the session token in it. Only a failure that names a sent value is re-raised, so a clean SDK failure keeps the reason and cause the command that caught it publishes. * fix(limrun): scrub authenticated peer failures at provider boundaries * fix(limrun): redact diagnostics without changing runner replies * fix(limrun): preserve classified replies while redacting diagnostics * fix(limrun): use the shared provider diagnostics facet * fix(plugins): compose device capabilities in the root runtime
…lstack#4846) * refactor(limrun): ship Limrun as the @agent-device/limrun plugin Limrun leaves the core package. The runtime, the connection, the iOS runner orchestration, the file download and the Limrun SDK dependency now live in packages/provider-limrun, published as @agent-device/limrun and installed through `agent-device plugins add`. - Core adds device capabilities to every provider `setup` host: the Android lease interactor and ADB mechanics, the shared Apple XCTest runner with its tool-provider scope, and the host's retry and archive mechanics. Each facet loads on first use. - The Android interactor is the core-owned one, bound to the lease's provider-owned executor. A host that supplies no capabilities gets a typed `provider_host_capability_missing` failure. - `connect limrun` without the plugin answers `plugin-not-installed` with the install command. The built-in candidate, its reserved id and the `@limrun/api` bundling are removed. Part of callstack#3311 * chore(gates): admit the Limrun plugin package and its own SDK dependency The Limrun package publishes its own artifact and installs `@limrun/api` itself, so the root matches only the dependency ranges it also declares. The packed-plugin check reads a plugin's own dependencies from its fixture. The root module zones drop the removed built-in provider modules and place the provider host capabilities with the platform runtime host. * fix(connection): forget an ended lease without loading the provider plugin `close` and `session` skip connection materialization, so they never load the plugin store. The ended-lease check read the provider's declaration from that store and kept the stored lease of an installed Limrun plugin. `connect` and connection materialization now record the declaration on the stored connection. The ended-lease check reads the recorded value, so it needs no plugin, installed or not. Part of callstack#3311 * fix(connection): keep a recorded ended-lease policy as the authority A device command after the provider's plugin was uninstalled read the plugin-less default and persisted `false` over a recorded `true`. The policy is now recorded once, from the provider's own declaration, and a provider whose plugin is not loaded records nothing. Part of callstack#3311 * fix(connection): read an unrecorded ended-lease policy from the plugin catalog A connection stored before the policy was recorded has no value, and `close` loads no plugin store, so it kept an ended Limrun lease. The plugin catalog now carries a copy of the plugin's declaration. One lookup answers without loading a plugin: the provider's own declaration, then the catalog. A recorded value stays the authority. A test holds the catalog equal to the declarations of the workspace plugins. Part of callstack#3311 * fix(connection): answer the ended-lease policy at the point of use Recording the policy on the stored connection made materialization write a named connection and repoint the active-session pointer on an upgraded state directory. The stored field, its writer and the extra state write are removed. The ended-lease check asks the one lookup that needs no plugin: the provider's loaded declaration, then the plugin catalog. A record that still carries the field reads as before. Part of callstack#3311 * fix(connect): admit the provider plugin before authentication and before cloud state `connect cloud` saved a Limrun session when the control plane chose Limrun and the plugin was missing. The provider the cloud response names is now admitted after the fetch and before the profile or any state is written. `connect --remote-config` and device commands that materialize a connection started remote authentication before the provider check. The provider is now admitted first, so a missing plugin answers with its install command and no login starts. Cleanup commands admit no provider. Part of callstack#3311 * fix(auth): keep a new connect login in memory until its provider is admitted `connect` approved a device login and wrote `auth/cli-session.json` before cloud profile discovery named the provider. With Limrun chosen and its plugin missing, the refused route left new auth state behind. A login `connect` approves is now pending in the auth-session owner. The cloud profile route stores it after it admits the discovered provider, and `connect` stores it after its provider profile resolves. This covers `connect cloud`, plain `connect`, and the route where `--daemon-base-url` starts login in the generic auth step. `auth login` stores at once, as before. Part of callstack#3311 * refactor(connection): read the connection provider from one helper Admission read the remote config profile's provider first and materialization read the stored connection's first. Both now call `connectionLeaseProvider`: the stored connection's provider, then the profile's. The unprimed `close` test no longer rewrites records with a field no released build wrote, and its name states the catalog route. Part of callstack#3311 * fix(auth): store a pending login unless the provider plugin is refused A `connect` that approved a device login and then failed for any reason other than provider admission, such as a failed profile fetch, stored no login, so every retry started device auth again. The login-bearing part of a command now runs in one login scope. A login approved inside it is stored when the command ends, on success or on failure. Only the typed `plugin-not-installed` refusal discards it. The scope is per command invocation, so a pending login cannot reach another command in the same process. The per-site commits are removed. Part of callstack#3311 * fix(connect): hold a login only until its provider is admitted A `connect` saved a login it approved before it knew the provider that login was for, so a run whose Limrun plugin was missing reported success and kept a session it could not use. A pending login now exists only between its approval and the provider admission of that same run: the cloud-discovery route saves it right after the provider check, and a route whose provider is already known saves it in its auth step. No command-wide finalizer defers anything else, so explicit `auth login` saves before it reports success. The plugin store is read through `@agent-device/contracts` reasons, so both `plugin-not-installed` and `plugin-unavailable` discard the pending login and keep the install or store-repair diagnostic. The core ships no Limrun runtime, so Limrun is the only provider the CLI admits itself: it answers from the positional or the `--remote-config` profile before that run resolves a credential-bearing option or registers one for redaction. A named provider the core can supply, such as BrowserStack, keeps the admission of its connect handler, and a discovered profile keeps the cloud adapter that reads it. Part of callstack#3311 * test(connect): name the new tests for the modules they pin R84 test-colocation judges a unit test against the modules beside it. `auth-login-write-timing.test.ts` sits in `src/cli/__tests__`, where no module is named `auth-login-write-timing`, and `connect-provider-credential-order.test.ts` sits in `src/cli/connection` with no such module either. Each is renamed for the module whose behavior it pins: `auth-session.ts` holds the login save timing, and `provider-admission.ts` owns the admission that precedes the credential. Part of callstack#3311 * test(cli): drop an unused helper export * perf(cli): load the connect preflight and pre-command failure modules on demand * chore(release): make @agent-device/limrun public * fix(cli): keep a deferred cloud login from overwriting newer auth state A `connect` that learns its provider from the control plane holds the login it approves until that provider is admitted. An explicit `auth login` or `auth logout` completed in that gap was overwritten when the connect resumed, so the older approval won and a logout left the state directory signed in. Every write of one state directory's auth state now passes one guard: a revision record beside the session it governs, republished by each write. A held login reads that revision before its device authorization and saves only while it still stands, which logs the stand-down rather than failing the command. The record counts writes rather than reading the stored session, because a logout leaves no session, which is what a first login finds too. Name the Limrun plugin in the README Cloud / remote install instruction, since a clean core install refuses a Limrun profile without it. Refs callstack#4846 (review 7068516663) * refactor(cli): save a connect login when it is approved, as on the base Remove the deferred-login scope and the auth revision record. A login is written when the cloud approves it, so explicit auth commands and concurrent connects keep the base ordering. The cloud route still admits a discovered Limrun provider before it generates a profile or connection record. * docs(website): list Limrun with the plugin providers on the Run anywhere card * fix(website): install the Limrun plugin the 0.22 nightly reader needs The Run anywhere card printed the bare package name, which the plugin store resolves to latest: the runtime-free placeholder. Use the nightly selector the docs and the CLI hints use, and point readers at the printed command. * fix(cli): let a remote daemon answer for a provider this host lacks A saved or explicit Limrun connection whose daemon is configured elsewhere was refused with plugin-not-installed before it authenticated or dispatched, which no base release did. The plugin is needed where the device is driven: keep the refusal for a direct connect and for a connection with no configured daemon, and let the daemon's own provider registration decide runtime admission otherwise. The connection's metadata is still read and saved either way. * fix(provider-limrun): keep a verification failure's cause in the plugin The Limrun SDK echoes a request body in its error message, so an endpoint that answers a verification with an unlabeled body naming the API key put that key in the cause the CLI prints, which pattern redaction cannot see. Answer with the typed verification error, its status and hint, and carry no cause. * fix(provider-limrun): strip the instance token from error details An instance that answers an authenticated download or an XCTest start with an unlabeled body naming the bearer token it was given put that token in the error details the daemon publishes. Remove each value sent to the endpoint from the response text before publishing it; the status and typed reason answer for the failure. * fix(cli): keep a provider's lease policy on every route A remote Limrun connection whose host has no plugin was answered from generic remote capabilities, so `apps` allocated a lease, `lease_allocate` sent the daemon's default TTL, and `open <app>` dropped the initial app. The plugin catalog now carries the provider's whole declared `ConnectionProviderCapabilities` and its admission policy, and `declaredConnectionCapabilities` falls back to that copy before the daemon's own routing, so a connection's lease policy is its provider's whether or not this host loads the plugin. The predicate, its without-refusal variant and the three duplicated if/else sites collapse into `admitProviderForRoute(provider, route, env)`, which primes the store, refuses only where this host must supply the provider, and answers capabilities from the plugin when loaded, else from the catalog. `providerRouteForConnection` reads the same two settings the daemon client reads. * fix(provider-limrun): keep credentials out of published errors The SDK, an attached instance and a forwarding service in front of one all answer with their own text, and this plugin authenticates each of them with an account key or an instance token. An unlabelled echo of a bare credential survives core's pattern redaction, so each path that published peer text is closed at its owner: - Every client this plugin builds logs nothing: `off` on the organization client and `none` on an instance client, which outranks `LIMRUN_LOG`, so the SDK cannot write a failed response body that carries an account key or an instance token. - The scrubber drops a credential however brief — the reader of an attached instance accepts any nonempty token — and takes the credential out of both a header value and its bare credential. - A download publishes its typed reason, its status and a transport code: no URL, no peer body, and no fetch message, since an attached instance answers with its token as the download URL. - An account-API failure is re-raised as an `AppError` carrying status and reason before a create, an asset list, a recovery list, a reconnect lookup or a delete records or returns it, keeping the 404 answer a caller acts on. A termination reason is bounded to one line and scrubbed. - The runner's forwarded credential reaches its response, its cause and its log redaction boundary, including a credential split across stream chunks, and a `/sync` field this upload did not name stays out of the upload failure. - An instance client's own failures are answered through one wrapper, so `listApps`, `pressKey` and a remote install cannot return the peer's frame with the session token in it. Only a failure that names a sent value is re-raised, so a clean SDK failure keeps the reason and cause the command that caught it publishes. * fix(limrun): scrub authenticated peer failures at provider boundaries * fix(limrun): redact diagnostics without changing runner replies * fix(limrun): preserve classified replies while redacting diagnostics * fix(limrun): use the shared provider diagnostics facet * fix(plugins): compose device capabilities in the root runtime
* refactor(limrun): ship Limrun as the @agent-device/limrun plugin Limrun leaves the core package. The runtime, the connection, the iOS runner orchestration, the file download and the Limrun SDK dependency now live in packages/provider-limrun, published as @agent-device/limrun and installed through `agent-device plugins add`. - Core adds device capabilities to every provider `setup` host: the Android lease interactor and ADB mechanics, the shared Apple XCTest runner with its tool-provider scope, and the host's retry and archive mechanics. Each facet loads on first use. - The Android interactor is the core-owned one, bound to the lease's provider-owned executor. A host that supplies no capabilities gets a typed `provider_host_capability_missing` failure. - `connect limrun` without the plugin answers `plugin-not-installed` with the install command. The built-in candidate, its reserved id and the `@limrun/api` bundling are removed. Part of #3311 * chore(gates): admit the Limrun plugin package and its own SDK dependency The Limrun package publishes its own artifact and installs `@limrun/api` itself, so the root matches only the dependency ranges it also declares. The packed-plugin check reads a plugin's own dependencies from its fixture. The root module zones drop the removed built-in provider modules and place the provider host capabilities with the platform runtime host. * fix(connection): forget an ended lease without loading the provider plugin `close` and `session` skip connection materialization, so they never load the plugin store. The ended-lease check read the provider's declaration from that store and kept the stored lease of an installed Limrun plugin. `connect` and connection materialization now record the declaration on the stored connection. The ended-lease check reads the recorded value, so it needs no plugin, installed or not. Part of #3311 * fix(connection): keep a recorded ended-lease policy as the authority A device command after the provider's plugin was uninstalled read the plugin-less default and persisted `false` over a recorded `true`. The policy is now recorded once, from the provider's own declaration, and a provider whose plugin is not loaded records nothing. Part of #3311 * fix(connection): read an unrecorded ended-lease policy from the plugin catalog A connection stored before the policy was recorded has no value, and `close` loads no plugin store, so it kept an ended Limrun lease. The plugin catalog now carries a copy of the plugin's declaration. One lookup answers without loading a plugin: the provider's own declaration, then the catalog. A recorded value stays the authority. A test holds the catalog equal to the declarations of the workspace plugins. Part of #3311 * fix(connection): answer the ended-lease policy at the point of use Recording the policy on the stored connection made materialization write a named connection and repoint the active-session pointer on an upgraded state directory. The stored field, its writer and the extra state write are removed. The ended-lease check asks the one lookup that needs no plugin: the provider's loaded declaration, then the plugin catalog. A record that still carries the field reads as before. Part of #3311 * fix(connect): admit the provider plugin before authentication and before cloud state `connect cloud` saved a Limrun session when the control plane chose Limrun and the plugin was missing. The provider the cloud response names is now admitted after the fetch and before the profile or any state is written. `connect --remote-config` and device commands that materialize a connection started remote authentication before the provider check. The provider is now admitted first, so a missing plugin answers with its install command and no login starts. Cleanup commands admit no provider. Part of #3311 * fix(auth): keep a new connect login in memory until its provider is admitted `connect` approved a device login and wrote `auth/cli-session.json` before cloud profile discovery named the provider. With Limrun chosen and its plugin missing, the refused route left new auth state behind. A login `connect` approves is now pending in the auth-session owner. The cloud profile route stores it after it admits the discovered provider, and `connect` stores it after its provider profile resolves. This covers `connect cloud`, plain `connect`, and the route where `--daemon-base-url` starts login in the generic auth step. `auth login` stores at once, as before. Part of #3311 * refactor(connection): read the connection provider from one helper Admission read the remote config profile's provider first and materialization read the stored connection's first. Both now call `connectionLeaseProvider`: the stored connection's provider, then the profile's. The unprimed `close` test no longer rewrites records with a field no released build wrote, and its name states the catalog route. Part of #3311 * fix(auth): store a pending login unless the provider plugin is refused A `connect` that approved a device login and then failed for any reason other than provider admission, such as a failed profile fetch, stored no login, so every retry started device auth again. The login-bearing part of a command now runs in one login scope. A login approved inside it is stored when the command ends, on success or on failure. Only the typed `plugin-not-installed` refusal discards it. The scope is per command invocation, so a pending login cannot reach another command in the same process. The per-site commits are removed. Part of #3311 * fix(connect): hold a login only until its provider is admitted A `connect` saved a login it approved before it knew the provider that login was for, so a run whose Limrun plugin was missing reported success and kept a session it could not use. A pending login now exists only between its approval and the provider admission of that same run: the cloud-discovery route saves it right after the provider check, and a route whose provider is already known saves it in its auth step. No command-wide finalizer defers anything else, so explicit `auth login` saves before it reports success. The plugin store is read through `@agent-device/contracts` reasons, so both `plugin-not-installed` and `plugin-unavailable` discard the pending login and keep the install or store-repair diagnostic. The core ships no Limrun runtime, so Limrun is the only provider the CLI admits itself: it answers from the positional or the `--remote-config` profile before that run resolves a credential-bearing option or registers one for redaction. A named provider the core can supply, such as BrowserStack, keeps the admission of its connect handler, and a discovered profile keeps the cloud adapter that reads it. Part of #3311 * test(connect): name the new tests for the modules they pin R84 test-colocation judges a unit test against the modules beside it. `auth-login-write-timing.test.ts` sits in `src/cli/__tests__`, where no module is named `auth-login-write-timing`, and `connect-provider-credential-order.test.ts` sits in `src/cli/connection` with no such module either. Each is renamed for the module whose behavior it pins: `auth-session.ts` holds the login save timing, and `provider-admission.ts` owns the admission that precedes the credential. Part of #3311 * test(cli): drop an unused helper export * perf(cli): load the connect preflight and pre-command failure modules on demand * chore(release): make @agent-device/limrun public * fix(cli): keep a deferred cloud login from overwriting newer auth state A `connect` that learns its provider from the control plane holds the login it approves until that provider is admitted. An explicit `auth login` or `auth logout` completed in that gap was overwritten when the connect resumed, so the older approval won and a logout left the state directory signed in. Every write of one state directory's auth state now passes one guard: a revision record beside the session it governs, republished by each write. A held login reads that revision before its device authorization and saves only while it still stands, which logs the stand-down rather than failing the command. The record counts writes rather than reading the stored session, because a logout leaves no session, which is what a first login finds too. Name the Limrun plugin in the README Cloud / remote install instruction, since a clean core install refuses a Limrun profile without it. Refs #4846 (review 7068516663) * refactor(cli): save a connect login when it is approved, as on the base Remove the deferred-login scope and the auth revision record. A login is written when the cloud approves it, so explicit auth commands and concurrent connects keep the base ordering. The cloud route still admits a discovered Limrun provider before it generates a profile or connection record. * docs(website): list Limrun with the plugin providers on the Run anywhere card * fix(website): install the Limrun plugin the 0.22 nightly reader needs The Run anywhere card printed the bare package name, which the plugin store resolves to latest: the runtime-free placeholder. Use the nightly selector the docs and the CLI hints use, and point readers at the printed command. * fix(cli): let a remote daemon answer for a provider this host lacks A saved or explicit Limrun connection whose daemon is configured elsewhere was refused with plugin-not-installed before it authenticated or dispatched, which no base release did. The plugin is needed where the device is driven: keep the refusal for a direct connect and for a connection with no configured daemon, and let the daemon's own provider registration decide runtime admission otherwise. The connection's metadata is still read and saved either way. * fix(provider-limrun): keep a verification failure's cause in the plugin The Limrun SDK echoes a request body in its error message, so an endpoint that answers a verification with an unlabeled body naming the API key put that key in the cause the CLI prints, which pattern redaction cannot see. Answer with the typed verification error, its status and hint, and carry no cause. * fix(provider-limrun): strip the instance token from error details An instance that answers an authenticated download or an XCTest start with an unlabeled body naming the bearer token it was given put that token in the error details the daemon publishes. Remove each value sent to the endpoint from the response text before publishing it; the status and typed reason answer for the failure. * fix(cli): keep a provider's lease policy on every route A remote Limrun connection whose host has no plugin was answered from generic remote capabilities, so `apps` allocated a lease, `lease_allocate` sent the daemon's default TTL, and `open <app>` dropped the initial app. The plugin catalog now carries the provider's whole declared `ConnectionProviderCapabilities` and its admission policy, and `declaredConnectionCapabilities` falls back to that copy before the daemon's own routing, so a connection's lease policy is its provider's whether or not this host loads the plugin. The predicate, its without-refusal variant and the three duplicated if/else sites collapse into `admitProviderForRoute(provider, route, env)`, which primes the store, refuses only where this host must supply the provider, and answers capabilities from the plugin when loaded, else from the catalog. `providerRouteForConnection` reads the same two settings the daemon client reads. * fix(provider-limrun): keep credentials out of published errors The SDK, an attached instance and a forwarding service in front of one all answer with their own text, and this plugin authenticates each of them with an account key or an instance token. An unlabelled echo of a bare credential survives core's pattern redaction, so each path that published peer text is closed at its owner: - Every client this plugin builds logs nothing: `off` on the organization client and `none` on an instance client, which outranks `LIMRUN_LOG`, so the SDK cannot write a failed response body that carries an account key or an instance token. - The scrubber drops a credential however brief — the reader of an attached instance accepts any nonempty token — and takes the credential out of both a header value and its bare credential. - A download publishes its typed reason, its status and a transport code: no URL, no peer body, and no fetch message, since an attached instance answers with its token as the download URL. - An account-API failure is re-raised as an `AppError` carrying status and reason before a create, an asset list, a recovery list, a reconnect lookup or a delete records or returns it, keeping the 404 answer a caller acts on. A termination reason is bounded to one line and scrubbed. - The runner's forwarded credential reaches its response, its cause and its log redaction boundary, including a credential split across stream chunks, and a `/sync` field this upload did not name stays out of the upload failure. - An instance client's own failures are answered through one wrapper, so `listApps`, `pressKey` and a remote install cannot return the peer's frame with the session token in it. Only a failure that names a sent value is re-raised, so a clean SDK failure keeps the reason and cause the command that caught it publishes. * fix(limrun): scrub authenticated peer failures at provider boundaries * fix(limrun): redact diagnostics without changing runner replies * fix(limrun): preserve classified replies while redacting diagnostics * fix(limrun): use the shared provider diagnostics facet * fix(plugins): compose device capabilities in the root runtime
Summary
Limrun leaves the core package. The runtime, connection, iOS runner orchestration, download and
@limrun/apimove to@agent-device/limrun(packages/provider-limrun), installed through the plugin manager. Core adds lazy device capabilities to every providersetuphost. Without the plugin,connect limrunanswersplugin-not-installedwith its install command. Part of #3311.Auth is unchanged from the base: a login is saved when it is approved. A cloud-discovered Limrun refusal therefore keeps that login; #4940 tracks it. Preflight edge cases: #4914.
Value
Validation
Head
e710efbfa1d8cacaba69f062f7a899d52bde0005on0.22at6b86764a11. Layering and typecheck passed at this head. Build and 951 focused tests passed before the final layering correction and base refresh. Hosted CI covers the final head. Checks.The prior head
b47f92a8ffpassed 43 local gates. Its packed created-iOS run passed open, snapshot, press, and XCTest, and left an empty Limrun inventory. Review fixes and live evidence. Prior Android and token-only iOS evidence.