fix TUI tools on MacOS/Linux when network not configured#1512
Conversation
Greptile SummaryThis PR fixes a deadlock in TUI tools (
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant main()
participant autoconf
participant TUI App
participant LCMService
Note over User, LCMService: Fixed flow (this PR)
User->>main(): run lcmspy / dtop / agentspy
main()->>autoconf: autoconf() [full configure, may prompt user]
autoconf-->>User: interactive prompt (typer.confirm) if needed
User-->>autoconf: yes/no response
autoconf-->>main(): configured
main()->>TUI App: App(autoconf=False).run()
Note over TUI App: Textual now owns stdin
TUI App->>LCMService: start() [autoconf=False → check_only=True]
LCMService->>autoconf: autoconf(check_only=True) [no prompt]
autoconf-->>LCMService: ok
LCMService-->>TUI App: LCM loop running
Last reviewed commit: 20a944f |
20a944f to
fca37ff
Compare
| # start LCM before .run() takes over the terminal (raw mode), | ||
| # because autoconf uses typer.confirm() which deadlocks inside a TUI. | ||
| self.spy = GraphLCMSpy(autoconf=True, graph_log_window=0.5) | ||
| self.spy.start() |
There was a problem hiding this comment.
yeah calling start inside of init is cringe or whatever, but all other solutions are even more messy. We need LCM to start and ask the user about config stuff before the textual app starts, otherwise were going to get a deadlock
There was a problem hiding this comment.
There was a problem hiding this comment.
I think double-calling autoconf (once on the outside again on the inside) is more of a hack. Claude started with that and created a flag for turning autoconf off on the inside, but IMO thats even more of a mess.
After looking at it more, I think the better fix is for autoconf to be called in __init__ instead of in start. I'll make a PR for that
This reverts commit 0537fcb.

Problem
Stuff like
lcmspydoesn't work when the system isn't configured (Linux and MacOS)Why?
configure_systemruns, and tries to ask for yes/no inputSolution
Breaking Changes
None
How to Test
de-configure your multicast or network settings (maybe reboot) then run
lcmspyContributor License Agreement