test(agentic): add 46 state management and orchestrator tests — all passed#2
Open
Mog9 wants to merge 1 commit into
Open
test(agentic): add 46 state management and orchestrator tests — all passed#2Mog9 wants to merge 1 commit into
Mog9 wants to merge 1 commit into
Conversation
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.
Continues the agentic loop test coverage from #1. This PR adds tests for the state management layer (
agent_state.py) and the main orchestrator loop (agent_runner.py), plus the remaining 5 tests for tool dispatch (agent_tools.py).46 new tests across 3 files — all passing.
test_agent_tools.py (5 new tests)
test_unknown_tool_returns_errortest_tool_exception_returns_errortest_run_verify_delegates_to_verifierverify_candidatewith correct argstest_run_benchmark_delegates_to_benchmarkerbenchmark_candidatetest_read_candidate_file_rejects_bad_pathtest_agent_state.py (16 new tests)
test_init_state_creates_fileagent_state.jsonwritten to disktest_init_state_truncates_transcripttest_init_state_defaultstest_save_and_load_roundtriptest_load_returns_none_when_missingNonetest_load_returns_none_on_corrupt_jsonNonetest_request_abort_sets_flagabort_requestedbecomesTruetest_request_abort_only_when_pending_or_runningFalsefor terminal statusestest_request_abort_returns_false_when_no_stateFalsetest_append_transcript_adds_timestamp"at"keytest_append_transcript_multiple_linestest_read_transcript_empty[]test_read_transcript_skips_blank_linestest_read_transcript_skips_invalid_jsontest_state_path_formatrepo_root / artifact_dir / "agent_state.json"test_transcript_path_formatrepo_root / artifact_dir / "agent_transcript.jsonl"test_agent_runner.py (25 new tests)
Cost tracking (6 tests)
test_cost_from_usage_all_zerostest_cost_from_usage_input_onlytest_cost_from_usage_output_onlytest_cost_from_usage_cache_writetest_cost_from_usage_cache_readtest_cost_from_usage_combinedSystem prompt (3 tests)
test_build_system_prompt_has_two_blockstest_build_system_prompt_cache_controlcache_control: ephemeraltest_build_system_prompt_includes_task_detailsLoop termination (7 tests)
test_loop_errored_on_missing_api_keytest_loop_errored_on_api_refusaltest_loop_breaks_on_end_turn_without_toolstest_loop_rejected_on_give_uptest_loop_rejected_on_max_iterationstest_loop_rejected_on_cost_captest_loop_errored_on_api_errorState transitions (5 tests)
test_iteration_counter_incrementstest_cost_accumulates_across_turnstest_token_counts_accumulatetest_verify_result_tracked_in_statetest_benchmark_result_tracked_in_stateEdge cases (4 tests)
test_loop_continues_when_verify_failstest_loop_continues_when_benchmark_failstest_promotion_failure_does_not_crashtest_transcript_written_each_turnResults
test_agent_tools.py: 15 passed (10 from #1 + 5 new)
test_agent_state.py: 16 passed (new file)
test_agent_runner.py: 25 passed (new file)
Full suite: 149 passed, 1 skipped
Coverage summary
agent_tools.pyagent_state.pyagent_runner.py