Skip to content

Skip filesystem path detection on single-keystroke text changes #2343

@mdrxy

Description

Privileged issue

  • I am a Deep Agents maintainer.

Issue Content

Problem

Every keystroke in ChatInput.on_text_area_changed unconditionally calls _is_dropped_path_payload() and _apply_inline_dropped_path_replacement(), both of which perform synchronous stat() syscalls via Path.exists() / Path.is_file() on the event loop thread. At normal typing speed this adds 5-10 blocking kernel calls/sec to the thread that also handles rendering and streaming.

Proposed fix

Track the previous text length and compute a is_bulk_change = abs(text_len - prev_text_len) > 1 heuristic. Gate both filesystem checks behind it. Drag-and-drop / paste always inserts multiple characters; normal typing is single-char. False positives (undo/redo of multi-char selections) are safe — they just run the check unnecessarily.

Files

  • libs/cli/deepagents_cli/widgets/chat_input.py

Context

Extracted from #1953.

Area (Required)

  • cli

Metadata

Metadata

Labels

cliRelated to `deepagents-cli`internalUser is a member of the `langchain-ai` GitHub organization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions