Skip to content

The agent that grows with you

fix(agent): default relay completions to the progress-hook wrapper

Konstantin Khlopkovfba6110cde4c
diff --git a/agent/auxiliary_client.py b/agent/auxiliary_client.py
index 9f77e631a1d..fd14e8ef537 100644
--- a/agent/auxiliary_client.py
+++ b/agent/auxiliary_client.py
@@ -2443,7 +2443,12 @@ def _relay_sync_completion(
from agent.auxiliary_wire import prepare_chat_messages
kwargs = prepare_chat_messages(client, kwargs)
- callback = create or (lambda request: client.chat.completions.create(**request))
+ # The progress hook is installed per task, so every attempt for that
+ # task must go through _create_with_progress — including auxiliary
+ # retries and provider fallbacks. Defaulting at this seam covers every
+ # call site that predates the hook or forgets to thread create= through
+ # (18 of 24 today); call sites that pass their own create= keep it.
+ callback = create or (lambda request: _create_with_progress(client, request))
route = _relay_auxiliary_metadata(provider=provider, api_mode=api_mode)
# Isolate only the provider callback so the owning thread can unwind its lease/DB
# transaction on hard cancel without touching the shared client.