tui: minor correctness/perf fixes (Etap 5)
...
The last batch from the code review โ real bugs and edge cases, not cosmetics:
- tui_app._resolve_session: read session_id with .get and return None when a
malformed server response omits it, instead of KeyError slipping past the
api-call except (5.B3).
- cli /switch: surface the original error cause (404 vs network vs server) on
a non-unique prefix match instead of swallowing it into a generic "not found"
(6.B2).
- input_box _complete_command: a bare "/" with no hint list available no longer
auto-picks the first command in the registry (3.B3).
- filesystem _render_grep: when the grep ran in regex mode, highlight with the
actual regex so marked spans match what the server found โ a literal highlight
of a regex pattern would mark nothing (2.B2).
- file_refs _collect_files: filter sensitive entries out in the generator before
sorted() so a huge directory is not fully materialized only to be mostly
discarded (5.P1).
- renderers/tool ToolResultRenderer: cap a generic tool result at 200 lines
(tail + marker) so a non-filesystem tool with huge output does not flood the
chat bubble โ filesystem has its own renderer (2.P3).
Tests: malformed-response /switch error surfacing, bare-slash no-auto-pick,
grep regex highlight, sensitive-subdir skip, tool-result truncation. Full
suite: 953 passed, 1 skipped.
Eugene Sukhodolskiy
committed
10 hours ago