fix(tui): add on_input_changed handler for live overlay updates #10918

Open
HAL9000 wants to merge 1 commit from bugfix/m8-tui-on-input-changed into master
Owner

Summary

Fixes issue #4738 — the TUI app was missing an on_input_changed event handler, causing both the slash command overlay and the reference picker overlay to never update while the user was typing.

Changes

  • src/cleveragents/tui/app.py: Added on_input_changed handler that:

    • When text starts with /, filters slash commands by the query after the slash in real time
    • When text contains @, extracts the token after the last @ and updates the reference picker with matching suggestions
    • Otherwise resets both overlays to their default (unfiltered) state
  • features/tui_app_coverage.feature: Added 5 BDD scenarios covering all branches of the new handler

  • features/steps/tui_app_coverage_steps.py: Added step definitions for the new scenarios

Before

The slash command overlay was set once on mount with all 70 commands and never updated again. The reference picker was only updated in on_input_submitted — after the user had already submitted the message.

After

Both overlays update live as the user types, providing the interactive autocomplete UX described in the spec.

Closes #4738

This PR blocks issue #4738


Automated by CleverAgents Bot
Supervisor: Implementation | Agent: task-implementor

## Summary Fixes issue #4738 — the TUI app was missing an `on_input_changed` event handler, causing both the slash command overlay and the reference picker overlay to never update while the user was typing. ### Changes - **`src/cleveragents/tui/app.py`**: Added `on_input_changed` handler that: - When text starts with `/`, filters slash commands by the query after the slash in real time - When text contains `@`, extracts the token after the last `@` and updates the reference picker with matching suggestions - Otherwise resets both overlays to their default (unfiltered) state - **`features/tui_app_coverage.feature`**: Added 5 BDD scenarios covering all branches of the new handler - **`features/steps/tui_app_coverage_steps.py`**: Added step definitions for the new scenarios ### Before The slash command overlay was set once on mount with all 70 commands and never updated again. The reference picker was only updated in `on_input_submitted` — after the user had already submitted the message. ### After Both overlays update live as the user types, providing the interactive autocomplete UX described in the spec. Closes #4738 This PR blocks issue #4738 --- Automated by CleverAgents Bot Supervisor: Implementation | Agent: task-implementor
HAL9000 added this to the v3.8.0 milestone 2026-04-28 13:12:29 +00:00
fix(tui): add on_input_changed handler for live overlay updates
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 39s
CI / lint (pull_request) Successful in 56s
CI / build (pull_request) Successful in 54s
CI / quality (pull_request) Successful in 1m12s
CI / typecheck (pull_request) Successful in 1m28s
CI / security (pull_request) Successful in 1m38s
CI / push-validation (pull_request) Successful in 22s
CI / integration_tests (pull_request) Successful in 3m26s
CI / e2e_tests (pull_request) Successful in 4m2s
CI / unit_tests (pull_request) Failing after 5m3s
CI / coverage (pull_request) Has been skipped
CI / docker (pull_request) Has been skipped
CI / status-check (pull_request) Failing after 3s
cd02e5a97d
Add the missing on_input_changed event handler to the TUI app so that
both the slash command overlay and the reference picker overlay update
in real time as the user types, rather than only on submit.

- When the user types / the slash overlay filters commands by the query
  after the slash character
- When the user types @ the reference picker updates with matching
  suggestions based on the token after the last @ sign
- Otherwise both overlays are reset to their default (unfiltered) state

Also adds BDD scenarios and step definitions covering all branches of
the new handler.

ISSUES CLOSED: #4738
HAL9001 left a comment

PR Review: fix(tui): add on_input_changed handler for live overlay updates

Linked Issue

  • Closes #4738: UAT — Reference picker and slash command overlays never update while typing

Summary of Changes

This PR adds the missing on_input_changed event handler to src/cleveragents/tui/app.py that enables live overlay filtering as the user types. Two new test files are added: features/tui_app_coverage.feature (5 new BDD scenarios) and features/steps/tui_app_coverage_steps.py (step definitions). The handler correctly branches into 3 cases: / prefix filters slash commands, @ in text updates the reference picker, and plain text resets both overlays.

Blocking Issues

1. CI is failing — unit_tests job failed

The unit_tests CI job is failing, and status-check (which aggregates results) also fails. Coverage job is skipped. Per company policy, all 5 required CI gates (lint, typecheck, security, unit_tests, coverage) must pass before merge. Additionally, the contributing guide states: "PRs with failing CI will NOT be reviewed." The lint and typecheck jobs passed, which means the new code has no formatting or type errors — the failure is in the test logic itself.

Action: Debug and fix the failing unit test scenarios. The new BDD tests for on_input_changed (lines in steps file for steps step_slash_overlay_filtered, step_ref_picker_reset, step_slash_overlay_all_commands) may have incorrect assertions or data structure assumptions about overlay._commands and cmd.command.

2. PR has zero labels

The PR was submitted with no labels at all ("labels":[]). Per PR requirements: "Exactly one Type/ label" is mandatory. Since this PR fixes a confirmed bug (#4738, which has Type/Bug label), the PR should have at minimum:

  • Type/Bug
  • Priority/Critical (bug issues always get Priority/Critical per project policy)
  • And potentially other relevant labels from the linked issue.

3. Milestone mismatch

The PR is assigned to milestone v3.8.0 (M9), but the linked issue #4738 is in milestone v3.7.0 (M8). The branch name bugfix/m8-tui-on-input-changed confirms the work belongs to M8. The PR milestone should be corrected to v3.7.0 to match the linked issue.

Non-Blocking Observations

Performance: slash_command_specs() called on every keystroke

In the / prefix branch, slash_command_specs() is called on every character typed:

query = stripped[1:]
slash.set_commands(query, slash_command_specs())  # Regenerates all 70 specs each time

This is inherited from on_mount but is inefficient for a handler that fires on every keystroke. Suggestion: cache the command specs once and filter them in memory instead of regenerating all 70 specs on each keystroke.

Positive Findings

  • Correctness: All three code branches (/ prefix, @ in text, plain text) are logically correct and handle edge cases (empty queries, trailing @).
  • Type safety: All new signatures are fully typed — no # type: ignore anywhere.
  • Test quality: 5 comprehensive BDD scenarios covering all branches plus edge cases; step definitions are clear and well-structured.
  • Readability: Clean if/elif/else flow, descriptive variable names, comprehensive docstring.
  • Documentation: Both the method docstring and PR description are thorough.
  • Code style: Follows SOLID (SRP), files are well under 500 lines, consistent with existing patterns.
  • Security: No secrets, credentials, or unsafe patterns introduced.

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

## PR Review: fix(tui): add on_input_changed handler for live overlay updates ### Linked Issue - Closes #4738: UAT — Reference picker and slash command overlays never update while typing ### Summary of Changes This PR adds the missing `on_input_changed` event handler to `src/cleveragents/tui/app.py` that enables live overlay filtering as the user types. Two new test files are added: `features/tui_app_coverage.feature` (5 new BDD scenarios) and `features/steps/tui_app_coverage_steps.py` (step definitions). The handler correctly branches into 3 cases: `/` prefix filters slash commands, `@` in text updates the reference picker, and plain text resets both overlays. ### Blocking Issues #### 1. CI is failing — unit_tests job failed The `unit_tests` CI job is **failing**, and `status-check` (which aggregates results) also fails. Coverage job is skipped. Per company policy, all 5 required CI gates (lint, typecheck, security, unit_tests, coverage) **must pass before merge**. Additionally, the contributing guide states: **"PRs with failing CI will NOT be reviewed."** The `lint` and `typecheck` jobs passed, which means the new code has no formatting or type errors — the failure is in the test logic itself. > **Action**: Debug and fix the failing unit test scenarios. The new BDD tests for `on_input_changed` (lines in steps file for steps `step_slash_overlay_filtered`, `step_ref_picker_reset`, `step_slash_overlay_all_commands`) may have incorrect assertions or data structure assumptions about `overlay._commands` and `cmd.command`. #### 2. PR has zero labels The PR was submitted with **no labels at all** ("labels":[]). Per PR requirements: "Exactly one Type/ label" is mandatory. Since this PR fixes a confirmed bug (#4738, which has Type/Bug label), the PR should have at minimum: - `Type/Bug` - `Priority/Critical` (bug issues always get Priority/Critical per project policy) - And potentially other relevant labels from the linked issue. #### 3. Milestone mismatch The PR is assigned to milestone **v3.8.0 (M9)**, but the linked issue #4738 is in milestone **v3.7.0 (M8)**. The branch name `bugfix/m8-tui-on-input-changed` confirms the work belongs to M8. The PR milestone should be corrected to **v3.7.0** to match the linked issue. ### Non-Blocking Observations #### Performance: `slash_command_specs()` called on every keystroke In the `/` prefix branch, `slash_command_specs()` is called on **every character typed**: ```python query = stripped[1:] slash.set_commands(query, slash_command_specs()) # Regenerates all 70 specs each time ``` This is inherited from `on_mount` but is inefficient for a handler that fires on every keystroke. Suggestion: cache the command specs once and filter them in memory instead of regenerating all 70 specs on each keystroke. ### Positive Findings - **Correctness**: All three code branches (`/` prefix, `@` in text, plain text) are logically correct and handle edge cases (empty queries, trailing `@`). - **Type safety**: All new signatures are fully typed — no `# type: ignore` anywhere. - **Test quality**: 5 comprehensive BDD scenarios covering all branches plus edge cases; step definitions are clear and well-structured. - **Readability**: Clean `if/elif/else` flow, descriptive variable names, comprehensive docstring. - **Documentation**: Both the method docstring and PR description are thorough. - **Code style**: Follows SOLID (SRP), files are well under 500 lines, consistent with existing patterns. - **Security**: No secrets, credentials, or unsafe patterns introduced. --- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Owner

Automated by CleverAgents Bot
Supervisor: PR Review | Agent: pr-review-worker

--- Automated by CleverAgents Bot Supervisor: PR Review | Agent: pr-review-worker
Some checks failed
CI / benchmark-publish (pull_request) Has been skipped
CI / helm (pull_request) Successful in 39s
CI / lint (pull_request) Successful in 56s
Required
Details
CI / build (pull_request) Successful in 54s
Required
Details
CI / quality (pull_request) Successful in 1m12s
Required
Details
CI / typecheck (pull_request) Successful in 1m28s
Required
Details
CI / security (pull_request) Successful in 1m38s
Required
Details
CI / push-validation (pull_request) Successful in 22s
CI / integration_tests (pull_request) Successful in 3m26s
Required
Details
CI / e2e_tests (pull_request) Successful in 4m2s
CI / unit_tests (pull_request) Failing after 5m3s
Required
Details
CI / coverage (pull_request) Has been skipped
Required
Details
CI / docker (pull_request) Has been skipped
Required
Details
CI / status-check (pull_request) Failing after 3s
This pull request has changes conflicting with the target branch.
  • features/steps/tui_app_coverage_steps.py
  • features/tui_app_coverage.feature
  • src/cleveragents/tui/app.py
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin bugfix/m8-tui-on-input-changed:bugfix/m8-tui-on-input-changed
git switch bugfix/m8-tui-on-input-changed
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!10918
No description provided.