Skip to content

fix: prevent ScreenStackError when stopping agent from modal#374

Merged
0xallam merged 1 commit intomainfrom
fix/stop-agent-screen-stack-error
Mar 20, 2026
Merged

fix: prevent ScreenStackError when stopping agent from modal#374
0xallam merged 1 commit intomainfrom
fix/stop-agent-screen-stack-error

Conversation

@0xallam
Copy link
Copy Markdown
Member

@0xallam 0xallam commented Mar 20, 2026

Summary

  • Fix ScreenStackError crash when clicking the stop button in StopAgentScreen modal
  • Move pop_screen() into on_button_pressed (shared by both stop and cancel paths) and remove the redundant pop in action_confirm_stop_agent, preventing a double-pop on a single-screen stack

Move pop_screen() into on_button_pressed before dispatching the stop
action, and remove the redundant pop in action_confirm_stop_agent.
This avoids a double-pop that crashes when the screen stack has only
the default screen left.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 20, 2026

Greptile Summary

This PR fixes a ScreenStackError crash in StopAgentScreen by consolidating all modal dismissal into on_button_pressedpop_screen() is now called unconditionally at the top of on_button_pressed and removed from action_confirm_stop_agent.

  • on_button_pressed now calls self.app.pop_screen() before branching on which button was pressed, so both "Yes" (stop) and "No" (cancel) dismiss the modal via the same code path.
  • action_confirm_stop_agent no longer calls self.pop_screen(), eliminating the error-prone pop inside the action.
  • The escape key handler (line 251) still calls self.app.pop_screen() directly and is unaffected by this change.
  • action_confirm_stop_agent is only called from on_button_pressed in this file, so removing pop_screen() from it has no other unintended side effects.

Confidence Score: 5/5

  • This PR is safe to merge — the change is minimal, well-scoped, and correctly addresses the double-pop bug.
  • The fix is straightforward: it moves a single pop_screen() call from action_confirm_stop_agent to the shared on_button_pressed handler. Both code paths (stop and cancel) correctly dismiss the modal exactly once. action_confirm_stop_agent has no other callers in the codebase, so removing pop_screen() from it has no unintended side effects. The escape key path remains independent and correct.
  • No files require special attention.

Important Files Changed

Filename Overview
strix/interface/tui.py Consolidates pop_screen() into on_button_pressed (removing it from action_confirm_stop_agent) to fix a ScreenStackError caused by attempting a screen pop in an already-dismissed context. Both the "Yes" and "No" button paths are handled correctly.

Last reviewed commit: "fix: prevent ScreenS..."

@0xallam 0xallam merged commit 9a0bc5e into main Mar 20, 2026
2 checks passed
@0xallam 0xallam deleted the fix/stop-agent-screen-stack-error branch March 20, 2026 03:39
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.

1 participant