fix(models): synchronize canonical runtime selection
This commit is contained in:
@@ -533,9 +533,15 @@ class AgentLoop:
|
||||
self.subagents.max_iterations = self.max_iterations
|
||||
|
||||
def invalidate_runtime_config(self) -> None:
|
||||
"""Invalidate runtime config and notify clients to refresh its catalog."""
|
||||
"""Invalidate runtime config for lazy refresh at the next admission."""
|
||||
self.runtime_resolver.invalidate()
|
||||
self._publish_runtime_selection(self.runtime_resolver.runtime)
|
||||
|
||||
def refresh_runtime_config(self) -> LLMRuntime:
|
||||
"""Refresh runtime config now and publish the canonical selection."""
|
||||
self.runtime_resolver.invalidate()
|
||||
runtime = self.runtime_resolver.admit()
|
||||
self._publish_runtime_selection(runtime)
|
||||
return runtime
|
||||
|
||||
def runtime_for_session(
|
||||
self,
|
||||
@@ -1787,7 +1793,7 @@ class AgentLoop:
|
||||
session.provider_state = None
|
||||
self.sessions.save(session)
|
||||
ctx.input_persisted_early = True
|
||||
ctx.delivery.record_runtime(runtime)
|
||||
await ctx.delivery.runtime_admitted(runtime)
|
||||
|
||||
ctx.request_context = self._request_context_for_turn(ctx)
|
||||
if ctx.kind is TurnKind.USER:
|
||||
|
||||
@@ -189,7 +189,15 @@ class TurnDelivery:
|
||||
started_at=started_at,
|
||||
)
|
||||
|
||||
def record_runtime(self, runtime: LLMRuntime) -> None:
|
||||
async def runtime_admitted(self, runtime: LLMRuntime) -> None:
|
||||
"""Record the immutable runtime and expose it at the lifecycle seam."""
|
||||
if self.route.publish_lifecycle:
|
||||
await self.runtime_event_publisher.turn_runtime_admitted(
|
||||
self.delivery_message,
|
||||
self.session_key,
|
||||
runtime,
|
||||
)
|
||||
return
|
||||
self.runtime_event_publisher.record_turn_runtime(self.session_key, runtime)
|
||||
|
||||
def record_latency(self, latency_ms: int | None) -> None:
|
||||
|
||||
Reference in New Issue
Block a user