Conversation
… screen Differential redraws of the /usage panel move the cursor instead of rewriting whole lines, so stripping escapes fused fragments such as 51%usd and lost scoped weekly rows. Replay the capture on a 160x50 screen (upstream ClaudeCLIScreen, steipete#3822) before parsing and in the trust-prompt check, keeping plain reports unchanged.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adversarial validation (lane-A) at 200f610Review verdict: the branch at its published head matches the 0.65.0 audit PR-2 spec; local HEAD equals the remote head ( Checks at 200f610 (CARGO_TARGET_DIR=W:\cargo-target\lane-a, jobs=4, RUST_TEST_THREADS=4):
No new code was required; validation-only item. |
Summary
Claude CLI
/usagepanels redraw differentially: the CLI moves the cursor and rewrites only changed cells. The localparse_cli_outputusedstrip_ansi, which drops every cursor jump, so the fixture frame yields51%usdand the model-specific weekly row is lost. The capture is now replayed onto a 160x50 virtual screen (the same geometry as the PTY intty_runner.rs) before parsing, so unchanged cells of earlier frames are kept and erased content is never reused. Plain and color-only reports come back unchanged (preservePlainReportsmode), so CR-delimited legacy output is not clipped or wrapped.The replay is used in
parse_cli_output, in the workspace-trust-prompt check, and for the CLI error-marker check infetch_via_cli(rendered once, then passed on; rendering is idempotent on rendered text).Upstream reference
53d46c836/ fix(claude): replay CLI frames before parsing usage steipete/CodexBar#3854), v0.65.0.Sources/CodexBarCore/Providers/Claude/ClaudeCLIScreen.swift,ClaudeStatusProbe.swift(cleanCapture),Tests/CodexBarTests/ClaudeCLIScreenTests.swift,ClaudeCLIScreenProbeTests.swift,Tests/CodexBarTests/Fixtures/Providers/Claude/{usage,status}-pty-differential-redraw.ansi.Ported / Deferred
Ported:
rust/src/providers/claude/cli_screen.rs(697 lines, no new dependencies): tokenizer equivalent to upstream'sESC(?:\[...|\]...|.)|[^ESC]+pattern (OSC consumed whole, BEL/ST/end terminators), CSIA B C D G H f K Jwith parameters capped to two and clamped,K/Jmodes 0-2 only, CR/LF/CRLF/BS/tab, wide-glyph cells with trail cells, combining marks attached to the previous cell, wrap at column 160, scroll after row 50.unicode-segmentationis only transitive), so upstream's width rule is ported directly (wide ranges, emoji presentation, U+FE0F emoji, zero-width marks). Grapheme clustering is a small approximation of UAX fix: resolve clippy warnings #29 (marks, ZWJ sequences, emoji modifiers, regional-indicator pairs, CRLF) rather than full segmentation.usage-pty-differential-redraw.ansiandstatus-pty-differential-redraw.ansi, byte-exact from v0.65.0 (verified withcmp), underrust/src/providers/fixtures/claude/..gitattributesmarks them-textso the CR bytes survive EOL conversion.ClaudeCLIScreenTests.swift, plus the plain-report cases fromClaudeCLIScreenProbeTests.swift./usagepanels print a "Session" summary (Total duration,Usage: ... cache read) above the plan limits.is_cli_activity_stats_responsematched it and rejected the whole capture. It now yields to acurrent session/current weeksection (has_plan_limit_section); stats-only captures are still rejected (existing tests unchanged).Deferred / not applicable:
/statusidentity probe andClaudeCLISessionEscape-before-reuse (Claude CLI source: /status identity probe never runs because the reused session still has the /usage panel open (email/plan badge stay empty) steipete/CodexBar#3821): Windows has no/statusprobe and spawns a fresh PTY per fetch. The status fixture is used only to check that a redrawn identity block renders to the final frame and that the existing email/login-method extraction reads it.claude-weekly-scoped-fable, 51% used match). Left as is (pre-existing local behavior, not part of this item).Validation
Run with the pinned toolchain and a process-local
CARGO_TARGET_DIR(thepwshwrapper was refused in this worktree):cargo +1.98.0 fmt --allclean.cargo +1.98.0 clippy --workspace --all-targets -- -D warnings: pass, no warnings.cargo +1.98.0 test -p codexbar providers::claude: 180 passed, 0 failed, 1 ignored (pre-existing native-Claude test).cargo +1.98.0 test -p codexbar(full): 2176 passed, 0 failed, 1 ignored; bin test 1 passed.claude::cli_screen::tests, 16): 33 upstream vectors, joiner/flag width, OSC edge cases, synthetic differential frame vs golden, backspace, clear-screen no-resurrect, overflow parameters bounded to 50x160, wrap/scroll, range-table sortedness, plain-report preservation (CR delimiters, OSC contents, no clipping past 50 rows or 160 columns), fixture: session 97% left, weekly 73% left, reset "Resets Sep 23 at 3pm (Europe/Stockholm)", scoped Fable 51% used, andstrip_ansialone yielding51%usd.Affected areas
rust/src/providers/claude).gitattributesUI proof
Not applicable.