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.
All reported issues were addressed across 5 files
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Re-trigger cubic
|
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
|
|
Thanks for the update. At 913e32a, the earlier findings from #5416 (comment) are fixed. One defect remains. A second independent pass found a legacy retry path that is now stuck. An older client can be interrupted after it writes its pending reservation and before the broker creates an allocation. That record has no allocation ID, no saved connection state and no attachment (written by The open inline thread on CI is green: both checks (Proof skipping, Devin Review) pass, and no failing job overlaps the diff. No conflicts are known. Tests were not run for this review. The regression and the owner path were judged by reading the code at head and at fb6b16b. Not verified here: a bound pending record can never sit beside a saved state from an older generation; the new pairing check would refuse that state with Once the legacy retry path is fixed, nothing else stands in the way of merge. |
|
Fixed the legacy ID-less pending reservation retry path in
|
|
Thanks for the follow-up. The earlier blocker from 913e32a (#5416 (comment)) is fixed at 1efe601, but a second independent pass found one remaining problem. In cloud-connect.ts:306, take an unbound pending record with neither ID and no attachment, next to a saved connection for the same CLI session. That connection names a different hosted generation and still carries its lease ID. An older saved Limrun connection with cloudSession.transport set to "limrun" is one example. The current validator rejects that transport (remote-connection-state.ts:821-831), so the reader returns null for the existing file (remote-connection-state.ts:371-378). On a canonical 404/not_found reply, the new branch then clears the pending record, and both connect variants can go on to allocate. A successful publication removes the older state through claimSessionRecord (remote-connection-state.ts:364-368, 407-428). The shortcut sends no saved bearer, but it skips the refusal that unpaired saved state requires. At 913e32a this input still returned cloud_connection_allocation_unconfirmed. The rule: the 404 shortcut must apply only when saved state is confirmed absent. Please have the remote connection reader tell absent state apart from an existing invalid record owned by this session, using its current canonical and legacy path resolution. Keep cloud_connection_allocation_unconfirmed for an existing invalid record, and add a test with the legacy-transport file. The open inline thread on readCloudCaller (#5416 (comment)) does not apply. It is outdated: readCloudCaller is unchanged from base, and the purpose-aware read is readCloudCallerForPurpose, which only admitHostedCaller uses. Please resolve it. The code review at 1efe601 is not clean. The 2 checks pass. No conflicts. Not verified here: tests were not run, and the regression and refusal cases were judged from the 1efe601 and 913e32a code and the CLI-level tests in the delta. Not verified here: whether an older client could leave a hosted lease acquired without a recorded hostedLeaseId. If so, the clear branch drops the record without a lease release; base 17aadac also forgot that record on not_found, so this is not a regression. The merge needs the confirmed-absence fix above. |
|
@thymikee Updated in
Validated at |
|
Thanks for the quick update. The confirmed-absence problem from the earlier review is now fixed at 0590d8a. One new problem remains, so this change needs one more fix before merge. A second independent pass found that an empty legacy reservation already marked closing can no longer be cleared by retry (cloud-connect.ts#L282). An older client leaves an unbound reservation before it records an allocation ID. A retry on the base commit writes phase=closing and rollback=true before its broker lookup. If that lookup returns 500, the closing record stays with no allocation ID, lease ID, saved connection, attachment, or daemon registration. When the same account retries and the broker now returns 404/not_found, the base and the earlier head clear the reservation and continue. At this head, both The code needs that fix before it can merge. CI is green: both checks pass at 0590d8a. There are no conflicts. Once the fix is pushed and checks pass, nothing else is pending. The resolved thread on Not verified here: tests were not run locally. The regression test for the legacy transport was judged by reading the earlier head's code path (state null, clear-reservation, POST). Whether an older build can leave an ID-less unbound pending record with deadlineAt, assignment, or target set was not checked. If it can, the stricter empty-reservation check now refuses it with |
|
@thymikee Fixed in
Validated at |
|
Thanks for the update. At 3c7ac93 the earlier finding from #5416 (comment) is fixed, and no new problems were found in the change. The new test rows cover the case that was missing. CI is green: 2 checks, none failing. No conflicts are known. Nothing blocks merge. The one earlier inline thread, #5416 (comment), does not apply any more: it was resolved and outdated, and this update only touches Not verified here: the tests were not run locally, and the base-branch behavior for the closing and rollback state was not re-checked independently. A pending record with |
Summary
Fixes #5400.
Separate local cleanup admission (
clear) from credentialed access (use) inadmitHostedCallerand distinguish confirmed absence from existing invalid remote state: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.disconnectandconnectwhen admission lacks saved-credential access; unfinishedconnectcleanup verifies pairing and broker proof before teardown.observeRemoteConnectionStateseparates confirmedabsentfrom ownedinvalid(e.g. legacytransport: "limrun") andunknownacross canonical/legacy paths sonot_foundclears only empty pending orclosing+rollbackreservations.Before / after
17aadac)3c7ac9368)status/--forget)readRemoteConnectionStatereturnsnull, clearing on404observeRemoteConnectionStatereportsinvalid; keepscloud_connection_allocation_unconfirmedValidation
Tested at
3c7ac9368(0behindorigin/0.22) on Linux:pnpm run format:check,check:mcp-metadata,check:quick: exit0.pnpm exec vitest run(7 core cloud + remote suites):211/211passed.check:fallow, and device lanes.