teknium1
4b25619bc4
refactor(run_agent): extract chat-completion helpers to agent/chat_completion_helpers.py
Six methods move into a new module — bodies live there, AIAgent keeps
thin forwarder methods so call sites and tests are unchanged.
* interruptible_api_call — non-streaming API call with interrupt handling
* build_api_kwargs — assemble OpenAI / Anthropic / Codex / Bedrock request kwargs
* build_assistant_message — normalize assistant message dict (reasoning,
tool_calls, codex passthrough fields, alibaba glm-4.7 quirk)
* try_activate_fallback — provider fallback chain activation
* handle_max_iterations — controlled stop when iteration budget exhausts
* cleanup_task_resources — per-turn VM + browser teardown (skipped for
persistent environments)
Names tests patch on run_agent (cleanup_vm, cleanup_browser) are routed
through _ra() so the patch surface is preserved.
Two TestAnthropicInterruptHandler source-introspection tests were
updated to scan agent.chat_completion_helpers.interruptible_api_call
instead of AIAgent._interruptible_api_call — the body lives in the
extracted module now.
tests/run_agent/ + tests/agent/: 4313 passed (same pre-existing
test_auxiliary_client failure).
run_agent.py: 13282 -> 12253 lines (-1029).
2026-05-16 18:41:44 -07:00
..
2026-05-14 22:27:09 -07:00
2026-05-09 14:36:58 -07:00
2026-05-14 21:26:52 -04:00
2026-05-14 23:30:16 -07:00
2026-05-09 11:11:45 -07:00
2026-05-12 13:59:22 -04:00
2026-05-14 15:50:57 -07:00
2026-05-15 10:36:38 +05:30
2026-04-24 03:04:42 -07:00
2026-05-13 22:53:01 -07:00
2026-04-16 16:50:15 -07:00
2026-04-30 02:35:29 -07:00
2026-05-14 07:48:03 -07:00
2026-05-14 14:28:14 -07:00
2026-05-16 18:41:44 -07:00
2026-05-14 22:27:09 -07:00
2026-05-10 22:15:04 -07:00
2026-05-09 11:07:37 -07:00
2026-05-15 10:36:38 +05:30
2026-05-05 15:42:39 -05:00
2026-05-05 13:46:20 -07:00
2026-05-15 10:36:38 +05:30
2026-04-21 01:56:35 -07:00
2026-04-28 04:58:22 -07:00
2026-04-21 06:06:16 -07:00
2026-04-24 14:32:21 -07:00
2026-04-21 08:00:00 -07:00
2026-04-28 05:21:49 -07:00
2026-04-29 23:18:55 -07:00
2026-05-12 20:46:04 -07:00
2026-04-12 03:53:30 -07:00
2026-05-14 14:51:07 -07:00
2026-04-30 04:32:06 -07:00
2026-05-08 14:43:13 -07:00
2026-05-07 09:59:07 -07:00
2026-05-02 01:49:55 -07:00
2026-04-26 19:01:26 -07:00
2026-05-09 02:09:35 -07:00
2026-05-09 17:53:02 -07:00
2026-05-14 09:05:31 -07:00
2026-05-06 04:02:02 -07:00
2026-04-28 06:45:55 -07:00
2026-05-14 07:08:45 -07:00
2026-05-07 13:04:08 -07:00
2026-04-11 23:12:11 -07:00
2026-05-06 01:11:49 +05:30
2026-05-08 14:27:40 -07:00
2026-05-10 18:55:28 -07:00
2026-05-07 13:41:16 -07:00
2026-04-20 12:23:05 -07:00
2026-04-19 22:44:47 -07:00
2026-05-11 22:15:16 -07:00
2026-04-29 05:00:40 -07:00
2026-05-15 10:36:38 +05:30
2026-05-05 10:15:31 -07:00
2026-05-07 06:35:54 -07:00
2026-05-12 15:06:25 -07:00
2026-04-10 13:37:45 -07:00
2026-05-07 13:04:08 -07:00
2026-04-17 14:21:22 -07:00
2026-05-14 08:03:33 -07:00
2026-04-20 12:23:05 -07:00
2026-04-20 12:23:05 -07:00
2026-05-07 05:46:05 -07:00
2026-04-20 23:20:33 -07:00
2026-05-07 18:54:29 -04:00
2026-04-26 18:50:49 -07:00
2026-04-26 18:50:49 -07:00
2026-04-26 18:50:49 -07:00
2026-04-26 18:50:49 -07:00