feat: add per-agent timeout_seconds for hard wall-clock timeouts (#82)#150
Merged
jrob5756 merged 3 commits intomicrosoft:mainfrom May 6, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #150 +/- ##
=======================================
Coverage ? 86.21%
=======================================
Files ? 60
Lines ? 8870
Branches ? 0
=======================================
Hits ? 7647
Misses ? 1223
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
jrob5756
reviewed
May 6, 2026
Collaborator
jrob5756
left a comment
There was a problem hiding this comment.
Nice, focused PR. CI is green and the helper-based design is clean. A few suggestions inline. Most are minor; the missing for-each integration test and the brittle output-type assertion are the two I'd address before merging. Also looks like there is a merge conflict :)
…rosoft#82) Add timeout_seconds field to AgentDef that wraps agent execution in asyncio.wait_for() at the engine level. This provides hard cancellation for slow agents without blocking entire workflows. Key behaviors: - Effective timeout = min(agent.timeout_seconds, remaining_workflow_timeout) - When workflow timeout is stricter, it owns the error (no mislabeling) - Emits agent_timeout event with agent name, elapsed time, and limit - Raises AgentTimeoutError (subclass of TimeoutError) for existing error handling semantics (fail_fast, continue_on_error) - Scoped to provider-backed agents only (script uses 'timeout', human_gate/workflow types rejected) - Applied at all execution sites: main loop, parallel groups, for-each groups Schema: - New field: timeout_seconds: float | None (ge=1.0) - Rejected for script, human_gate, and workflow agent types Exception: - New AgentTimeoutError class with agent_name attribute Console: - New verbose_log_agent_timeout handler for agent_timeout events Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…criber Add tests for the agent_timeout console logging path to address CodeCov coverage gaps: - verbose_log_agent_timeout with verbose mode enabled - verbose_log_agent_timeout with verbose mode disabled (no-op path) - verbose_log_agent_timeout file logging dual-write - ConsoleEventSubscriber.on_event agent_timeout dispatch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Use 'from e' instead of 'from None' to preserve asyncio.TimeoutError chain for debugging (workflow.py) - Document hard cancellation implications in timeout_seconds docstring: in-flight sessions, MCP tools, HTTP connections may be left inconsistent (schema.py) - Document why both agent_name and current_agent exist on AgentTimeoutError for downstream consumer clarity (exceptions.py) - Pin brittle 'or' assertion to deterministic value (test) - Add TestAgentTimeoutForEach class with fail_fast and continue_on_error integration tests (test) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d867696 to
30058b9
Compare
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.
Add timeout_seconds field to AgentDef that wraps agent execution in asyncio.wait_for() at the engine level. This provides hard cancellation for slow agents without blocking entire workflows.
Key behaviors:
Schema:
Exception:
Console:
Closes #82 .