fix(code): keep the /goal criteria prompt responsive - #5142
Merged
Mason Daugherty (mdrxy) merged 6 commits intoJul 30, 2026
Conversation
`/goal` is dispatched from `on_chat_input_submitted`, which is awaited inline on the Textual message pump, and the handler awaited the one-time Auto criteria preference modal in that chain. The pump therefore stayed blocked while the modal was open, so it never received the Enter/Esc keys it needs to resolve and the terminal looked frozen until the ten-minute watchdog fired. Run the flow off the pump when the prompt is still owed, so the handler returns and keys reach the modal. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Mason Daugherty (mdrxy)
marked this pull request as ready for review
July 29, 2026 19:11
Replace the bespoke _goal_preference_task mechanism with the shared _schedule_off_message_pump helper. This registers the continuation in _modal_command_tasks synchronously, so the queue drain's busy check holds queued messages while the criteria prompt is unanswered — closing a gap where a dequeued /goal released the queue and let a following agent turn start concurrently with goal drafting. Also gains centralized exit cancellation (awaited in teardown), named failure logging, and the drain-after-modal-command queue resume. Generalize the helper's refusal toast now that it covers goal commands, and add a regression test driving a queued /goal + normal message through the real drain path.
Mason Daugherty (mdrxy)
deleted the
mdrxy/code/goal-criteria-prompt-freeze
branch
July 30, 2026 18:48
Mason Daugherty (mdrxy)
pushed a commit
that referenced
this pull request
Jul 31, 2026
> [!CAUTION] > Merging this PR will automatically publish to **PyPI** and create a **GitHub release**. For the full release process, see [`.github/RELEASING.md`](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md). --- _Release notes preview: keep this section in sync with the package `CHANGELOG.md`. Publish reads the merged CHANGELOG via `release.yml`, not this PR description — keep them aligned anyway so the PR stays an accurate historical record for reviewers and anyone returning later._ --- ## [0.1.51](deepagents-code==0.1.50...deepagents-code==0.1.51) (2026-07-31) ### Features - The status bar and usage view now show the running session cost. ([#5036](#5036)) - Removed redundant `shell` and `web_search` prompt guidance. ([#5213](#5213)) - After switching threads, Deep Agents now points back to the previous thread. ([#5172](#5172)) - Leaving `/mcp` with pending toggles now prompts you to reconnect. ([#5211](#5211)) - `dcode config get` now accepts configuration sections. ([#5134](#5134)) ### Fixes - Kept the `/goal` criteria prompt responsive. ([#5142](#5142)) - Improved goal handling so underspecified objectives can be resolved from conversation context. ([#5201](#5201)) - Released the turn when an interrupted worker never starts. ([#5196](#5196)) - Hid timestamp footers together with their associated rows. ([#5167](#5167)) - Fixed editable SDK detection by scanning and correlating SDK locations more accurately. ([#5199](#5199)) - Improved `doctor` output to explain why it may not have a latest-version answer. ([#5209](#5209)) _End release notes preview._ --- > [!NOTE] > A **New Contributors** section is appended to the GitHub release notes automatically at publish time (see [Release Pipeline](https://github.com/langchain-ai/deepagents/blob/main/.github/RELEASING.md#release-pipeline), step 2). --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: langchain-oss-automated-triage[bot] <248757908+langchain-oss-automated-triage[bot]@users.noreply.github.com>
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.
Related #5086, #5127
/goal <objective>and/goal amend <feedback>no longer freeze the terminal the first time Auto mode asks how to handle generated goal criteria — Enter and Esc now resolve that prompt.Slash commands are dispatched from the App's
on_chat_input_submittedhandler, which is awaited inline on the Textual message pump. The/goalcreate and amend branches awaited the one-time "How should Auto mode handle goal criteria?" modal in that chain, so the pump stayed blocked for as long as the modal was open. The modal therefore never received the Enter/Esc key events it needs to resolve, and because the modal watchdog is ten minutes, the app looked permanently frozen — not even the quit binding got through, so users had to kill the terminal.This is the same failure #5086 fixed for the post-install restart prompt and #5127 fixes for the
/updateand/install --packageprompts. Only the first Auto-mode/goalin a fresh install is affected: once the preference is answered (or set inconfig.toml/DEEPAGENTS_CODE_GOAL_AUTO_ACCEPT_CRITERIA) no modal opens and the flow never blocks. Launching withdcode --goal ...was already fine, because the startup sequence runs off the pump.Notes for review:
_start_goal_proposal, which detaches the flow only when the preference prompt is actually owed; otherwise it stays inline, so ordinary/goalbehavior and its queue interaction are unchanged. The proposal coroutine is now built by a callable so a preflight failure cannot strand it un-awaited./goal(an external caller, or a queue drain) is refused with a toast instead of stacking a modal over an unanswered one, and app teardown cancels a flow still parked on the prompt.ChatInput.Submittedpath and press a key; both regression tests wedge the app (pump blocked until the pytest timeout) against the previous code. If fix(code): keep/updateand/install --packageprompts responsive #5127 lands first, this detach could be folded into its_schedule_off_message_pumphelper.Made by Open SWE