Repository navigation
Conversation
Afloat16
marked this pull request as ready for review
November 25, 2026 06:07
There was a problem hiding this comment.
Approve with nits (1 P3)
Scope: base main, merge base 77abdcb3, 1 commit, 3 files reviewed (apps/node-services/src/voice/service.ts, its test, apps/node-services/AGENTS.md). Helper skills loaded: ponytail-review. coderbook and karpathy-guidelines were not loaded this run, so their criteria were applied from the review procedure's summary only. Ran in a separate session.
Findings
P3
apps/node-services/src/voice/service.ts:390: the finalentry.childGeneration === generationcheck is redundant.entry.childGenerationis assigned only inspawnWorker, together withentry.child = child(service.ts:273-274). The probe only runs when the snapshot already hadentry.childGeneration === generation(service.ts:376). So ifentry.child === childstill holds at the end,childGenerationcannot have changed. Deleting the line leaves behavior unchanged. Optional: the old comment "a replaced worker may still answer until it exits" explained why the generation check exists, and something like it could go back next to the pre-probe check.
Verified as fine
- Rotation or removal during the batch:
applybumpsentry.generationfor every worker whose key digest changes, including when the key is removed (service.ts:290-292). The post-probeentry.generation === generationcheck therefore rejects a rotated or removed worker even while its old child is still draining. - Child exit or restart with the same key: the exit handler clears
entry.child(service.ts:281), and a restart assigns a new child object (service.ts:273). In both casesentry.child === childfails. - Newly wanted worker: the
wantedWorkers().length === checked.lengthcheck catches an addition. If one worker is removed and another added during the same batch, the count stays equal, but the removed worker's generation bump still fails the check. - Both callers benefit:
workersReadyfeeds both thereadinesshook (service.ts:451-454) andreconcileAndWait(service.ts:398-418). A rejected stale result there only causes another poll before the deadline. - No extra probes or network calls: probe count and timing are unchanged. The new checks read only in-memory state, as the PR says.
- Tests: the 4 new cases have no sleeps. They hold the probe promise and release it after the change, which exercises the real race window. I confirmed they fail on the base
service.ts(4 failed, 20 passed) and pass on the head (24 passed). - Docs:
apps/node-services/AGENTS.mdrecords the invariant. No CJK in added lines or the commit message, and the commit follows Conventional Commits.
Process notes
- The branch is 335 commits behind
main.mainrequires an up-to-date branch, so it needs a rebase before merge.
CI
- PR CI:
changes,repository-gateandcheck (web)pass. Every other app check was skipped by the path filter. node-services tests do not run in PR CI (they stay local, per.github/workflows/ci.yml). - Run locally:
pnpm --filter @linger/node-services exec vitest run tests/voice-service.test.ts --maxWorkers=1passes 24/24 on the head. With the baseservice.tsit fails the 4 new cases.
Automated review by Claude Code
Automated review of fdcf914 by Claude Code.
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.
What and why
Snapshot the worker child and generation when readiness probes start, then validate the complete snapshot after every probe has settled. A successful health response is stale if its worker exited, its key rotated, or another provider was enabled while any probe was pending.
The current check happens before awaiting the health response. That lets voice readiness succeed for a process that no longer represents the current provider state. The final snapshot validation closes that gap without adding probes or network calls.
How it was verified
Base: 77abdcb. Node 26.5.0, pnpm 11.7.0.
Before: 4 new regression cases fail while 20 existing cases pass.
After: all 24 voice-service tests pass. Cases cover key rotation, child exit, enabling another provider, and invalidating an already completed probe while another probe remains pending. A fresh readiness check can subsequently succeed.
Command:
pnpm --filter @linger/node-services exec vitest run tests/voice-service.test.ts --maxWorkers=1.Node-services typecheck, changed-file ESLint and diff checks pass. The full owning-app fast gate now passes; see the exact-head validation below.
Focused tests for the changed behavior
make check BASE=origin/<target-branch>or the fast checks of every touched appNo contract regeneration required
Boundary
The nearest node-services guidance records the readiness invariant. Worker startup, key reconciliation, health endpoints and probe count are unchanged; the new validation only reads the existing in-memory worker state.
Validation follow-up
On
fdcf914cc5713c3e0c10a3216927e2dc78c95c54,pnpm --filter @linger/node-services checkpasses with Node 26.5.0 and pnpm 11.7.0: the feature catalog/typecheck and full ESLint gates pass, followed by 268 test files passed, 8 skipped; 2,715 tests passed, 51 skipped. No additional test exclusions, source changes, or lockfile changes were needed.This establishes the owning app's full fast gate. Unrelated full-repository and optional integration/acceptance suites were not run. Live provider keys, audio hardware and a deployed Voice worker were not used.