Skip to content

fix(nu): ignore missing history id in pre-prompt#3537

Open
cyphercodes wants to merge 1 commit into
atuinsh:mainfrom
cyphercodes:fix-nushell-history-id-overlay-3520
Open

fix(nu): ignore missing history id in pre-prompt#3537
cyphercodes wants to merge 1 commit into
atuinsh:mainfrom
cyphercodes:fix-nushell-history-id-overlay-3520

Conversation

@cyphercodes

Copy link
Copy Markdown

Fixes #3520.

This changes the Nushell pre-prompt hook to use hide-env -i ATUIN_HISTORY_ID, matching the startup cleanup above it. That keeps overlay/subshell prompts from erroring when ATUIN_HISTORY_ID is already absent.

Checks

  • I am happy for maintainers to push small adjustments to this PR, to speed up the review cycle
  • I have checked that there are no existing pull requests for the same thing

Verification:

  • git diff --check
  • nu was not available in this runner, so I could not run a local Nushell source smoke test.

@github-actions

Copy link
Copy Markdown
Contributor

Fossier: Manual Review Requested

@cyphercodes is a new contributor. A maintainer should review this PR before merging.

Score Breakdown

Total Score: 58.3/100 | Confidence: 100% | Outcome: REVIEW

Signal Value Score Weight
account_age 4437 1.00 0.09
public_repos 336 1.00 0.05
contribution_history 338 1.00 0.05
follower_ratio 7.0 1.00 0.05
bot_signals False 0.50 0.04
open_prs_elsewhere 166 0.00 0.09
closed_prs_elsewhere 125 0.00 0.10
merged_prs_elsewhere 139 1.00 0.08
prior_interaction 0 0.00 0.08
activity_velocity 1 1.00 0.08
pr_content ... 0.70 0.08
commit_email no_email 0.50 0.04
pr_description ... 0.70 0.05
repo_stars 30291 0.30 0.04
org_membership 0 0.20 0.03
commit_verification ... 0.30 0.04
contributor_stars 83 1.00 0.04

@greptile-apps

greptile-apps Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds -i (ignore) flag to hide-env ATUIN_HISTORY_ID in the Nushell pre-prompt hook, matching the identical call already present in the startup block (line 15). This prevents errors in overlay/subshell prompts where ATUIN_HISTORY_ID may be absent.

One subtlety: _atuin_pre_prompt already has an early-return guard (if 'ATUIN_HISTORY_ID' not-in $env { return }) that should prevent hide-env from being reached when the variable is absent. The fix is still correct and defensive — it suggests Nushell overlay/subshell scoping can make $env not-in checks and hide-env see different environments.

Confidence Score: 4/5

Safe to merge — minimal one-line defensive fix with no regression risk.

Change is correct, matches existing startup code, and fixes a real user-reported error. Minor open question about the overlay scoping edge case that makes both the guard and -i necessary, but that doesn't block merging.

No files require special attention.

Important Files Changed

Filename Overview
crates/atuin/src/shell/atuin.nu One-line fix: adds -i to hide-env in pre-prompt hook, matching startup behavior. No regression risk.

Reviews (1): Last reviewed commit: "fix(nu): ignore missing history id in pr..." | Re-trigger Greptile


}
hide-env ATUIN_HISTORY_ID
hide-env -i ATUIN_HISTORY_ID

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The hide-env -i addition is correct and matches the startup call on line 15. However, _atuin_pre_prompt already has if 'ATUIN_HISTORY_ID' not-in $env { return } at the top — logically, hide-env should only be reached when the variable is present, so the original should not error under normal scoping.

The fact that it does error (#3520) implies Nushell overlay/subshell environments can make not-in $env and hide-env disagree about variable visibility. Adding -i is the right defensive fix, but it would be useful to document this overlay-scoping edge case in a comment so future maintainers understand why both the guard and -i are needed.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Environment variable 'ATUIN_HISTORY_ID' not found while using nushell overlay

1 participant