From 0bb58b65ecaec78d744dd31664f352f9da9dd1cb Mon Sep 17 00:00:00 2001 From: alt-glitch Date: Wed, 10 Jun 2026 22:20:09 +0530 Subject: [PATCH] opentui(v6): fix popup-boot latency regression (model.options prefetch blocked the gateway dispatcher) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The native TUI prefetches model.options right after session.create (91df32545, picker instant-open). The handler is network-bound (~3.7s: pricing fetch + Nous tier check in build_models_payload) and ran on the gateway's main dispatcher thread, so every fast-path RPC issued in the first seconds after launch — complete.slash for the '/' dropdown, session.list, config.get — sat unread behind it. Measured: first '/' dropdown 1718ms at HEAD vs 53ms at 394f45a3d (pre-prefetch baseline); 52ms after routing model.options onto the existing RPC thread pool (_LONG_HANDLERS). The /model picker keeps its 29ms cached open. --- tui_gateway/server.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tui_gateway/server.py b/tui_gateway/server.py index c85abb904ad..2098f3e20e1 100644 --- a/tui_gateway/server.py +++ b/tui_gateway/server.py @@ -175,6 +175,12 @@ _LONG_HANDLERS = frozenset( { "browser.manage", "cli.exec", + # model.options is network-bound (pricing fetch + Nous tier check via + # build_models_payload, ~seconds). The native TUI prefetches it right + # after session.create; on the main thread that stalls every fast-path + # RPC — notably complete.slash, so the first `/` dropdown after launch + # took seconds to paint. + "model.options", "session.branch", "session.compress", "session.resume",