[PR #1272] fix(cli): make escape reject pending HITL approval first #1270

Open
opened 2026-02-16 09:18:35 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/1272
Author: @OiPunk
Created: 2/11/2026
Status: 🔄 Open

Base: mainHead: codex/deepagents-1090-esc-reject-hitl


📝 Commits (1)

  • 440ab19 fix(cli): prioritize rejecting HITL approval on escape

📊 Changes

2 files changed (+59 additions, -4 deletions)

View changed files

📝 libs/cli/deepagents_cli/app.py (+8 -4)
📝 libs/cli/tests/unit_tests/test_app.py (+51 -0)

📄 Description

Summary

This fixes escape-key behavior for HITL approval prompts.

Fixes #1090.

Problem

When a HITL approval menu is open, pressing Escape could show an interrupted state while still leaving the approval menu interactive. Users could continue switching options and submitting after pressing Escape.

Root cause

action_interrupt() handled the running worker before handling a pending approval widget. During HITL, the worker is active while waiting for approval, so Escape canceled the worker path first instead of rejecting the approval prompt.

Changes

  • In DeepAgentsApp.action_interrupt, prioritize pending approval rejection before worker cancellation.
  • Added focused regression tests:
    • Escape rejects pending approval before canceling worker when both are active.
    • Escape still cancels worker and clears queued messages when no approval is pending.

Validation

Ran locally in libs/cli:

  • uv run --all-groups ruff check deepagents_cli/app.py tests/unit_tests/test_app.py
  • uv run --all-groups ty check deepagents_cli/app.py tests/unit_tests/test_app.py
  • uv run --group test pytest -q tests/unit_tests/test_app.py

AI assistance disclosure

AI assistance was intentionally limited to unit-test drafting, code review suggestions, and formatting/lint checks. The final implementation choices and code changes were completed manually.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/deepagents/pull/1272 **Author:** [@OiPunk](https://github.com/OiPunk) **Created:** 2/11/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `codex/deepagents-1090-esc-reject-hitl` --- ### 📝 Commits (1) - [`440ab19`](https://github.com/langchain-ai/deepagents/commit/440ab19c05c445c77e2582d7ce1d997e32e3ed15) fix(cli): prioritize rejecting HITL approval on escape ### 📊 Changes **2 files changed** (+59 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `libs/cli/deepagents_cli/app.py` (+8 -4) 📝 `libs/cli/tests/unit_tests/test_app.py` (+51 -0) </details> ### 📄 Description ## Summary This fixes escape-key behavior for HITL approval prompts. Fixes #1090. ## Problem When a HITL approval menu is open, pressing Escape could show an interrupted state while still leaving the approval menu interactive. Users could continue switching options and submitting after pressing Escape. ## Root cause `action_interrupt()` handled the running worker before handling a pending approval widget. During HITL, the worker is active while waiting for approval, so Escape canceled the worker path first instead of rejecting the approval prompt. ## Changes - In `DeepAgentsApp.action_interrupt`, prioritize pending approval rejection before worker cancellation. - Added focused regression tests: - Escape rejects pending approval before canceling worker when both are active. - Escape still cancels worker and clears queued messages when no approval is pending. ## Validation Ran locally in `libs/cli`: - `uv run --all-groups ruff check deepagents_cli/app.py tests/unit_tests/test_app.py` - `uv run --all-groups ty check deepagents_cli/app.py tests/unit_tests/test_app.py` - `uv run --group test pytest -q tests/unit_tests/test_app.py` ## AI assistance disclosure AI assistance was intentionally limited to unit-test drafting, code review suggestions, and formatting/lint checks. The final implementation choices and code changes were completed manually. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 09:18:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/deepagents#1270