Commit Graph
4411 Commits
Author SHA1 Message Date
Felipe Coury 1ad1d84b51 test(tui): harden table scrollback invariants
Add debug guardrails around stream stable/tail accounting and prevent live stream tail cells from being committed through generic history paths.

Add regressions for confirmed table holdback, resize with a mutable table tail, and finalizing live table tails exactly once.
2026-04-12 17:34:15 -03:00
Felipe Coury ab291ef5d5 fix(tui): reflow live table tail after resize
Allow the pending resize reflow to run while an agent or plan stream is
active so boxed markdown tables are rerendered at the latest width.
2026-04-08 12:07:18 -03:00
Felipe Coury ab5c7c3489 fix(tui): keep blank-separated fenced table examples fenced
Require markdown-fenced table detection to match the parser table
shape, where the delimiter row immediately follows the header row.

This avoids stripping fences from examples that only look table-like
when blank lines are ignored.
2026-04-07 12:42:59 -03:00
Felipe Coury 42efa1a80a fix(tui): prepare app-level interrupts locally
Run the same local stream cleanup for app-level interrupt commands
as for direct widget submissions, clearing queued stream output and
transient tails before the backend response arrives.

Also ensure consolidated proposed-plan stream cells force the required
scrollback reflow when replacing an existing streamed cell run.
2026-04-07 12:42:08 -03:00
Felipe Coury 7a4c131e89 fix(tui): preserve sparse pipe table rows
Track table row source ranges while rendering Markdown tables so
single-cell rows that still use pipe syntax remain part of the table
grid instead of being classified as spillover prose.

Add regression coverage for sparse single-cell pipe rows with trailing
and leading pipe syntax.
2026-04-07 12:41:37 -03:00
Felipe Coury 367370b25e fix(tui): prevent duplicate table scrollback
Defer live table tails during stream consolidation so their provisional
render is not inserted before the canonical markdown cell is rebuilt.

Use the stronger combined scrollback and visible-screen clear path during
transcript reflow so tmux does not preserve stale viewport table output.
2026-04-06 15:08:24 -03:00
Felipe Coury 9c7296d38a fix(tui): update markdown tests for cwd rendering
Pass cwd arguments through test-only markdown constructors after the
rebase so the TUI test target builds against the cwd-aware renderer
APIs.

Keep the formatter output from the required post-rebase `just fmt`
run in the same follow-up change.
2026-04-06 14:18:33 -03:00
Felipe Coury 177fb27d81 wip: save dirty state before worktree cleanup 2026-04-06 14:13:44 -03:00
Felipe Coury d25a110a2d core(tui): clippy 2026-04-06 13:55:06 -03:00
Felipe Coury 9c090a9a93 chore(tui): apply rustfmt import ordering cleanup
Capture formatter-only import ordering updates in two TUI files to keep the
working tree clean after recent core changes.

No behavior changes are included in this commit.
2026-04-06 13:55:06 -03:00
Felipe Coury 81642155e2 chore(core): tighten syntect policy and monitor wording
Pin `syntect` to `=5.3.0` and add explicit review dates to the
existing `RUSTSEC-2024-0320` and `RUSTSEC-2025-0141` exceptions in
`deny.toml` so dependency risk review stays deliberate.

Fix grammar in `core/src/agent/builtins/monitor.toml` developer
instructions and add a realtime conversation test that returns `None`
when a message item is missing `content`.
2026-04-06 13:54:15 -03:00
Felipe Coury f704629368 fix(core): harden realtime input routing and mirroring
Ignore empty or whitespace-only realtime transcript input so we do not
create no-op user turns from blank transcriptions.

Move realtime text mirroring off the `send_event` hot path and add
bounded truncation for mirrored patch output and file lists, while
adding a serde alias for `background_terminal_timeout` compatibility.
2026-04-06 13:51:32 -03:00
Felipe Coury 6343a292e8 fix(tui): post-rebase fixups for upstream API changes
- Use codex_protocol::protocol instead of codex_core::protocol (made
  private upstream)
- Add missing word_wrap_lines import in history_cell tests
- Update column classification test for URL-like token heuristic
2026-04-06 13:47:22 -03:00
Felipe Coury bc60690d75 fix(tui): prevent link columns from collapsing in markdown tables
Adjust table column classification in `markdown_render.rs` so token-heavy,
low-word-density columns are treated as Structured instead of Narrative.

This keeps URL-heavy link columns from being first in the shrink order,
reducing rare but severe narrow-column wrapping in rendered tables.
2026-04-06 13:45:49 -03:00
Felipe Coury 70bc4fc226 fix(tui): keep plan streams incremental during table output
Disable table holdback for `PlanStreamController` by adding a
per-stream `TableHoldbackMode` in `StreamCore`. Agent streams keep
holdback enabled, while plan streams now enqueue table lines
incrementally.

Also treat plan live tail as active in `stream_controllers_idle()` and
add regression coverage in `codex-rs/tui/src/streaming/controller.rs`
and `codex-rs/tui/src/chatwidget/tests.rs` to prevent premature
`StopCommitAnimation` and preserve streaming behavior.
2026-04-06 13:45:48 -03:00
Felipe Coury 341efe5d60 fix(tui): address stream interrupt and markdown edge cases
Improve resize reflow scheduling so due reflows request an immediate frame
instead of waiting for unrelated redraws, and clear queued stream output on
`Op::Interrupt` so stale lines stop rendering immediately.

Harden markdown/table parsing by treating tab indentation as 4-column
whitespace in `strip_line_indent` and ignoring escaped-only pipes in
`parse_table_segments` unless explicit outer pipes are present.
2026-04-06 13:42:16 -03:00
Felipe Coury 36761c5863 perf(tui): reduce allocations and add compiler hints in md-table pipeline
Replace clone with mem::take in finalize(), return Cow from
unwrap_markdown_fences for zero-copy on fence-free messages, use
index-based iteration in reflow loop, add #[inline] on ~20 hot-path
functions, add with_capacity hints on hot Vecs/Strings, box large
ActiveFence variant, and eliminate minor allocations (into_iter,
Span::from for literals, write!-based plain_text, redundant .max(1)).
2026-04-06 13:42:16 -03:00
Felipe Coury c0db2f0dc1 refactor(tui): simplification pass over md-table rendering pipeline
Remove accumulated duplication and dead code across the md-table
branch: extract shared helpers (trailing_run_start<T>, strip_line_indent,
compute_target_stable_len, reset_history_emission_state,
maybe_finish_stream_reflow, is_blockquote_active, active_cell_is_stream_tail),
collapse redundant conditionals (normalize_row, FenceTracker Option state,
merged match arms), delete duplicate methods and tests, and fix stale
doc comments. No behavioral changes; -86 net lines.
2026-04-06 13:42:16 -03:00
Felipe Coury a66e481c36 fix(tui): keep non-blockquoted markdown fences with blockquote table examples
Strip blockquote prefixes during table detection only when the fence
itself is inside a blockquote, preventing false unwrapping of fences
that contain blockquoted table examples as illustration content.
2026-04-06 13:40:19 -03:00
Felipe Coury f038bb5c74 fix(tui): restore boxed markdown tables with emoji content 2026-04-06 13:40:19 -03:00
Felipe Coury 1a031ee706 fix(tui): avoid boxed tables for width-unstable emoji cells 2026-04-06 13:40:18 -03:00
Felipe Coury 57ff94cf96 fix(tui): preserve streaming table rows in active tail 2026-04-06 13:40:18 -03:00
Felipe Coury 1f01de087c fix(tui): consolidate md-table resize handling and fence parsing 2026-04-06 13:40:18 -03:00
Felipe Coury bcf2897a05 tui: simplify markdown table streaming and fix resize queue stall 2026-04-06 13:40:18 -03:00
Felipe Coury 107af5e583 fix(tui): make streaming width deterministic before first render 2026-04-06 13:36:23 -03:00
Felipe Coury 4c9b69b75d fix(tui): guard tick_batch zero drain and remove needless async tests
- tick_batch(0) now returns empty instead of silently draining one line
- has_live_tail avoids Vec allocation via field comparison
- Convert 15 sync-only controller tests from tokio::test to #[test]
2026-04-06 13:35:50 -03:00
Felipe Coury 2fd2259286 fix(tui): streaming remap and resize 2026-04-06 13:35:05 -03:00
Felipe Coury 4afa1d0a77 test(tui): unit tests for column-metrics and spillover detection
Address reviewer concerns about self-referential test coverage:

- Column-metrics: 6 tests for TableColumnKind classification,
  preferred_column_floor caps, and next_column_to_shrink priority.
- Spillover detection: 6 tests for is_spillover_row covering each
  heuristic branch and negative cases.
2026-04-06 13:33:32 -03:00
Felipe Coury e64f777765 fix(tui): streamed table resize corruption and history reflow robustness 2026-04-06 13:33:31 -03:00
Felipe Coury edc5008dd0 tui: fix interrupt behavior during heavy streaming 2026-04-06 13:31:52 -03:00
Felipe Coury e7381d57ba tui: add incremental table holdback scanner and timing probes 2026-04-06 13:26:29 -03:00
Felipe Coury 282ff99bf5 tui: reduce table streaming cost with prefix-cache fast paths 2026-04-06 13:26:29 -03:00
Felipe Coury f1ee30daa3 tui: use source-mapped boundaries for stream resize remap 2026-04-06 13:26:28 -03:00
Felipe Coury 3c9f8d1eaf tui: tighten table holdback boundaries and add streaming coverage 2026-04-06 13:22:52 -03:00
Felipe Coury 27ed715de7 fix(tui): wrap fallback tables and clamp narrow stream widths 2026-04-06 13:21:54 -03:00
Felipe Coury 31bd54d7a2 fix(tui): narrow pending holdback and honor blockquote fences 2026-04-06 13:20:54 -03:00
Felipe Coury b0fe9b742d fix(tui): keep commit animation alive for active plan stream 2026-04-06 13:20:54 -03:00
Felipe Coury 75f05c8bda fix(tui): tighten fence indent and sparse spillover detection 2026-04-06 13:19:49 -03:00
Felipe Coury de9c17d1e2 docs(tui): documentation pass over table rendering pipeline
Add module-level, type-level, and function-level documentation across
the table rendering pipeline: table_detect, width, markdown,
markdown_render, and streaming/controller. Separate spillover lines
from table grid output via RenderedTableLines so spillover prose
routes through normal word wrapping instead of bypassing it.
2026-04-06 13:19:49 -03:00
Felipe Coury 0830073146 fix(tui): track resize reflow across stream consolidation 2026-04-06 13:19:21 -03:00
Felipe Coury f6ef212f76 fix(tui): detect single-column tables and narrow spillover 2026-04-06 13:17:53 -03:00
Felipe Coury 2d6cb4ed1a fix(tui): clear transient tails and spill trailing label lines 2026-04-06 13:17:53 -03:00
Felipe Coury ed087e1fa4 fix(tui): avoid committing transient stream tail cells 2026-04-06 13:16:56 -03:00
Felipe Coury d9035a61b0 docs(tui): clarify markdown table streaming contracts 2026-04-06 13:16:13 -03:00
Felipe Coury 38664bc2fb fix(tui): keep link suffixes inside table cells 2026-04-06 13:15:21 -03:00
Felipe Coury 7b7f233e36 fix(tui): escape pipes in table fallback rows 2026-04-06 13:14:40 -03:00
Felipe Coury be9006c161 fix(tui): centralize usable-width guards for narrow layouts 2026-04-06 13:14:40 -03:00
Felipe Coury 8a94c65989 fix(tui): tighten spillover and fence-close table parsing 2026-04-06 13:13:05 -03:00
Felipe Coury 14d66912f3 docs(tui): documentation pass over table rendering pipeline
Add module, type, and function-level doc comments across the table
rendering change. Fix typos ("taht", "mirros", "stabe", "durin").
Expand streaming controller module docs to cover holdback and resize
handling. Document width allocation, spillover detection, consolidation,
and prewrapped line rendering contracts. No runtime behavior changes
in documentation edits; also includes extracted draw helpers in app.rs
and a fence-detection fix in markdown.rs.
2026-04-06 13:13:04 -03:00
Felipe Coury 004e85e09e feat(tui): integrate table rendering into streaming pipeline with reflow
Wire the Unicode box-drawing table renderer into the live streaming
path with holdback-aware commit logic, post-stream cell consolidation,
and debounced resize reflow.

Key additions:
- StreamCore: shared bookkeeping deduplicating Stream/PlanStreamController
- Table holdback: fence-aware state machine keeps buffer mutable during table detection
- AgentMarkdownCell: stores raw markdown source, re-renders at any width on demand
- ConsolidateAgentMessage: backward-walk replaces streamed cells with single consolidated cell
- Resize reflow: debounced (75ms) re-render of all transcript cells after terminal resize
2026-04-06 13:12:29 -03:00