Repository navigation
Commit 0d3ea14
authored
Python: feat(core): add max_duration_seconds bound and stop_reason signal to tool loop (#7587) (#7772)
* feat(core): add max_duration_seconds bound and stop_reason signal to tool loop (#7587)
* fix(core): unify batch limit decision precedence and propagate stop_reason to AgentResponse
* test: add missing tests for duration bounds, batch limits, and session persistence
* Fix _apply_batch_limit_decision limits bug and Phase 1 test execution
- **agent-framework-core**: Refactored _apply_batch_limit_decision to compute perf_counter exactly once per decision point, eliminating the structural fragility where the threshold check and log message used separate clock samples.
- **agent-framework-core**: Re-ordered limit checking in Phase 1 to execute before approval response resolution, successfully preventing execution during approved replays when limits are reached. A post-approval check ensures consecutive error limits (�ction == stop) remain handled.
- **agent-framework-core**: Rewrote 6 tests in est_function_invocation_logic.py that used a fragile call_count mock. The tests now use a mutable clock array that advances directly during the tool execution semantic step, providing true robustness against internal engine refactors.
Note: The fallback response trigger (_ensure_function_invocation_limit_fallback_response) remains scoped strictly to the function call limit, preserving pre-existing behavior. Expanding this to cover consecutive errors (�ction == stop) or duration timeouts is intentionally left out of scope for this fix.
* fix(core): preserve budget start_time across approval resumes, dedupe streaming limit decision, fix double-counted approval calls against max_function_calls
* chore: remove CHANGELOG entry, updated centrally on release per review
* chore: fix ruff formatting in test_function_invocation_logic.py (exact CI-pinned ruff 0.16.3)
* fix(core): remove _agent_framework_stop_reason signal, keep max_duration_seconds only
* fix(core): satisfy pre-commit and typing CI checks1 parent 63edba2 commit 0d3ea14
3 files changed
Lines changed: 532 additions & 39 deletions
File tree
- python/packages/core
- agent_framework
- _harness
- tests/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
385 | 385 | | |
386 | 386 | | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
| 389 | + | |
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
| |||
0 commit comments