Repository navigation
fix(nix): upgrading moq-auth restarts the relay through its handoff - #9065
Conversation
Quest-Claim: dc822df6ab09e555
moq-auth is required by the relay and stopped on change, so nearly every switch stopped it and the stop propagated to the relay, which drained every session and bound cold. Restart it in place instead: the restart propagates as a restart, which the relay survives through SIGUSR2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. WalkthroughThe Merge Risk:
|
There was a problem hiding this comment.
ℹ️ No critical issues — one comment nit inline.
Approach: sound — stopIfChanged = false turns moq-auth's switch-time stop into a restart, which systemd propagates to the required relay as a try-restart, so a handoff relay hands over its sockets instead of draining.
Reviewed changes
moq-authrestarts instead of stopping —nix/modules/moq-relay.nixsetsstopIfChanged = false, so an upgrade that changes itsExecStart(themoq-clistore path) no longer stops the unit, andRequires=no longer propagates that stop tomoq-relay.- Quest file removed —
quest/m1/precut-fixes/nix-auth-restart.mdis deleted as the quest lands, matching how other precut fixes land.
I traced the mechanism through the flake's nixpkgs (systemd-lib.nix emits X-StopIfChanged=false, switch-to-configuration-ng's handle_modified_unit schedules a restart job for it) and systemd (transaction.c propagates JOB_RESTART along UNIT_ATOM_PROPAGATE_STOP as JOB_TRY_RESTART, and UNIT_REQUIRED_BY carries that atom), so the restart does reach the relay and the ordering follows after = [ "moq-auth.service" ]. Setting it unconditionally is also right: with handoff off the relay gets a cold restart rather than the old propagation stopping it, which is strictly better.
deepseek-v4.1-flash | 𝕏
…h handoff on Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — since the prior pullfrog review at e25c3210e, the delta is two comment lines in nix/modules/moq-relay.nix; the code hunk and the quest file deletion are unchanged.
- Reworded the
stopIfChanged = falsecomment to scope the session-preserving behavior to a handoff relay, noting the restart is cold otherwise. This resolves the earlier inline nit, and the new wording matches the systemd propagation path:moq-auth's restart reaches the required relay as a try-restart, which is a socket handoff only whenRestartKillSignal = SIGUSR2is set forhandoff = true.
deepseek-v4.1-flash | 𝕏

Problem
With
services.moq-relay.handoffon,moq-authisrequiredBythe relay and kept the defaultstopIfChanged = true. ItsExecStartnames themoq-clistore path, so nearly every upgrade changes it. When you switch,moq-authstops,Requires=passes the stop on to the relay, and the relay drains every session and starts with no handoff.Approach
moq-authnow setsstopIfChanged = false. A switch restarts it in place, and the restart reaches the relay as a restart job. The relay already handles a restart through its handoff (RestartKillSignal = SIGUSR2). This is set without a condition: when handoff is off, the relay restarts cold either way.Impact
moq-authkeeps the relay's sessions. A switch that changes onlymoq-authnow restarts the relay through its handoff instead of stopping it.Alternatives
wantsinstead ofrequiredBy: rejected by the maintainer (moq-dev/moq#9010). It lets the relay run with no auth server, and the relay then refuses every session.Validation
There is no NixOS VM test for the module, so I wrote a throwaway
runNixOSTest(not checked in). The node runs the module withhandoff = true,auth.enable = true, andtls.generate = [ "localhost" ]. Anextspecialisation changes both units' environment, and the test switches to it withswitch-to-configuration test.stopping the following units: moq-auth.service/restarting ...: moq-relay.service/starting ...: moq-auth.service. The old relay loggedshutdown signal received; draining sessions(SIGTERM). The new one loggedno relay to take over from; binding every listener. The test's wait for a handoff timed out.restarting the following units: moq-auth.service, moq-relay.service. The stand-in loggedleaving the relay to drain beside the one replacing it. The new relay loggedtaking over from the relay already servingandserving beside the relay this one replaces; it drains now. The old one loggedhanded every socket to the relay taking over sockets=4. The test passed.just checkpassed.Caused by
moq-authstayed a required unit withstopIfChanged = true, so its stop cut the relay (found by check: 2026-11-17 pre-cut correctness audit)Follow-ups
None.
Models
Size: XS
Implementer: Claude Code, claude-opus-5-5, unknown effort (arm B)
Implementer: Claude Code, claude-opus-5-5, medium effort (iterate, XS, arm B)
🤖 Generated with Claude Code
(Written by Opus 5.5)
Review
Rewritten by
quest reviewafter each round.Head: 2273970
Base: origin/main at 4bcae73
Risk: medium,
the base has no RISK.md to name what is always high or customer-facing, so every change is mediumClassified: medium by default
Reviewer: Codex, gpt-6.1-sol, medium effort
Session:
01a1ecef-50fe-72c1-a34c-dfaca05d75f9, round 2Score: 9/10,
The only change since the last review clarifies that session preservation requires handoff, with no actionable defects found; runtime validation remains unverified.Rounds: 2; first round 0; findings 0: fixed 0, refuted 0, open 0
Findings: none