vllm-project/semantic-router

config: reject non-positive periodic intervals before ticker creation

已关闭

#2,475 创建于 2026年7月12日

 (2 条评论) (0 个反应) (1 位负责人)Go (699 个派生)github user discovery
area/corearea/model-selectionbughelp wantedpriority/P1roadmap

仓库指标

星标
 (4,293 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Summary

Validate every ticker-driving duration before runtime construction and make periodic start/close lifecycle idempotent. Owner surfaces: src/semantic-router/pkg/selection/elo.go, src/semantic-router/pkg/selection/rl_driven.go, src/semantic-router/pkg/selection/lookuptable/file.go, src/semantic-router/pkg/extproc/router_selection.go, and src/semantic-router/pkg/config/validator_learning.go.

Current behavior

Syntactically valid zero or negative durations can reach ticker construction and panic the process or leave periodic behavior silently inactive. At least one storage close path also uses a check-then-close pattern that is unsafe under concurrent close.

Public API boundary

The listed Elo, RL-driven, and lookup-table files are legacy/internal cleanup surfaces on current main. Fixing their ticker/lifecycle safety must not reintroduce their historical names as supported public Router Learning configuration; #2242 owns that migration boundary.

Expected behavior

Every periodic duration is positive and bounded at config ingestion and constructor boundaries, and start/close behavior is concurrency-safe and idempotent.

Acceptance

  • Require every ticker-driving duration to be positive and below a documented maximum.
  • Return a field-addressed config error before runtime construction.
  • Defensively reject invalid intervals in constructors.
  • Define and synchronize start, closing, and closed transitions.
  • Make repeated and concurrent close safe.

Validation

  • Add table tests for zero, negative, overflow, malformed, and maximum-boundary durations.
  • Add repeated-start and high-concurrency close tests under -race.
  • Run cd src/semantic-router && go test -race ./pkg/selection ./pkg/selection/lookuptable ./pkg/extproc ./pkg/config.
  • Run the selection changed-surface gates reported by make agent-report.

Related

  • Parent audit: #2375

贡献者指南