Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis 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.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/cli/connection/cloud-access.ts">
<violation number="1" location="src/cli/connection/cloud-access.ts:105">
P3: `readCloudCaller` now throws for an unreadable or malformed login where it used to return undefined. The disconnect path is still refused, but with `credential_mismatch` instead of the previous error, so the change alters the reported reason. Confirm the new reason is intended.</violation>
</file>
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
| ): CloudCallerIdentity | undefined { | ||
| if (!presentsCloudCredential(stateDir, env)) return undefined; | ||
| return readCallerIdentity(env, savedOrigin, readStoredCliSession(stateDir)); | ||
| const caller = readCloudCallerForPurpose(stateDir, env, savedOrigin, 'use'); |
There was a problem hiding this comment.
P3: readCloudCaller now throws for an unreadable or malformed login where it used to return undefined. The disconnect path is still refused, but with credential_mismatch instead of the previous error, so the change alters the reported reason. Confirm the new reason is intended.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At src/cli/connection/cloud-access.ts, line 105:
<comment>`readCloudCaller` now throws for an unreadable or malformed login where it used to return undefined. The disconnect path is still refused, but with `credential_mismatch` instead of the previous error, so the change alters the reported reason. Confirm the new reason is intended.</comment>
<file context>
@@ -100,8 +102,8 @@ export function readCloudCaller(
): CloudCallerIdentity | undefined {
- if (!presentsCloudCredential(stateDir, env)) return undefined;
- return readCallerIdentity(env, savedOrigin, readStoredCliSession(stateDir));
+ const caller = readCloudCallerForPurpose(stateDir, env, savedOrigin, 'use');
+ return caller === 'unverified' ? undefined : caller;
}
</file context>
There was a problem hiding this comment.
Fixed in fb6b16b22: restored readCloudCaller (and presentsCloudCredential) to base readStoredCliSession semantics, so plain disconnect with a malformed or unreadable cli-session.json keeps reporting cloud_api_key_required (covered by a regression test in src/__tests__/cli-cloud-session-identity.test.ts).
|
Thanks for the PR. Review of 1396200 found four problems that need fixes before merge. CI is green: 3 checks, none failing at this head. There are no conflicts. A second independent pass found that an expired Limrun plugin booking can still trigger authenticated provider cleanup (cloud-connection-record.ts:611). With an unverified login or an unbound booking, connection status sets mayUseSavedCredentials=false but still retires the daemon (active-connection.ts:90, cloud-plugin-attachment.ts:101). Graceful stop sends SIGTERM (daemon-process.ts:156), and daemon shutdown stops runners and finishes recordings (daemon-runtime.ts:813, session-teardown.ts:153). A ready Limrun runner then gets a shutdown POST with the saved attachment bearer (runner-transport.ts:108). An active recording calls the provider stop API and downloads with the instance token (recording-runtime.ts:87). The token can go out even if expiry makes the provider reject it. The same path is reachable before expiry when disconnect --forget admits a v1 login for a paired plugin booking and stops its daemon (cloud-connect.ts:692). The rule: a local-only admission must never invoke credential-using provider cleanup. Every path that retires a daemon after mayUseSavedCredentials is false, in the sweep and in forget, needs a retirement mode that cannot call the provider, or must remove the attachment directly. A second independent pass found that an unverifiable login can still block the local sweep (cloud-access.ts:201). Take an expired booking on cloud A, no API key, a malformed or unreadable cli-session.json, and AGENT_DEVICE_CLOUD_BASE_URL set to cloud B. The code checks the configured origin before it classifies the login as unverified, so resolveHostedOrigin throws (cloud-access.ts:276) and the sweep skips cleanup (active-connection.ts:119). v1 logins hit the same path. At base this took the no-credential path and removed the attachment. For clear, please classify an unverified login without an API key before validating the configured credential origin, and keep the origin checks for API keys and verified logins. A second independent pass found that the sweep discards the token before an explicit teardown can verify ownership (cloud-connection-record.ts:609). An expired unbound proxy-front booking has paired saved state and a front lease that can still be released. The owner runs plain disconnect with the owning key, and the broker lookup returns the matching booking ID, including a settled one (cloud-connect.ts:285, cloud-session-api.ts:212). Base keeps the sidecar for this teardown. At head the pre-command sweep removes it first (active-connection.ts:48), so teardown treats the missing sidecar as success and sends no release (cloud-connect.ts:416). A committed connect cloud --force replacement does the same (connection-hosted.ts:249), and plain disconnect also skips the release confirmation it required before (cloud-connect.ts:368). The front lease can stay active until its TTL. The selected unbound booking's sidecar should be left for an explicit teardown that verifies ownership with the broker. Local-only sweeping can stay for other expired bookings and ordinary session activity. A second independent pass found that a malformed login now blocks recovery of an orphan attachment (cloud-access.ts:173). With no API key, a cli-session.json containing only One lower-priority inline thread still applies (discussion covers the malformed-login behavior change). No open thread is outdated. Not verified here: the base behavior for malformed and unreadable logins (PR body row 1) comes from reading 17aadac, not from a run. Not verified here: whether stopping a hosted plugin daemon through retireExpiredDaemon makes it release its provider lease with its own credentials. Not verified here: the author's local validation commands. After the four fixes land, a re-run of CI at the new head and a check of each repro above should confirm them. |
…bound teardown sidecars
|
Addressed all four findings and the inline thread in
Added regression tests covering each case in |
|
Thanks for the fixes. The four findings from the earlier review (#5416 (comment)) are now fixed at fb6b16b. A second independent pass found one remaining problem in the unfinished connect path. Take a selected expired, unbound proxy-front booking in pending or closing phase, with no broker-release proof, a paired saved connection, and a saved grant or proposed lease ID. Run The open inline thread on CI shows both checks passing at fb6b16b, and there are no conflicts. Not verified here: the tests were not run; the regression coverage for the earlier findings was judged by reading the code paths the tests exercise. Not verified here: a hosted Limrun daemon left running after a local-only forget or sweep, then connected again. The next step before merge is to fix the finding above. |
|
Addressed the unfinished
|
Summary
Fixes #5400.
Separate local cleanup admission (
clear) from credentialed access (use) inadmitHostedCaller:clear, classify unverifiable logins (stale v1, malformed, or unreadable) without an API key before origin validation (mayUseSavedCredentials: false); keep origin checks for API keys and verified logins.disconnect --forgetskipsstopHostedPluginDaemonwhile warning if a daemon registration remains.disconnectandconnect; unfinishedconnectcleanup verifies saved-state pairing and broker ownership before any lease teardown or broker delete.clearandreadCloudCallerkeep basereadStoredCliSessionsemantics so malformed/unreadable logins recover orphans and reportcloud_api_key_requiredondisconnect, while stale v1 stays refused.Before / after
17aadac)913e32ae1)statusor--forget)disconnect/connect(--force) on expired unbound proxy-frontValidation
Tested at
913e32ae1(0behindorigin/0.22) on Linux:pnpm run format:check,check:mcp-metadata,check:quick,pnpm build: all exit0.pnpm exec vitest run(9 cloud suites):194/194passed.check:fallow, and device lanes.