Commit 65fe683
perf(tui): stop polling nori-skillsets; cache version (#444)
## Summary
- `spawn_system_info_worker` in `codex-rs/tui/src/app/mod.rs` was firing
a full `SystemInfo` refresh every 5 seconds via `recv_timeout`
fall-through, which in turn spawned `nori-skillsets --version` and
`nori-skillsets list-active` as Node.js subprocesses. With several
concurrent `nori` sessions this produced sustained CPU load just to
paint the footer (see discovery notes below). Switch to blocking
`recv()` so refreshes only happen on explicit
`request_system_info_refresh()` calls.
- Cache `nori-skillsets --version` in a process-wide `OnceLock`
(`NORI_VERSION_CACHE`) in `codex-rs/tui/src/system_info.rs`. The
installed CLI version is stable for the lifetime of the TUI process, so
the subprocess runs at most once per session. `list-active` is still
re-invoked on every refresh.
- Document the new event-driven refresh model and version caching in
`codex-rs/tui/docs.md`.
Refreshes are still triggered on: startup, user message submit, task
completion, effective cwd changes (debounced 500ms by
`EffectiveCwdTracker`), and skillset install/switch success.
### Tradeoff
An external `nori-skillsets switch` run in another terminal while the
TUI is idle will not be reflected in the footer until the user does
something that triggers a refresh. Discussed and accepted.
### Impact
- Per-session baseline load: ~0.4 `nori-skillsets` spawns/sec → **0**
when idle.
- Per-refresh cost: 2 subprocesses → 1.
## Test plan
- [x] `cargo test -p nori-tui` — 1199 passed, 0 failed
- [x] `just fmt` + `just fix -p nori-tui` — clean
- [x] `cargo build --bin nori` — success
- [x] `cargo test -p tui-pty-e2e` — all suites pass
- [x] End-to-end: launched `nori --agent elizacp` under tmux; TUI
rendered, `›` prompt appeared, footer populated with active skillset and
cached version string; user submit triggered a refresh that updated the
footer. No panics.
Co-authored-by: Nori <contact@tilework.tech>1 parent 959dedf commit 65fe683
3 files changed
Lines changed: 40 additions & 25 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
230 | 246 | | |
231 | 247 | | |
232 | 248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
355 | | - | |
356 | | - | |
357 | | - | |
358 | | - | |
359 | | - | |
360 | | - | |
| 354 | + | |
| 355 | + | |
361 | 356 | | |
362 | 357 | | |
363 | 358 | | |
| |||
556 | 551 | | |
557 | 552 | | |
558 | 553 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | 554 | | |
563 | 555 | | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
577 | 563 | | |
578 | 564 | | |
579 | 565 | | |
580 | 566 | | |
581 | | - | |
| 567 | + | |
582 | 568 | | |
583 | | - | |
| 569 | + | |
584 | 570 | | |
585 | 571 | | |
586 | 572 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
161 | 162 | | |
162 | 163 | | |
163 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
164 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
165 | 178 | | |
166 | 179 | | |
167 | 180 | | |
| |||
0 commit comments