Skip to content

history | last x is in wrong order #17646

@NotTheDr01ds

Description

@NotTheDr01ds

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

last shouldn't change the order of the list, but it does for SQLite items after #17415.

How to reproduce

With SQLite-backed history:

1
2
3
history | last 4
# => ╭───┬─────────────────┬──────────────────┬─────────────────────────────────┬──────────┬─────────────╮
# => │ # │ start_timestamp │     command      │               cwd               │ duration │ exit_status │
# => ├───┼─────────────────┼──────────────────┼─────────────────────────────────┼──────────┼─────────────┤
# => │ 0 │   1771974767271 │ history | last 4 │ /home/ntd/src/ntd-forks/nushell │          │             │
# => │ 1 │   1771974764596 │ 3                │ /home/ntd/src/ntd-forks/nushell │        1 │           0 │
# => │ 2 │   1771974764178 │ 2                │ /home/ntd/src/ntd-forks/nushell │        1 │           0 │
# => │ 3 │   1771974763737 │ 1                │ /home/ntd/src/ntd-forks/nushell │        1 │           0 │
# => ╰───┴─────────────────┴──────────────────┴─────────────────────────────────┴──────────┴─────────────╯

Expected behavior

Should be in ascending order.

Configuration

key value
version 0.110.1
major 0
minor 110
patch 1
branch main
commit_hash 9bfac0a
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.91.1 (ed61e7d7e 2025-11-07)
rust_channel 1.91.1-x86_64-unknown-linux-gnu
cargo_version cargo 1.91.1 (ea2d97820 2025-10-10)
build_time 2026-02-24 02:41:42 -05:00
build_rust_channel release
allocator standard
features default, mcp, network, plugin, rustls-tls, sqlite, trash-support
installed_plugins formats 0.106.2, gstat 0.106.2, polars 0.106.2, query 0.106.2
experimental_options example=false, reorder-cell-paths=true, pipefail=true, enforce-runtime-annotations=false

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-triageAn issue that hasn't had any proper look

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions