test: add unit tests for run_agent.py (AIAgent)#67
Merged
teknium1 merged 1 commit intoNousResearch:mainfrom Feb 27, 2026
Merged
test: add unit tests for run_agent.py (AIAgent)#67teknium1 merged 1 commit intoNousResearch:mainfrom
teknium1 merged 1 commit intoNousResearch:mainfrom
Conversation
71 tests covering pure functions, state/structure methods, and conversation loop pieces. OpenAI client and tool loading are mocked.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
run_agent.py(AIAgentclass) covering 16 methods across 3 groups_has_content_after_think_block,_strip_think_blocks,_extract_reasoning,_clean_session_content,_get_messages_up_to_last_assistant,_mask_api_key_for_logs__init__, interrupt mechanism,_hydrate_todo_store,_build_system_prompt,_invalidate_system_prompt,_build_api_kwargs,_build_assistant_message,_format_tools_for_system_message_execute_tool_calls,_handle_max_iterations,run_conversation(stop, tool calls, interrupt, invalid tool retry, empty content fallback, context compression)Test plan
uv run pytest tests/test_run_agent.py -v— 71 passed in ~3suv run pytest -v— full suite 243 passed, no regressions