Skip to content

fix(tui): do not create a directory on keydown for OpenRAG documents path#967

Closed
philnash wants to merge 3 commits into
langflow-ai:mainfrom
philnash:philnash/tui-directory-validation
Closed

fix(tui): do not create a directory on keydown for OpenRAG documents path#967
philnash wants to merge 3 commits into
langflow-ai:mainfrom
philnash:philnash/tui-directory-validation

Conversation

@philnash

Copy link
Copy Markdown
Member

By default Textual runs Input validators on each change. The DocumentsPathValidator attempts to perform some actions on the directory, including creating it if it doesn't exist, to ensure that OpenRAG can write to the selected directory.

Doing this on every change means that every keystroke will attempt to find or create the directory on the filesystem, causing many new directories as reported in #892.

Running the validator on submission means that a user will only get feedback about errors in accessing the directory when they submit, but this is preferable over creating many unused directories on their filesystem.

This fixes #892 by delaying the check until the form is submitted. It is likely best to delay file system operations until the user has made a decision, rather than trying over and over as they type.

philnash added a commit to philnash/openrag that referenced this pull request Feb 16, 2026
While fixing langflow-ai#967, I noticed that the other file selector input in this form did not validate that the directory could be written to. This adds the DocumentsPathValidator to the OpenSearch data directory field to match the the documents path.
@philnash philnash mentioned this pull request Feb 16, 2026
@philnash

Copy link
Copy Markdown
Member Author

The integration tests aren't passing, at least for some of them, because embedding fails. This PR doesn't touch embedding at all, so the tests are flaking for some reason.

Any ideas? Will this block merging?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where the TUI was creating intermediate directories on the filesystem for every keystroke when a user types a custom documents path. The issue was caused by Textual's default behavior of running validators on every input change, which triggered the DocumentsPathValidator that performs filesystem operations including directory creation.

Changes:

  • Added validate_on=["submitted"] parameter to Input widgets using DocumentsPathValidator
  • Delays filesystem validation until form submission rather than on every keystroke

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@phact

phact commented Feb 19, 2026

Copy link
Copy Markdown
Collaborator

closing in favor of #968

@phact phact closed this Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Directory selector creates intermediate directories while typing custom path

3 participants