[PR #1151] [MERGED] fix(cli): harden dictionary iteration and HITL fallback handling #1167

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

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/deepagents/pull/1151
Author: @saakshigupta2002
Created: 2/5/2026
Status: Merged
Merged: 2/8/2026
Merged by: @mdrxy

Base: masterHead: fix/issue-956-dictionary-iteration


📝 Commits (10+)

  • a1fa62e fix(cli): protect dictionary iterations from concurrent modification
  • 9cb5738 style(cli): fix line length lint errors
  • 420c5de Merge branch 'master' into fix/issue-956-dictionary-iteration
  • 2d17c39 Merge branch 'master' into fix/issue-956-dictionary-iteration
  • 8d16738 Merge branch 'master' into fix/issue-956-dictionary-iteration
  • 77c91ad test(cli): add regression tests for dictionary iteration safety (#956)
  • 382ce7c style(cli): apply ruff format to test file
  • a8a4225 Merge branch 'master' into fix/issue-956-dictionary-iteration
  • ad74a3e cr
  • bdf4815 cr

📊 Changes

2 files changed (+189 additions, -13 deletions)

View changed files

📝 libs/cli/deepagents_cli/textual_adapter.py (+45 -13)
📝 libs/cli/tests/unit_tests/test_textual_adapter.py (+144 -0)

📄 Description

Fixes #956

Defensive hardening of dictionary iterations in textual_adapter.py, plus fixes for incomplete cleanup in HITL fallback branches.

Dictionary iteration: Wraps all _current_tool_messages and pending_interrupts iterations with list() to snapshot before iterating.

HITL fallback branches: The else branches for unexpected decision types previously fell through to reject without updating tool widget state or clearing _current_tool_messages. These now properly call set_rejected() and .clear(), matching the explicit reject branch.

Logging: Replaces with suppress(Exception) with try/except + logger.debug so cancellation-cleanup failures are visible. Adds logger.warning for unexpected HITL decision types that previously failed silently.


🔄 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/1151 **Author:** [@saakshigupta2002](https://github.com/saakshigupta2002) **Created:** 2/5/2026 **Status:** ✅ Merged **Merged:** 2/8/2026 **Merged by:** [@mdrxy](https://github.com/mdrxy) **Base:** `master` ← **Head:** `fix/issue-956-dictionary-iteration` --- ### 📝 Commits (10+) - [`a1fa62e`](https://github.com/langchain-ai/deepagents/commit/a1fa62e4c209d8bb6c4e67e2522721ed70f7e07b) fix(cli): protect dictionary iterations from concurrent modification - [`9cb5738`](https://github.com/langchain-ai/deepagents/commit/9cb573832310078e630304a95b9cf400150b4cbb) style(cli): fix line length lint errors - [`420c5de`](https://github.com/langchain-ai/deepagents/commit/420c5de91575bfe2196dc75cff0cd3a8e0f101ba) Merge branch 'master' into fix/issue-956-dictionary-iteration - [`2d17c39`](https://github.com/langchain-ai/deepagents/commit/2d17c39503158c1f9d099d0a20e2babb9eecaa74) Merge branch 'master' into fix/issue-956-dictionary-iteration - [`8d16738`](https://github.com/langchain-ai/deepagents/commit/8d16738460345a70bb932d93fd541dee1de56821) Merge branch 'master' into fix/issue-956-dictionary-iteration - [`77c91ad`](https://github.com/langchain-ai/deepagents/commit/77c91add073c0b3addb50cad045115a550588b20) test(cli): add regression tests for dictionary iteration safety (#956) - [`382ce7c`](https://github.com/langchain-ai/deepagents/commit/382ce7c84412275719f7b3988ea0033ac2e6a9b3) style(cli): apply ruff format to test file - [`a8a4225`](https://github.com/langchain-ai/deepagents/commit/a8a4225ff49f0cbeac42238fbdd8c61b6a676fdf) Merge branch 'master' into fix/issue-956-dictionary-iteration - [`ad74a3e`](https://github.com/langchain-ai/deepagents/commit/ad74a3e37f86b8e988d70f0c1a20f07041633b63) cr - [`bdf4815`](https://github.com/langchain-ai/deepagents/commit/bdf4815386d68fc1eb950e8418ebe3a3ae75e4b3) cr ### 📊 Changes **2 files changed** (+189 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `libs/cli/deepagents_cli/textual_adapter.py` (+45 -13) 📝 `libs/cli/tests/unit_tests/test_textual_adapter.py` (+144 -0) </details> ### 📄 Description Fixes #956 Defensive hardening of dictionary iterations in `textual_adapter.py`, plus fixes for incomplete cleanup in HITL fallback branches. **Dictionary iteration:** Wraps all `_current_tool_messages` and `pending_interrupts` iterations with `list()` to snapshot before iterating. **HITL fallback branches:** The `else` branches for unexpected decision types previously fell through to reject without updating tool widget state or clearing `_current_tool_messages`. These now properly call `set_rejected()` and `.clear()`, matching the explicit reject branch. **Logging:** Replaces `with suppress(Exception)` with `try/except` + `logger.debug` so cancellation-cleanup failures are visible. Adds `logger.warning` for unexpected HITL decision types that previously failed silently. --- <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:19 -05:00
yindo closed this issue 2026-02-16 09:18:19 -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#1167