Repository navigation
fix(cli): moq auth serve stops on SIGTERM and SIGINT - #5346
Conversation
A lone `auth` stage returned before `drive()`, so it never installed the shutdown handlers. As PID 1 in the release image the kernel drops an unhandled SIGTERM, and every container stop waited out the grace period before SIGKILL. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis 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. |
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 529fe5e
One actionable regression below. Reusing the existing shutdown helper and polling it before server startup is a good, minimal direction; restrict it to auth serve so the synchronous auth commands retain their termination behavior. No public API expansion or graceful-drain machinery is necessary for this fix.
Verification: inspected all five changed files and surrounding auth dispatch, blocking input helpers, shutdown helper, and TCP/Unix serving paths through GitHub. Tests and container/PID-1 behavior were not executed. No prior review bearing this marker or matching independent finding was present at the final state/head/review check.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 529fe5e51f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughThe auth serve command now runs its server concurrently with a shutdown signal and returns when either completes. Unix integration tests send SIGTERM and SIGINT to the serve process and check for a successful exit. Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to The new Pre-merge checks |
|
`auth sign` and `verify` block on stdin, so an installed handler swallowed the signal that used to end them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kixelated
left a comment
There was a problem hiding this comment.
Automated review by review (OpenAI)
Reviewed commit: 98bbba0
Reviewed the two-file update since 529fe5e; the PR base is unchanged. The prior stdin/signal finding, also reported independently, is fixed in code: auth.rs:29–33 now installs handlers only in Command::Serve, and main.rs:307 directly awaits the other auth commands again. The biased polling order still installs the handlers before serving starts.
No new actionable bugs found. This is the simpler, appropriately scoped fix; no additional shutdown abstraction is needed.
Verification limits: GitHub source/diff review only; I did not execute tests or PID-1 checks. The stdin regression has no automated test; the author's manual SIGTERM result is reported in the existing thread, not independently reproduced here.
|
Merge summary: the OpenAI and Codex P2 (handlers swallowing signals for (Written by Claude Opus 5.5) |
|
Dequeued by the merge queue: (Written by Claude Opus 5.5) |
Problem
moq auth serveignores SIGTERM when it runs as PID 1, which is how theFROM scratchrelease image runs it. A loneauthstage returns frommainbefore reachingdrive(), so it never installs the shutdown handlers, and the kernel drops a signal that has no handler when the target is a namespace's PID 1. As a result,podman stopwaits out its 10 s grace period and then SIGKILLs the server, and every Kubernetes pod stop waits outterminationGracePeriodSeconds. Outside PID 1 the bug is hidden, because the process dies from SIGTERM's default action.Approach
auth serveracesshutdown_signal()(the helperdrive()uses) and returnsOk(())on the signal.biasedmakes sure the handlers are installed beforeservelogs that it is listening. The otherauthverbs keep default signal handling:signandverifyblock on stdin, where an installed handler would swallow the signal.rs/moq-cli/tests/auth_serve.rs(unix only) spawnsmoq auth serve, waits for the listening log line, sends SIGTERM (and, in a second test, SIGINT), and asserts exit 0. Without the fix, the process dies by the signal.serveruns until killed" is updated.Impact
moq auth servenow exits 0 on SIGTERM/SIGINT instead of dying by the signal.Alternatives
Server::router()plus axum'swith_graceful_shutdownin the CLI: in-flightconnect/revalidate/endcalls would finish, at the cost of duplicating moq-auth's two serve helpers. Not done, because those calls are short anddrive()drops its tasks on a signal too.moq_auth::serve::Server::serve/serve_unix: the cleanest library shape, but a breaking moq-auth API change for a CLI bug.Follow-ups
releaseas a cherry-pick PR once this merges, so the published image stops cleanly.publish::tests::ts_passthrough_crosses_a_relay_through_a_flagged_jumpflaked once locally (already tracked byquest/m1/test-flakes-2/ts-passthrough-jump.md).(Written by Claude Opus 5.5)
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.