fix(code): switch input mode without flashing the mode trigger#4243
Merged
Conversation
Typing a mode trigger (`!`, `!!`, `/`) at the start of the chat input inserted the character, then a re-entrant change pass stripped it and a `call_after_refresh` swapped the prompt glyph a frame later. That insert -> strip round trip left the literal trigger visible for one frame. Intercept the trigger keystroke in `ChatTextArea._on_key` and switch the mode directly (via the extracted `_resolve_prefix_mode` shared with the change handler) without ever inserting the character, driving the same completion/hint refresh inline. The change handler still covers paste, history, and drag-drop paths. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
Mason Daugherty (mdrxy)
marked this pull request as ready for review
June 25, 2026 06:52
Mason Daugherty (mdrxy)
added a commit
that referenced
this pull request
Jun 26, 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). --- _Everything below this line will be the GitHub release body._ --- ## [0.1.25](deepagents-code==0.1.24...deepagents-code==0.1.25) (2026-06-26) ### Bug Fixes * Bind ephemeral port instead of squatting `langgraph dev`'s 2024 ([#4264](#4264)) ([11e5359](11e5359)) * Block dotenv shell startup hooks ([#4288](#4288)) ([686d6f3](686d6f3)) * Defer server graph construction ([#4300](#4300)) ([220dfc0](220dfc0)) * Avoid blocking MCP imports during graph readiness ([#4302](#4302)) ([7533ca8](7533ca8)) * Gate `delete` file operations ([#4299](#4299)) ([92a8681](92a8681)) * Handle recursive `fetch_url` conversion ([#4257](#4257)) ([f240a40](f240a40)) * Report editable SDK runtime version ([#4304](#4304)) ([4439e91](4439e91)) * Show months instead of "0y ago" for 360-364 day old timestamps ([#4267](#4267)) ([820b331](820b331)) * Surface `/auth`-stored credentials in `config show`/`get` ([#4258](#4258)) ([c7c8788](c7c8788)) * Switch input mode without flashing the mode trigger ([#4243](#4243)) ([fc5d9cb](fc5d9cb)) --- _Everything above this line will be the GitHub release body._ --- > [!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: Mason Daugherty <github@mdrxy.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.
Fixed a brief flash of the
!//character when switching the chat input into shell, incognito, or command mode.Typing a mode trigger (
!,!!,/) at the start of the chat input flashed the literal character for one frame:TextAreainserted it, a re-entrant change pass stripped it, andwatch_mode'scall_after_refreshswapped the prompt glyph a frame later. This intercepts the trigger keystroke inChatTextArea._on_keyand switches the mode directly — without ever inserting the character — driving the same completion/hint refresh inline. Mode-detection logic is extracted into_resolve_prefix_mode, shared with the change handler, which still covers the paste/history/drag-drop paths.Related: backspace mode exit
Because the trigger is now consumed rather than inserted-then-stripped, the prompt prefix is purely a mode selector and never lives in the draft text. Backspace exits command/shell mode when the cursor is at the start of the prompt, including an empty prompt or a draft with text after the cursor. That preserves the draft text while clearing mode-specific UI such as slash-command argument hints. Exiting a mode (via backspace or Escape) no longer restores
/,!, or!!into the input.Made by Open SWE