open-swe/agent/middleware
langsmith-forge[bot] e5bc27a0ad
fix: notify users via Slack when agent hits model call step limit (#1204)
* fix: notify users via Slack when agent hits model call step limit

- Root cause: GraphRecursionError at 1000 steps bypassed all @after_agent
  middleware including open_pr_if_needed, leaving users with no notification
- Change: Added ModelCallLimitMiddleware(run_limit=60) to intercept gracefully
  before the hard recursion limit, and added notify_step_limit_reached
  @after_agent middleware to post a Slack thread reply when the limit fires
- Verified: 107 existing tests pass, no regressions

* fix: harden step-limit Slack notification

Ensure the step-limit notification runs after the PR safety net and cover the new middleware behavior with focused unit tests.

---------

Co-authored-by: LangSmith Forge <forge-agent@langsmith.ai>
Co-authored-by: Johannes du Plessis <johannes@langchain.dev>
2026-05-01 14:24:25 -07:00
..
__init__.py fix: notify users via Slack when agent hits model call step limit (#1204) 2026-05-01 14:24:25 -07:00
check_message_queue.py chore: Drop monorepo (#1029) 2026-03-06 16:10:34 -08:00
ensure_no_empty_msg.py fix: skip no_op injection when PR is committed and user is notified (#1047) 2026-03-10 12:56:44 -07:00
notify_step_limit.py fix: notify users via Slack when agent hits model call step limit (#1204) 2026-05-01 14:24:25 -07:00
open_pr.py fix: stop agent retrying commit_and_open_pr on 403 permission denied (#1123) 2026-05-01 19:37:53 +00:00
tool_error_handler.py chore: Drop monorepo (#1029) 2026-03-06 16:10:34 -08:00