Skip to content

fix(nu): suppress error when ATUIN_HISTORY_ID is missing in pre_prompt hook - #3587

Merged
ellie merged 1 commit into
atuinsh:mainfrom
AndrianBalanescu:fix-issue-3520
Jul 8, 2026
Merged

fix(nu): suppress error when ATUIN_HISTORY_ID is missing in pre_prompt hook#3587
ellie merged 1 commit into
atuinsh:mainfrom
AndrianBalanescu:fix-issue-3520

Conversation

@AndrianBalanescu

Copy link
Copy Markdown
Contributor

What

Fixes a crash in the nushell integration when ATUIN_HISTORY_ID is not set in the environment.

The _atuin_pre_prompt hook calls hide-env ATUIN_HISTORY_ID at the end of every prompt. If the env var doesn't exist (e.g. when using nushell overlays/subshells that don't capture it, like nu -e "overlay use ..."), this throws an unhandled env_variable_not_found error.

How

The fix mirrors what the script already does at line 15 — use the -i (ignore-if-missing) flag:

// Before
hide-env ATUIN_HISTORY_ID

// After
hide-env -i ATUIN_HISTORY_ID

This is the exact same pattern already used in the initialization section (line 15: hide-env -i ATUIN_HISTORY_ID), so it's consistent with the existing code. The reporter of #3520 also suggested this approach. (◕‿◕)

One file, one line changed. No behavior change for the normal case (var exists → it gets hidden). Only difference: missing var no longer crashes.

Closes #3520.

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fossier: Manual Review Requested

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

Score Breakdown

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

Signal Value Score Weight
account_age 3027 1.00 0.09
public_repos 16 0.80 0.05
contribution_history 34 0.17 0.05
follower_ratio 0.18 0.09 0.05
bot_signals False 0.50 0.04
open_prs_elsewhere 8 0.00 0.09
closed_prs_elsewhere 5 0.50 0.10
merged_prs_elsewhere 0 0.20 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.55 0.05
repo_stars 30474 0.30 0.04
org_membership 0 0.20 0.03
commit_verification ... 0.30 0.04
contributor_stars 4 0.08 0.04

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds the -i (ignore-if-missing) flag to the hide-env ATUIN_HISTORY_ID call in the _atuin_pre_prompt hook, preventing a crash when ATUIN_HISTORY_ID is absent (e.g. in nushell overlays/subshells).

  • Mirrors the identical pattern already present at line 15 of the same file, making the two call sites consistent.

Confidence Score: 5/5

Safe to merge — minimal change with no behavior impact when the variable is present.

Single-flag addition to a shell script that directly fixes a crash for users running nushell overlays. Existing behavior when the variable is set is unchanged; the only effect is suppressing the error when it's absent.

No files require special attention.

Important Files Changed

Filename Overview
crates/atuin/src/shell/atuin.nu One-line fix: adds -i to hide-env ATUIN_HISTORY_ID in _atuin_pre_prompt, consistent with line 15 which already uses the same pattern.

Reviews (1): Last reviewed commit: "fix(nu): suppress error when ATUIN_HISTO..." | Re-trigger Greptile

@ellie ellie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thank you!

@ellie
ellie merged commit 95570e5 into atuinsh:main Jul 8, 2026
26 checks passed
taylordotfish pushed a commit that referenced this pull request Jul 9, 2026
### Bug Fixes

- *(ai)* Dispatch skills registered in the slash command registry
([#3593](#3593))
- *(ci)* Fossier install in scan workflow
([#3485](#3485))
- *(i18n)* Fix typos in Russian localization
([#3575](#3575))
- *(nu)* Use `char -u 1b` for ESC in OSC 133 sequences
([#3530](#3530))
- *(nu)* Suppress error when `ATUIN_HISTORY_ID` is missing in
`pre_prompt` hook
([#3587](#3587))
- *(pi)* Observe tool events instead of registering a bash tool
([#3557](#3557))
- *(pty-proxy)* Set `$SHELL` to the spawned shell
([#3548](#3548))
- *(search)* Fix terminal clearing with latest Ratatui
([#3578](#3578))
- *(sync)* Skip records that fail to decrypt or decode instead of
failing the whole store
([#3569](#3569))
- Atuin hangs when attempting to spawn daemon from Ctrl+R invocation
([#3502](#3502))
- Capture session ID from stream headers rather than final event
([#3531](#3531))
- Doctor resiliency fo runknown platforms + openbsd warning
([#3551](#3551))
- Double input on arrow keys in AI setup prompt on Windows
([#3552](#3552))
- Exclude AI agent commands from zsh-autosuggestions
([#3567](#3567))
- Silence shellcheck SC2016 on literal `$all-user` author filter
- Respect `store_failed` when using daemon
([#3571](#3571))


### Documentation

- Highlight `Ctrl-r` keybinding on docs page
([#3489](#3489))
- Document store purge workflow
([#3544](#3544))
- Fix command example typo in documentation
([#3536](#3536))
- Make commented-out lines in `config.toml` match real defaults
([#3583](#3583))
- Add fish shell cleanup step to uninstall instructions
([#3582](#3582))


### Features

- *(doctor)* Add whether daemon is enabled to `doctor` output
([#3572](#3572))
- *(pty-proxy)* Add `--shell` flag to override the spawned shell
([#3327](#3327))
- Setup fossier to stop bot slop prs
([#3482](#3482))
- Capture command output + expose to new `atuin_output` tool
([#3510](#3510))
- Cache user contexts on load until `/reload`
([#3525](#3525))
- Create database integration tests for atuin-server
([#3514](#3514))
- Add `/model` slash command for changing models
([#3576](#3576))
- Add mcp server for history tools and expand search filters
([#3581](#3581))
- Add status bar with model and usage information
([#3591](#3591))


### Miscellaneous Tasks

- *(rustdoc)* Fix Rustdoc warnings
([#3585](#3585))
- *(warnings)* Fix compile warnings with latest dependencies
([#3586](#3586))
- Vouch for all existing contributors
([#3486](#3486))
- Update GitHub app token format
- Update to Rust 1.96.1
([#3568](#3568))
- Adopt `derive_more` to reduce boilerplate across the codebase
([#3573](#3573))


### Performance

- *(search)* Scan history by recency until N unique
([#3553](#3553))
- Add `synchronous(Normal)` + `optimize_on_close` to record store SQLite
([#3577](#3577))
- Remove unnecessary clones in a hot path
([#3580](#3580))


### Refactor

- Implement `From<sqlx::Error>` and clean up `fix_error`
([#3484](#3484))
- Pull `fn into_utc` into `atuin-server-database` crate
([#3487](#3487))
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

3 participants