Skip to content

Preserve leading-space command history privacy (#990) - #998

Merged
Kuddev merged 4 commits into
mainfrom
review/nonui-history-leading-space-990-20261116
Nov 16, 2026
Merged

Kuddev merged 4 commits into
mainfrom
review/nonui-history-leading-space-990-20261116

Conversation

@Kuddev

@Kuddev Kuddev commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Integrate #990 so commands beginning with an ASCII space stay out of Pebrel command history. Enter handling preserves the raw command through the shared history gate, while activity bookkeeping still receives normalized text. CMD capture removes a prompt separator only when the typed mirror identifies it, keeping ambiguous recall out of history.

The original PR head remains in the ancestry. This branch only adapts the new regression imports to the renamed terminal crate and records the capture/history contract.

Validation: architecture against the Runtime-token prerequisite, formatting and whitespace checks passed. The existing history, native-confirmation, Enter and CMD regressions are retained for native CI on this head.

drchiodo and others added 4 commits November 14, 2026 03:09
A leading space now keeps a command out of Pebrel's suggestion history,
both in memory and in pebrel_history*.jsonl. This matches bash with
HISTCONTROL=ignorespace and zsh with HIST_IGNORE_SPACE, and gives you a
way to run a command with a secret argument without saving it to disk.

NebulaHistory::record owns the rule. The GPUI and legacy Enter paths
used to trim the line before recording it, so they now pass the raw
line and keep the trimmed copy for the tab icon and environment
tracking. The PSReadLine report already passed the raw line.

Refs #988
A CMD prompt such as `$P$G ` puts a space between `>` and the input.
Without an OSC 133;B boundary, the CMD fallback in prompt_line_snapshot
kept that space, so every command looked like a leading-space opt-out
and history stopped for that session. Strip one space after `>`, as the
arrow prompt branch already does.

Pebrel-launched cmd emits the boundary, so this affects nested or
foreign cmd sessions only.

Refs #988
Without an OSC 133;B boundary, the CMD fallback dropped any space after
`>`. With a plain `C:\work>` prompt, ` echo private` lost its space and
went into history. Drop the space only when the rest of the line matches
the keystroke mirror exactly, which identifies a `$P$G ` separator. Recall,
completion and cursor edits keep the space, so history skips the line.

The grid test covers a prompt with and without a trailing separator, each
with ordinary input, a typed leading space, and history recall.
@github-actions github-actions Bot added the size/M 101–500 行 label Nov 16, 2026
@Kuddev
Kuddev changed the base branch from review/nonui-runtime-token-989-20261116 to main November 16, 2026 11:11
@Kuddev
Kuddev merged commit 8224162 into main Nov 16, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M 101–500 行

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants