open-swe/agent/middleware
langsmith-forge-dev[bot] b5ed2a6b8b
fix: safety net middleware never fires due to key-existence check (#1051)
* fix: safety net middleware always skipped due to key-existence check

The open_pr_if_needed after-agent middleware checked `if 'success' in pr_payload`
which evaluates True for BOTH success and failure responses from commit_and_open_pr
(all responses include the 'success' key). This meant the safety net never fired.

Fix: use `pr_payload.get('success')` to check the VALUE instead of key existence.

Evidence: 6+ production traces in last 24h where commit_and_open_pr returned
success=False but the safety net silently skipped (non-fast-forward push failures,
missing GitHub token, workflow permission errors, API 500 errors).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* update

---------

Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Palash Shah <palash@langchain.dev>
2026-04-30 17:22:11 -07:00
..
__init__.py chore: Drop monorepo (#1029) 2026-03-06 16:10:34 -08: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
open_pr.py fix: safety net middleware never fires due to key-existence check (#1051) 2026-04-30 17:22:11 -07:00
tool_error_handler.py chore: Drop monorepo (#1029) 2026-03-06 16:10:34 -08:00