fix: resolve correctness, panic, and UX issues from review - #16
Merged
Conversation
Batch of fixes from a codebase review (one intended behavior, the amend --date=now rewrite, was deliberately left as-is). HIGH - ai: write agent stdin on a separate thread to avoid a pipe deadlock on large prompts (commit --ai with a big staged diff could hang forever once the output pipe buffers filled). MEDIUM - commit: --amend --ai now diffs against HEAD's parent instead of the index, so it generates a message from the commit being amended instead of failing with "nothing to commit". - repo_setup: stop the copy_files array parser at a ']' only when it is outside a quoted value (a ']' in a path no longer drops entries). - repo_setup: escape newlines/tabs/CR in TOML strings (and decode \r) so saved configs round-trip. - ui: add scrolling to the file picker and setup file picker; the cursor could previously move below the fold and off-screen. - ui/log_viewer: route scroll adjustment through the guarded shared helper, fixing an underflow panic on very short terminals. - git: pass `--` before path/ref positionals in worktree add/remove, rebase, and branch delete to prevent argument injection. LOW - git/stash: locate "on " in stash messages via ASCII byte windows on the original string (lowercasing first could slice mid-char/panic on non-ASCII branch names). - pr: surface a non-zero exit from the interactive troubleshoot agent. - ui: don't type unhandled Ctrl-combos into the branch/workspace search. - git/branch: sort the recent-commits revwalk by time (newest first). - git/time: now_secs falls back to epoch instead of panicking on a pre-1970 clock. - setup: emit shell aliases in a stable, sorted order. - repo_setup: fall back to a duplicated stderr fd when /dev/stderr is unavailable instead of aborting the setup script. - ui/branch_picker: fetch branch info off-thread so the picker no longer freezes on each selection change. Also dedupes adjust_scroll into ui::adjust_scroll and syncs Cargo.lock to 0.3.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A batch of fixes surfaced by a full codebase review. One reported item — the
--amend --date=nowrewrite — was deliberately left as-is (intended behavior).HIGH
ai.rspipe deadlock — stdin is now written on a separate thread whilewait_with_outputdrains stdout/stderr concurrently. Previouslycommit --aiwith a large staged diff could hang forever once the agent's output pipe buffers filled.MEDIUM
commit --amend --ainow diffs the index against HEAD's parent (newget_amend_diff()), so it generates a message from the commit being amended instead of failing with "nothing to commit".repo_setupcopy_files parser stops at a]only when it's outside a quoted value — a]inside a path no longer silently drops later entries.repo_setupconfig round-trip — newlines/tabs/CR are escaped in TOML strings (and\ris decoded), so saved configs parse back correctly.log_viewerroutes scroll adjustment through the guarded shared helper, fixing an underflow panic on very short terminals.worktreeadd/remove/rebase/branch-delete pass--before path/ref positionals to prevent argument injection. (Verifiedcheckoutmust not get--, so it's untouched.)LOW
"on "via ASCII byte-windows on the original string — no more mid-char panic/wrong slice on non-ASCII branch names.prtroubleshoot surfaces a non-zero exit from the interactive agent.now_secsfalls back to epoch instead of panicking on a pre-1970 clock.gx setupemits aliases in a stable, sorted order./dev/stderris unavailable.Also dedupes
adjust_scrollintoui::adjust_scrolland syncsCargo.lockto 0.3.0.Testing
cargo build,cargo clippy --all-targets, andcargo testall pass (127 tests, including 6 new ones covering the array parser, escaping round-trip, and the stash non-ASCII case).