Skip to content

fix(tui): add fallback exit handler for routes without dedicated exit handling#21066

Open
YumaKakuya wants to merge 2 commits intoanomalyco:devfrom
sorted-ai:fix/plugin-route-exit-fallback
Open

fix(tui): add fallback exit handler for routes without dedicated exit handling#21066
YumaKakuya wants to merge 2 commits intoanomalyco:devfrom
sorted-ai:fix/plugin-route-exit-fallback

Conversation

@YumaKakuya
Copy link
Copy Markdown

Issue for this PR

Closes #20069

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Plugin routes registered via api.route.register() don't have their own
app_exit keyboard handler. Since exitOnCtrlC is disabled globally, and the
existing handlers (dialog, session, selection) all skip plugin routes, users
get trapped with no way to exit except killing the process.

This adds an app-level fallback in app.tsx that fires for any route type that
isn't home or session (both of which already handle app_exit in their own
components). This way future route types also get exit coverage automatically,
rather than needing to be added to an allowlist.

See also #20515, which addresses the same issue but checks for route === "plugin"
specifically. This approach uses a negative guard instead so it doesn't need
updating when new route types are introduced.

How did you verify your code works?

  • Full test suite: 1827 pass / 17 skip / 0 fail
  • Typecheck: all 13 packages pass
  • Manually confirmed that Ctrl+C, Ctrl+D, and leader+q exit from a plugin route

Screenshots / recordings

N/A — keyboard behavior, no visual change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

… handling

Plugin routes registered via api.route.register() do not have their own
app_exit keyboard handler. Since exitOnCtrlC is disabled globally, and
the three existing handlers (dialog, session, selection) all skip plugin
routes, users get trapped with no way to exit.

Rather than checking for a specific route type, this adds an app-level
fallback that fires for any route whose type is not "home" or "session"
(both of which already handle app_exit in their own components). This
means future route types also get exit coverage automatically.

Closes anomalyco#20069
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Duplicate Found:

This PR directly addresses the same issue as PR #21066. According to the description, PR #20515 implements a similar fix but specifically checks for route === "plugin", whereas PR #21066 uses a negative guard approach (checking for routes that are NOT home or session). The PR description explicitly mentions #20515 as an alternative approach to the same problem (issue #20069).

Recommendation: Check if PR #20515 is already merged or open. If it's open, coordinate with that PR's author or consider if one approach is preferable to the other.

@YumaKakuya
Copy link
Copy Markdown
Author

Aware of #20515 — both fix the same root cause. The key difference is in how the guard works:

  • fix(tui): restore exit shortcuts on plugin routes #20515 checks route === "plugin" (positive match). If a new route type is added later, it won't be covered and the same bug reappears.
  • This PR checks route !== "home" && route !== "session" (negative guard). Home and session already handle app_exit in their own components, so everything else gets the fallback automatically — including any future route types.

Happy to close this if maintainers prefer the other approach, but wanted to offer the alternative since #20515 has been open for a few days with failing e2e checks.

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: keyboard exit shortcuts non-functional on plugin routes

1 participant