warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
20.93k stars 358 forks source link

History only searches the last few days #4964

Open aminya opened 3 months ago

aminya commented 3 months ago

Dupe Check

Describe the bug

I have noticed that Warp forgets the commands I type after a few days. For example, I can only browse for up to two days, and refining the search doesn't bring up the old commands.

command history

If I open the Sqlite database at /home/aminya/.local/state/warp-terminal/warp.sqlite, I can see my commands that are as old as 2 months, but they don't show up in the history search

Sqlite db

This is unfortunate since Warp takes over Mcfly, so I can't use that with CTRL+R, and the only workaround to access my older commands is using the mcfly executable directly.

To reproduce

Try to search a command you ran a long time ago.

Expected behavior

Having access to all the command history

Operating system

Linux

Operating system and version

KDE Neon 6 - Ubuntu 22.04

Shell Version

5.1.16(1)

Current Warp version

v0.2024.05.21.16.09.stable_02

Regression

No, this bug or issue has existed throughout my experience using Warp

Recent working Warp date

No response

Additional context

My settings:

{
  "prefs": {
    "ExperimentId": "2882fda0-7fb8-4f9d-91fc-9fc4a799c08d",
    "LaunchNotebookShown": "true",
    "ReferralThemeActive": "true",
    "InputMode": "\"Waterfall\"",
    "AutosuggestionAcceptedCount": "2",
    "AIAssistantRequestLimitInfo": "{\"limit\":100,\"num_requests_used_since_refresh\":5,\"next_refresh_time\":\"2024-03-30T07:59:10.354201Z\"}",
    "NotebookFontSize": "14.0",
    "CustomSecretRegexList": "[]",
    "TelemetryEnabled": "true",
    "OpenFileEditor": "\"VSCodeInsiders\"",
    "HasDismissedWarpDriveWelcome": "true",
    "ReceivedReferralTheme": "\"Inactive\"",
    "ChangelogVersions": "{\"v0.2024.02.27.08.01.stable_03\":true,\"v0.2024.03.05.08.02.stable_00\":true,\"v0.2024.03.05.08.02.stable_01\":true,\"v0.2024.03.12.08.02.stable_01\":true,\"v0.2024.03.12.08.02.stable_02\":true,\"v0.2024.03.19.08.01.stable_01\":true,\"v0.2024.03.26.08.02.stable_01\":true,\"v0.2024.03.26.08.02.stable_02\":true,\"v0.2024.04.02.08.02.stable_01\":true,\"v0.2024.04.09.08.01.stable_01\":true,\"v0.2024.04.16.08.02.stable_00\":true,\"v0.2024.04.16.08.02.stable_01\":true,\"v0.2024.04.16.08.02.stable_03\":true,\"v0.2024.04.23.08.01.stable_03\":true,\"v0.2024.04.30.08.02.stable_01\":true,\"v0.2024.04.30.08.02.stable_02\":true,\"v0.2024.05.07.08.02.stable_02\":true,\"v0.2024.05.14.08.01.stable_02\":true,\"v0.2024.05.14.08.01.stable_04\":true,\"v0.2024.05.21.16.09.stable_01\":true,\"v0.2024.05.21.16.09.stable_02\":true}",
    "WelcomeTipsFeaturesUsed": "[{\"Action\":\"SplitPane\"},{\"Action\":\"AiCommandSearch\"},{\"Hint\":\"CreateBlock\"},{\"Action\":\"CommandSearch\"},{\"Action\":\"CommandPalette\"},{\"Action\":\"ThemePicker\"},{\"Hint\":\"BlockSelect\"},{\"Action\":\"OpenWarpDrive\"},{\"Action\":\"WarpAI\"},{\"Hint\":\"BlockAction\"}]",
    "AliasExpansionEnabled": "true",
    "Spacing": "\"Normal\"",
    "SafeModeEnabled": "true",
    "Theme": "\"CyberWave\"",
    "AddedSubshellCommands": "[\"poetry shell\",\"fly console\"]",
    "WelcomeTipsCompleted": "true",
    "Shortcuts": "true",
    "AliasExpansionBannerSeen": "true",
    "Notifications": "{\"mode\":\"Enabled\",\"is_long_running_enabled\":true,\"long_running_threshold\":{\"secs\":30,\"nanos\":0},\"is_password_prompt_enabled\":true}",
    "PreferMarkdownViewer": "false",
    "FontSize": "9.0",
    "MouseScrollMultiplier": "8.0",
    "WorkflowsBoxOpen": "true",
    "ShouldDimInactivePanes": "true",
    "CrashReportingEnabled": "true",
    "EmacsBindingsBannerState": "\"Dismissed\"",
    "HasAutoOpenedWelcomeFolder": "true"
  }
}
---
"editor_view:cut_word_left": none
"workspace:close_active_tab": ctrl-w
"terminal:paste": ctrl-shift-V
"workspace:new_tab": ctrl-t
"terminal:clear_blocks": ctrl-shift-L
"terminal:warpify_subshell": ctrl-shift-i

Does this block you from using Warp daily?

Yes

Is this a Warp specific issue? (i.e. does it happen in Terminal, iTerm, Kitty, etc.)

Yes, this I confirmed this only happens in Warp, not other terminals.

Warp Internal (ignore): linear-label:b9d78064-c89e-4973-b153-5178a31ee54e

Ignore

Also similar to #2627

dannyneira commented 3 months ago

Hi @aminya sorry to hear about this. Are you able to confirm you don't have any history settings in your rc files to limit the history? Also, as a possible workaround you should be able run the history command to see older history.

dannyneira commented 3 months ago

To anyone else facing this issue, please add a 👍 to the original post at the top or comment with your details, and subscribe if you'd like to be notified.

aminya commented 3 months ago

Hi @aminya sorry to hear about this. Are you able to confirm you don't have any history settings in your rc files to limit the history? Also, as a possible workaround you should be able run the history command to see older history.

Other than having mcfly installed, I don't see anything changing the history settings


# Add mcfly to bash
eval "$(mcfly init bash)"
alias ms="mcfly search"
dannyneira commented 3 months ago

Please try disabling it just for Warp to see if that helps with the history length. Add the following conditional around the mcfly lines.

if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
    eval "$(mcfly init bash)"
    alias ms="mcfly search"
fi
aminya commented 3 months ago

Thanks, I tried that, but the history search didn't find my old commands.

Here's the relevant parts of my rc file just in case:

# tabtab source for packages
# uninstall by removing these lines
[ -f ~/.config/tabtab/bash/__tabtab.bash ] && . ~/.config/tabtab/bash/__tabtab.bash || true

# Add mcfly to bash
if [[ $TERM_PROGRAM != "WarpTerminal" ]]; then
    eval "$(mcfly init bash)"
    alias ms="mcfly search"
fi

source "$HOME/.config/broot/launcher/bash/br"

# Add starship to bash
eval "$(starship init bash)"

eval "$(zoxide init bash)"
alias cd=z
asenci commented 3 months ago

Same is happening to me.

Also, it seems that Warp is trying to do some cleaver "context-aware" command history search based on the current directory and this doesn't always work. I'll try to search for a command I ran a few weeks ago and the search will come back empty, but if I change directories, it will find the command with the exact same search term.

Also also, sometimes I try to search for a string in the middle of the command and the search will prioritise all commands which start with that string instead of sorting by recency.

Can we get an option to disable all those "smart" search functions, please? Sometimes all I want to do is literally get the last command that I typed which has a specific word in it and it becomes a struggle.

aminya commented 1 month ago

Any solutions? I have enabled mcfly back because Warp's command history just doesn't work. I'd suggest against the comment here

vigotskij commented 1 month ago

This is also happening on MacOS, version: v0.2024.07.16.08.02.stable_03. It has been present for the last 4 or 5 weeks.

aminya commented 3 weeks ago

I have written a tool that fixes the Warp history issue. The issue is that Warp only relies on ~/.bash_history for command searching. Using this tool, you can insert all the commands from Warp or Mcfly into ~/.bash_history so warp correctly searches.

https://github.com/aminya/warp-history