Skip to content

Comments

Fix TypeError when ModelRunner initialized with health_check_port=None#947

Closed
Copilot wants to merge 2 commits intoPR-1160-inference-info-removal-for-local-runnersfrom
copilot/sub-pr-911-again
Closed

Fix TypeError when ModelRunner initialized with health_check_port=None#947
Copilot wants to merge 2 commits intoPR-1160-inference-info-removal-for-local-runnersfrom
copilot/sub-pr-911-again

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Why

Tests in test_runners.py and test_runners_proto.py explicitly pass health_check_port=None to ModelRunner, but the health server thread was started unconditionally, causing TypeError: 'NoneType' object cannot be interpreted as an integer during socket binding.

How

  • Added conditional check in ModelRunner.__init__ to only start health server thread when health_check_port is not None
  • Preserves health probe flag initialization (is_ready, is_startup) regardless of server state, as these indicate model readiness independent of HTTP server presence
# Before: Always started, crashed with None
start_health_server_thread(port=health_check_port, address='')

# After: Conditional start
if health_check_port is not None:
    start_health_server_thread(port=health_check_port, address='')

Tests

  • Validated syntax and logic correctness
  • Verified existing tests that pass health_check_port=None no longer encounter TypeError
  • Linting and security checks pass

Notes

  • Type hint already allowed Union[int, None] - fix aligns implementation with signature
  • Health probe flags remain outside conditional as they reflect model state, not server existence

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: ackizilkale <10406054+ackizilkale@users.noreply.github.com>
Copilot AI changed the title [WIP] Update model configuration and inference compute validation Fix TypeError when ModelRunner initialized with health_check_port=None Feb 13, 2026
Copilot AI requested a review from ackizilkale February 13, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants