[Bug]: Atuin seems to randomly "forget" lots of history also strange fuzzy search behavior.
NeckBeardPrince opened this issue · 7 comments
What did you expect to happen?
I went to search my history for gcloud
but there were no valid hits. I know I just used that command about 20 times this week, so it didn't make sense that nothing was showing up. Well, when I say nothing, I mean nothing that has the word gcloud
in it. None of those commands have the word gcloud, I tried "gcloud" and just gcloud
. Nothing.
❯ docker run \
-e KEYCLOAK_URL="<removed>" \
-e KEYCLOAK_USER="<removed>" \
-e KEYCLOAK_PASSWORD="<removed>" \
-e KEYCLOAK_AVAILABILITYCHECK_ENABLED=true \
-e KEYCLOAK_AVAILABILITYCHECK_TIMEOUT=120s \
-e IMPORT_FILES_LOCATIONS='/config/*' \
-v $PWD/config:/config \
adorsys/keycloak-config-cli:latest
What happened?
Running atuin stats
atuin is counting the times I've used gcloud
.
❯ atuin sync
Uploading 8 records to 0190c3daa0ed7c53933dd5eaeb013b8f/history
[00:00:00] [####################################################################################################################################################################################################################] 8/8 (0.0s)9/0 up/down to record store
Sync complete! 37598 items in history database, force: false
❯ atuin sync --force
Uploading 1 records to 0190c3daa0ed7c53933dd5eaeb013b8f/history
[00:00:00] [####################################################################################################################################################################################################################] 1/1 (0.0s)2/0 up/down to record store
Sync complete! 37599 items in history database, force: true
Checking the SQLite db 37599 is the number of rows I have.
If I search the command column for contains gcloud
I get 675 rows.
If I cat ~/.zsh_history | grep gcloud
I see results.
Atuin doctor output
{
"atuin": {
"version": "18.3.0",
"sync": {
"cloud": false,
"records": true,
"auto_sync": true,
"last_sync": "2024-08-28 19:16:08.379861 +00:00:00"
},
"sqlite_version": "3.44.0"
},
"shell": {
"name": "zsh",
"default": "zsh",
"plugins": [
"atuin"
],
"preexec": "built-in"
},
"system": {
"os": "Darwin",
"arch": "arm64",
"version": "14.6.1",
"disks": [
{
"name": "Macintosh HD",
"filesystem": "apfs"
},
{
"name": "Macintosh HD",
"filesystem": "apfs"
},
{
"name": "Backups",
"filesystem": "apfs"
},
{
"name": "Time Machine",
"filesystem": "apfs"
}
]
}
}
Code of Conduct
- I agree to follow this project's Code of Conduct
I ran atuin import auto
then atuin sync
.
I have a cronjob that runs atuin sync
every 30min or so. I ran atuin sync
several times while troubleshooting this.
❯ atuin import auto
Atuin
======================
🌍
🐘🐘🐘🐘
🐢
======================
Importing history...
Detected ZSH
Importing history from zsh
██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████ 11273/11273Import complete!
❯ atuin sync
Uploading 5 records to 0190c3daa0ed7c53933dd5eaeb013b8f/history
[00:00:00] [####################################################################################################################################################################################################################] 5/5 (0.0s)6/0 up/down to record store
48553 in history index, but 37617 in history store
Running automatic history store init...
Import complete Re-running sync due to new records locally
Uploading 10964 records to 0190c3daa0ed7c53933dd5eaeb013b8f/history
[00:00:12] [##########################################################################################################################################################################################################] 10,964/10,964 (0.0s)10965/0 up/down to record store
Sync complete! 48553 items in history database, force: false
It looks like you're doing "HOST" searches here and are using macos. Is it possible that the hostname macos is reporting is different between the time when the command is looked up and the content stored in the history database?
See #2391 for an issue I wrote about this and a workaround.
It looks like you're doing "HOST" searches here and are using macos. Is it possible that the hostname macos is reporting is different between the time when the command is looked up and the content stored in the history database?
See #2391 for an issue I wrote about this and a workaround.
Hmmm interesting, I just installed 15.1. Are you saying that on 15.0 you should no longer have this issue, and you don't need to run scutil --set HostName bar
anymore? Or that you still do need to, even if on 15.0?
Hmmm interesting, I just installed 15.1. Are you saying that on 15.0 you should no longer have this issue, and you don't need to run
scutil --set HostName bar
anymore? Or that you still do need to, even if on 15.0?
- MacOS before 15.0: Send "local hostname" (configurable in settings) to DHCP server hostname, potentially assigned a name like "mylocalhostname.foo.example.com" or "mylocalhostname.something.else.if.dhcpserver.decides.it.example.com".
- MacOS on 15.0 and later: Send a generic hardware name ("MacBookPro") to the DHCP server as the hostname, now assigned "MacBookPro.foo.example.com" or "MacBookPro.something.else.if.dhcpserver.decides.it.example.com".
In both cases (before 15.0 and on 15.0 and later) its desirable to use scutil --set HostName bar
to get a fixed hostname from the hostname command/function so that atuin has a consistent idea about what host one is running commands (given the current use of hostname for this. Probably, there should be some unique identifier used that isn't the hostname but is generated on initialization of atuin or obtained from the system itself).
Updating to MacOS 15.0 from something before 15.0 will change the hostname in many cases, causing atuin after the upgrade to potentially believe the host is different (because the hostname changed), and Host searches in atuin will return a new/different list of commands. And if on MacOS 15.0 and later, it's more likely that if someone has multiple computers, atuin (due to hostname stuff) might consider them to be the same/different computer depending on which gets their hostname assignment first.
I noticed this issue (in #2391) because it showed up for me more clearly after the macos upgrade to 15.0.
You can check if this is what you're seeing here by seeing what hostname
returns and then examining the history.db
for entires in the hostname column with different hostname variations/suffixes.
Hmmm interesting, I just installed 15.1. Are you saying that on 15.0 you should no longer have this issue, and you don't need to run
scutil --set HostName bar
anymore? Or that you still do need to, even if on 15.0?* MacOS before 15.0: Send "local hostname" (configurable in settings) to DHCP server hostname, potentially assigned a name like "mylocalhostname.foo.example.com" or "mylocalhostname.something.else.if.dhcpserver.decides.it.example.com". * MacOS on 15.0 and later: Send a generic hardware name ("MacBookPro") to the DHCP server as the hostname, now assigned "MacBookPro.foo.example.com" or "MacBookPro.something.else.if.dhcpserver.decides.it.example.com".
In both cases (before 15.0 and on 15.0 and later) its desirable to use
scutil --set HostName bar
to get a fixed hostname from the hostname command/function so that atuin has a consistent idea about what host one is running commands (given the current use of hostname for this. Probably, there should be some unique identifier used that isn't the hostname but is generated on initialization of atuin or obtained from the system itself).Updating to MacOS 15.0 from something before 15.0 will change the hostname in many cases, causing atuin after the upgrade to potentially believe the host is different (because the hostname changed), and Host searches in atuin will return a new/different list of commands. And if on MacOS 15.0 and later, it's more likely that if someone has multiple computers, atuin (due to hostname stuff) might consider them to be the same/different computer depending on which gets their hostname assignment first.
I noticed this issue (in #2391) because it showed up for me more clearly after the macos upgrade to 15.0.
You can check if this is what you're seeing here by seeing what
hostname
returns and then examining thehistory.db
for entires in the hostname column with different hostname variations/suffixes.
Well, you're entirely correct. I just checked the sqlite db and in the hostname column and the hostname for the same laptop has indeed changed several times! So, I guess the next steps would be to run the scutil --set HostName
command then purge my Atuin database and then do a new import from my ~/.zsh_history
.
Hmmm interesting, I just installed 15.1. Are you saying that on 15.0 you should no longer have this issue, and you don't need to run
scutil --set HostName bar
anymore? Or that you still do need to, even if on 15.0?* MacOS before 15.0: Send "local hostname" (configurable in settings) to DHCP server hostname, potentially assigned a name like "mylocalhostname.foo.example.com" or "mylocalhostname.something.else.if.dhcpserver.decides.it.example.com". * MacOS on 15.0 and later: Send a generic hardware name ("MacBookPro") to the DHCP server as the hostname, now assigned "MacBookPro.foo.example.com" or "MacBookPro.something.else.if.dhcpserver.decides.it.example.com".
In both cases (before 15.0 and on 15.0 and later) its desirable to use
scutil --set HostName bar
to get a fixed hostname from the hostname command/function so that atuin has a consistent idea about what host one is running commands (given the current use of hostname for this. Probably, there should be some unique identifier used that isn't the hostname but is generated on initialization of atuin or obtained from the system itself).
Updating to MacOS 15.0 from something before 15.0 will change the hostname in many cases, causing atuin after the upgrade to potentially believe the host is different (because the hostname changed), and Host searches in atuin will return a new/different list of commands. And if on MacOS 15.0 and later, it's more likely that if someone has multiple computers, atuin (due to hostname stuff) might consider them to be the same/different computer depending on which gets their hostname assignment first.
I noticed this issue (in #2391) because it showed up for me more clearly after the macos upgrade to 15.0.
You can check if this is what you're seeing here by seeing whathostname
returns and then examining thehistory.db
for entires in the hostname column with different hostname variations/suffixes.Well, you're entirely correct. I just checked the sqlite db and in the hostname column and the hostname for the same laptop has indeed changed several times! So, I guess the next steps would be to run the
scutil --set HostName
command then purge my Atuin database and then do a new import from my~/.zsh_history
.
Looks like LocalHostName and HostName are different. I ended up setting them both to the same thing.
❯ scutil --get LocalHostName
Adams-MacBook-Pro
❯ scutil --set HostName Adams-MRI-MacBook-Pro
❯ scutil --get LocalHostName
Adams-MacBook-Pro
❯ scutil --set HostName Adams-MRI-MacBook-Pro
❯ scutil --get LocalHostName
Adams-MacBook-Pro
❯ scutil --get HostName
Adams-MRI-MacBook-Pro
❯ scutil --set LocalHostName Adams-MRI-MacBook-Pro
❯ scutil --get LocalHostName
Adams-MRI-MacBook-Pro