-
Notifications
You must be signed in to change notification settings - Fork 214
Fill out implementation for health check #996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
📝 WalkthroughWalkthroughIntroduces a dynamic health check: new exported Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
rect rgba(200,220,255,0.5)
participant HTTP as HTTPServer
end
rect rgba(200,255,200,0.5)
participant Proc as InferenceProc (SupervisedProc)
participant LK as LiveKitConnector
end
Client->>HTTP: GET /
HTTP->>HTTP: invoke healthCheckListener()
HTTP->>Proc: check isAlive
Proc-->>HTTP: isAlive (true/false)
HTTP->>LK: check connection state
LK-->>HTTP: connected (true/false)
alt healthy
HTTP-->>Client: 200 OK + message
else unhealthy
HTTP-->>Client: 503 Service Unavailable + message
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@agents/src/worker.ts`:
- Around line 351-354: The health check currently treats an existing `#session`
object as "connected" even if the WebSocket is closed; update the condition in
the health check to verify the socket's readyState (e.g., check that
this.#session exists and this.#session.readyState === WebSocket.OPEN or
readyState === 1) instead of solely checking !this.#session, keeping the
surrounding checks for this.#closed and this.#connecting intact (refer to the
fields `#session`, `#closed`, `#connecting` and the health-checking block in the
worker). Ensure you guard access to readyState by confirming this.#session is
truthy before reading it and use the WebSocket.OPEN constant (or numeric 1) so
closed/closing states are treated as unhealthy.
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
agents/src/http_server.tsagents/src/ipc/supervised_proc.tsagents/src/worker.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/agent-core.mdc)
Add SPDX-FileCopyrightText and SPDX-License-Identifier headers to all newly added files with '// SPDX-FileCopyrightText: 2025 LiveKit, Inc.' and '// SPDX-License-Identifier: Apache-2.0'
Files:
agents/src/ipc/supervised_proc.tsagents/src/http_server.tsagents/src/worker.ts
**/*.{ts,tsx}?(test|example|spec)
📄 CodeRabbit inference engine (.cursor/rules/agent-core.mdc)
When testing inference LLM, always use full model names from
agents/src/inference/models.ts(e.g., 'openai/gpt-4o-mini' instead of 'gpt-4o-mini')
Files:
agents/src/ipc/supervised_proc.tsagents/src/http_server.tsagents/src/worker.ts
**/*.{ts,tsx}?(test|example)
📄 CodeRabbit inference engine (.cursor/rules/agent-core.mdc)
Initialize logger before using any LLM functionality with
initializeLogger({ pretty: true })from '@livekit/agents'
Files:
agents/src/ipc/supervised_proc.tsagents/src/http_server.tsagents/src/worker.ts
🧬 Code graph analysis (1)
agents/src/worker.ts (1)
agents/src/http_server.ts (1)
HTTPServer(20-76)
🔇 Additional comments (4)
agents/src/ipc/supervised_proc.ts (1)
62-64: LGTM!The
isAlivegetter correctly combines the three essential conditions for determining process health: started, not closing, and IPC channel connected. The optional chaining with double negation ensures a proper boolean return.agents/src/worker.ts (1)
358-365: LGTM!The worker listener callback cleanly provides the required metadata with proper enum-to-string conversion for
worker_type.agents/src/http_server.ts (2)
7-10: LGTM!Clean and minimal interface definition for health check results.
26-52: LGTM!The constructor signature update and route handler logic correctly implement the dynamic health check mechanism. The 503 status for unhealthy states follows standard HTTP semantics for service availability.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Description
Implement the placeholder health check function.
Changes Made
Pre-Review Checklist
Testing
restaurant_agent.tsandrealtime_agent.tswork properly (for major changes)Additional Notes
Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.
Summary by CodeRabbit
New Features
Refactor
✏️ Tip: You can customize this high-level summary in your review settings.