Repository navigation
fix(cli): prevent login command from hanging after successful auth - #80
Merged
Brooooooklyn merged 1 commit intoApr 3, 2026
Conversation
Brooooooklyn
deleted the
04-03-fix_cli_prevent_login_command_from_hanging_after_successful_auth
branch
April 3, 2026 13:30
cpojer
pushed a commit
that referenced
this pull request
Sep 11, 2026
When a WebSocket Durable Object class disappeared from the deploy
manifest (e.g. due to a build artifact change, manifest corruption,
or intentional removal), enrichWebSocketManifest() would emit a
`deletedClasses` migration step. Cloudflare interprets `deleted_classes`
as an irreversible destruction of the DO namespace and all its stored
data — active connections immediately fail with "Durable Object
Namespace was deleted".
Per Cloudflare's documentation: "Do not run a Delete migration on a
class without first ensuring that you are not relying on the Durable
Objects within that Worker anymore." Deletion should be an explicit,
opt-in action (like wrangler's --delete-class flag), never automated.
This change:
- Removes `deletedClasses` computation from `enrichWebSocketManifest()`
- Removes `deleted_classes` emission from `buildWebSocketUploadMigrations()`
- Computes `newClasses` against the full migration history (all classes
ever created via `newClasses`), not just the previous manifest's class
set. This prevents re-emitting `new_classes` for a class that was
previously created, temporarily removed, then re-added — which
Cloudflare rejects with "Cannot apply new-class migration ... already
depended on existing Durable Objects"
- Skips emitting a migration step entirely when there are no genuinely
new classes (avoids empty `{}` steps sent to Cloudflare)
- Classes removed from the manifest are simply dropped from the class
list without destroying their Cloudflare namespace. Orphaned
namespaces are harmless and can be cleaned up explicitly later.
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
cpojer
added a commit
that referenced
this pull request
Sep 28, 2026
Brooooooklyn
added a commit
that referenced
this pull request
Nov 24, 2026
…, show the last bypass - waiting_scan copy (API and CLI) says when it waits for a deploy going live or for the project's Zero Trust row, not only for a scan (#75, #86). - The CLI bypass sends the request it saw; the route takes `requestId`, so a bypass that loses to a protect gets 409 `public request closed` with its state instead of "no public request ... run public" (#72). - Bypass refusals keep the API code, status and blockers in `--json` (#93). - GET /projects/:id/zero-trust returns `lastBypass` (reason for deploy and up) and `zero-trust status` prints a "Last bypass" line (§13.3). - `protect` that cancels an open request prints "Public request canceled. <slug> stays protected."; a held `public` prints the CLI request lines and "Check it: void project zero-trust status" (§11.4, §13.3, #80). - A public-only Zero Trust switch with the gate on is refused with 409 `security public gate on` before the existing-projects check (#64). - Copy nits: "finishes" for one going-public project, the requester in the cancel preview, "failing since" from a stored start of the probe failure, bypass during a Zero Trust change says "Try again after it ends", and a passed request drops its held reason (#65, #87, #89, §5.2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Unref incoming sockets on the OAuth callback server so the process exits immediately after login completes, instead of waiting for the browser's HTTP keep-alive connection to time out
Root cause
After a successful login,
server.close()stops accepting new connections but doesn't close existing ones. The browser's keep-alive connection keeps the socket alive, which keeps the Node.js event loop running — causing the CLI to hang for several seconds after printing "Token saved."Fix
socket.unref()on each incoming connection tells Node.js not to keep the process alive solely for that socket. Afterresolve(token)and the remaining CLI output (saveToken,outro), the event loop has nothing left to do and the process exits cleanly.