Skip to content

fix(repl): reload persisted history across sessions - #372

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/issue-355-new2
Oct 16, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/issue-355-new2

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • explicitly reload the backing history file when constructing the interactive Reedline editor
  • preserve existing memory-only degradation and leave DSR/file completion untouched

Validation

@caomengxuan666
caomengxuan666 merged commit 0969863 into master Oct 16, 2026
11 checks passed
@caomengxuan666
caomengxuan666 deleted the fix/issue-355-new2 branch October 16, 2026 03:45
caomengxuan666 added a commit that referenced this pull request Oct 18, 2026
…its (closes #373)

Follow-up to #355 (findings 3 and 4; history persistence was #372).

Sub-item 1, DSR fallback: interactive startup anchored the prompt with an
ESC[6n cursor-position query and reedline 0.50 ABORTED read_line when it
timed out — on a terminal that never answers (dumb terminals, script(1)
recordings, some serial/tmux links) every startup paid a ~2.6 s stall,
printed 'line editor error: The cursor position could not be read within a
normal duration', and exited before painting any prompt. The editor bump to
reedline 0.52 treats the query as advisory: the prompt paints without a
reply and every later cycle stays interactive (crossterm's fixed 2 s query
budget is the remaining per-cycle cost on the unix path; degrade-not-die).
Windows/ConPTY cannot exercise the silent path at all — measured on this
harness (Win10 19045): a silent session's transcript is exactly ESC[6n,
conhost withholds the client before its first instruction until the
terminal answers, a terminal-side contract below niu (Windows Terminal,
pywinpty's agent and the shared test driver all answer).
tests/issue373.rs pins both halves: the answering control leg everywhere,
the silent regression leg on unix.

Sub-item 2, file completion commit: with the engine's partial completions
off, menu activation spliced NOTHING into the line — 'cat uniqfi<TAB>' kept
'cat uniqfi' with the completed word drawn only as the menu's highlighted
entry, and Enter executed the uncompleted path (cat error). Every TAB now
commits the GNU readline shape: the longest common prefix of the candidate
set is spliced into the line, a lone candidate commits outright, the grid
still shows for an ambiguous set. reedline 0.52 also offers an open menu
first refusal at Enter (nushell's completion cell: first Enter accepts,
second submits); a bash-like shell runs the line as typed, so the wrapper
prefixes a typed Enter with a menu-dismissal Esc — gated to the TAB window
(a TAB may leave the menu alive; a CONTROL chord ends the window, so the
Ctrl+R search's accepting Enter stays the bare event its handler
implements — an unconditional wrap made it a dead key, dropping whole
Multiple batches in search mode). One Enter submits, bash's accept-line,
grid up or not. quick_completions stays OFF deliberately: its
lone-candidate path simulates Enter (accept AND execute).

Sub-item 3, TTP: scripts/perf/ttp-bench.py measures spawn-to-first-prompt
against GNU bash over the same ConPTY harness with NIU_TRACE_STARTUP
attribution. Release binaries, N=5 medians, Win10 19045: master niu
3164.5 ms vs bash 3260.2 ms; fix niu 3139.8 ms vs bash 3289.3 ms — parity,
no regression (the wall clock is this machine's ConPTY transport floor;
niu's internal startup is ~70-140 ms).

Regression evidence: runtime lib 542+ passed / 1 failed
(test_get_builtin_commands, fails identically on the master baseline),
interactive 65 passed / 5 failed (the byte-identical master-baseline
failure set; one load flake per run), issue373 3/3 (DSR control + silent
split, full Ctrl+R flow), completion_probe 29/29, repl_command 11/11.
tab_completes_command_name and tab_completes_unique_file_path are
un-ignored and green (the rubash#287 residuals are fixed by this change);
tab_completion_empty_set_enter_still_submits pins the F5 shape.
caomengxuan666 added a commit that referenced this pull request Oct 18, 2026
…its (closes #373)

Follow-up to #355 (findings 3 and 4; history persistence was #372).

Sub-item 1, DSR fallback: interactive startup anchored the prompt with an
ESC[6n cursor-position query and reedline 0.50 ABORTED read_line when it
timed out — on a terminal that never answers (dumb terminals, script(1)
recordings, some serial/tmux links) every startup paid a ~2.6 s stall,
printed 'line editor error: The cursor position could not be read within a
normal duration', and exited before painting any prompt. The editor bump to
reedline 0.52 treats the query as advisory: the prompt paints without a
reply and every later cycle stays interactive (crossterm's fixed 2 s query
budget is the remaining per-cycle cost on the unix path; degrade-not-die).
Windows/ConPTY cannot exercise the silent path at all — measured on this
harness (Win10 19045): a silent session's transcript is exactly ESC[6n,
conhost withholds the client before its first instruction until the
terminal answers, a terminal-side contract below niu (Windows Terminal,
pywinpty's agent and the shared test driver all answer).
tests/issue373.rs pins both halves: the answering control leg everywhere,
the silent regression leg on unix.

Sub-item 2, file completion commit: with the engine's partial completions
off, menu activation spliced NOTHING into the line — 'cat uniqfi<TAB>' kept
'cat uniqfi' with the completed word drawn only as the menu's highlighted
entry, and Enter executed the uncompleted path (cat error). Every TAB now
commits the GNU readline shape: the longest common prefix of the candidate
set is spliced into the line, a lone candidate commits outright, the grid
still shows for an ambiguous set. reedline 0.52 also offers an open menu
first refusal at Enter (nushell's completion cell: first Enter accepts,
second submits); a bash-like shell runs the line as typed, so the wrapper
prefixes a typed Enter with a menu-dismissal Esc — gated to the TAB window
(a TAB may leave the menu alive; a CONTROL chord ends the window, so the
Ctrl+R search's accepting Enter stays the bare event its handler
implements — an unconditional wrap made it a dead key, dropping whole
Multiple batches in search mode). One Enter submits, bash's accept-line,
grid up or not. quick_completions stays OFF deliberately: its
lone-candidate path simulates Enter (accept AND execute).

Sub-item 3, TTP: scripts/perf/ttp-bench.py measures spawn-to-first-prompt
against GNU bash over the same ConPTY harness with NIU_TRACE_STARTUP
attribution. Release binaries, N=5 medians, Win10 19045: master niu
3164.5 ms vs bash 3260.2 ms; fix niu 3139.8 ms vs bash 3289.3 ms — parity,
no regression (the wall clock is this machine's ConPTY transport floor;
niu's internal startup is ~70-140 ms).

Regression evidence: runtime lib 542+ passed / 1 failed
(test_get_builtin_commands, fails identically on the master baseline),
interactive 65 passed / 5 failed (the byte-identical master-baseline
failure set; one load flake per run), issue373 3/3 (DSR control + silent
split, full Ctrl+R flow), completion_probe 29/29, repl_command 11/11.
tab_completes_command_name and tab_completes_unique_file_path are
un-ignored and green (the rubash#287 residuals are fixed by this change);
tab_completion_empty_set_enter_still_submits pins the F5 shape.
caomengxuan666 added a commit that referenced this pull request Oct 18, 2026
…its (closes #373)

Follow-up to #355 (findings 3 and 4; history persistence was #372).

Sub-item 1, DSR fallback: interactive startup anchored the prompt with an
ESC[6n cursor-position query and reedline 0.50 ABORTED read_line when it
timed out — on a terminal that never answers (dumb terminals, script(1)
recordings, some serial/tmux links) every startup paid a ~2.6 s stall,
printed 'line editor error: The cursor position could not be read within a
normal duration', and exited before painting any prompt. The editor bump to
reedline 0.52 treats the query as advisory: the prompt paints without a
reply and every later cycle stays interactive (crossterm's fixed 2 s query
budget is the remaining per-cycle cost on the unix path; degrade-not-die).
Windows/ConPTY cannot exercise the silent path at all — measured on this
harness (Win10 19045): a silent session's transcript is exactly ESC[6n,
conhost withholds the client before its first instruction until the
terminal answers, a terminal-side contract below niu (Windows Terminal,
pywinpty's agent and the shared test driver all answer).
tests/issue373.rs pins both halves: the answering control leg everywhere,
the silent regression leg on unix.

Sub-item 2, file completion commit: with the engine's partial completions
off, menu activation spliced NOTHING into the line — 'cat uniqfi<TAB>' kept
'cat uniqfi' with the completed word drawn only as the menu's highlighted
entry, and Enter executed the uncompleted path (cat error). Every TAB now
commits the GNU readline shape: the longest common prefix of the candidate
set is spliced into the line, a lone candidate commits outright, the grid
still shows for an ambiguous set. reedline 0.52 also offers an open menu
first refusal at Enter (nushell's completion cell: first Enter accepts,
second submits); a bash-like shell runs the line as typed, so the wrapper
prefixes a typed Enter with a menu-dismissal Esc — gated to the TAB window
(a TAB may leave the menu alive; a CONTROL chord ends the window, so the
Ctrl+R search's accepting Enter stays the bare event its handler
implements — an unconditional wrap made it a dead key, dropping whole
Multiple batches in search mode). One Enter submits, bash's accept-line,
grid up or not. quick_completions stays OFF deliberately: its
lone-candidate path simulates Enter (accept AND execute).

Sub-item 3, TTP: scripts/perf/ttp-bench.py measures spawn-to-first-prompt
against GNU bash over the same ConPTY harness with NIU_TRACE_STARTUP
attribution. Release binaries, N=5 medians, Win10 19045: master niu
3164.5 ms vs bash 3260.2 ms; fix niu 3139.8 ms vs bash 3289.3 ms — parity,
no regression (the wall clock is this machine's ConPTY transport floor;
niu's internal startup is ~70-140 ms).

Regression evidence: runtime lib 542+ passed / 1 failed
(test_get_builtin_commands, fails identically on the master baseline),
interactive 65 passed / 5 failed (the byte-identical master-baseline
failure set; one load flake per run), issue373 3/3 (DSR control + silent
split, full Ctrl+R flow), completion_probe 29/29, repl_command 11/11.
tab_completes_command_name and tab_completes_unique_file_path are
un-ignored and green (the rubash#287 residuals are fixed by this change);
tab_completion_empty_set_enter_still_submits pins the F5 shape.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant