Skip to content

fix(tui): use running state for app lifecycle guards - #916

Open
ousamabenyounes wants to merge 1 commit into
usestrix:mainfrom
ousamabenyounes:fix/issue-894-tui-mounted-guards
Open

fix(tui): use running state for app lifecycle guards#916
ousamabenyounes wants to merge 1 commit into
usestrix:mainfrom
ousamabenyounes:fix/issue-894-tui-mounted-guards

Conversation

@ousamabenyounes

Copy link
Copy Markdown
Contributor

Summary

  • Replaces app-level self.is_mounted truthiness guards with self.is_running in the TUI lifecycle paths.
  • Leaves the existing widget-level widget.is_mounted safety check unchanged.
  • Adds a regression test proving a not-running app returns before querying or rescheduling focus work.

Closes #894.

Test verification (RED -> GREEN)

RED on origin/main with only the regression test added:

$ uv run pytest tests/test_tui_app_lifecycle.py -q
F                                                                        [100%]
AttributeError: 'types.SimpleNamespace' object has no attribute '_focus_chat_input'
1 failed in 4.80s

GREEN after the fix:

$ uv run pytest tests/test_tui_app_lifecycle.py tests/test_proxy_renderer.py -q
....                                                                     [100%]
4 passed in 4.79s

Local CI replay:

$ ./run-ci.sh
....                                                                     [100%]
4 passed in 4.80s
All checks passed!
2 files already formatted
Success: no issues found in 1 source file

Known baseline:

$ uv run mypy strix/interface/tui/app.py
38 pre-existing Textual typing errors in strix/interface/tui/app.py

$ uv run pyright strix/interface/tui/app.py
117 pre-existing Textual typing/private-usage errors in strix/interface/tui/app.py

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects TUI lifecycle guards to use the application running state.

  • Replaces app-level is_mounted checks with is_running across splash, focus, rendering, action, and resize paths.
  • Preserves widget-level mount checks for individual widget safety.
  • Adds a regression test confirming focus work is neither queried nor rescheduled after the app stops.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The lifecycle changes consistently prevent application-level UI work after the Textual app has stopped, while existing widget mount checks continue to protect operations on individual widgets.

Important Files Changed

Filename Overview
strix/interface/tui/app.py Replaces inappropriate app-level mount-state guards with running-state guards while retaining widget-specific mount checks; no actionable defect was identified.
tests/test_tui_app_lifecycle.py Adds a focused regression test proving that a stopped app returns before querying widgets or scheduling additional focus work.

Reviews (1): Last reviewed commit: "fix(tui): use running state for app life..." | Re-trigger Greptile

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] App-level is_mounted guards in the TUI are dead code (always truthy)

1 participant