session list truncates session IDs to 8 characters, making them unusable with session tell #10970

Closed
opened 2026-05-05 05:07:05 +00:00 by hurui200320 · 1 comment
Member

Metadata

  • Commit Message: fix(cli): display full session IDs in session list output
  • Branch: bugfix/m3-session-list-truncated-id

Background and Context

The agents session list command is the natural way for a user to discover existing session IDs after creating sessions with agents session create. A user would expect to copy an ID from session list and pass it directly to agents session tell --session <ID>. However, the IDs shown in session list are silently truncated to only 8 characters, while session tell (and every other session command) requires the full 26-character ULID. This makes the output of session list functionally useless for any follow-up command.

Current Behavior

agents session list displays only the first 8 characters of each session ID in the table:

┏━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓
┃ ID       ┃ Name      ┃ Actor  ┃ Messages ┃ Updated          ┃
┡━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩
│ 01KQV8AZ │ (unnamed) │ (none) │        0 │ 2026-05-05 05:03 │
└──────────┴───────────┴────────┴──────────┴──────────────────┘

The "Most Recent" and "Oldest" entries in the Summary panel are also truncated to 8 characters.

When a user copies this truncated ID and uses it with session tell, the command fails:

$ agents session tell --session 01KQV8AZ "hello"
Session not found: 01KQV8AZ

The full ULID (26 characters) is required and does work:

$ agents session tell --session 01KQV8AZ1MQHZ4MRBAY3MPNJTN "hello"
user: hello
assistant: Acknowledged: hello

Root Cause (identified, not yet fixed):

In src/cleveragents/cli/commands/session.py, there are three locations where the session ID is sliced to 8 characters:

  1. list_sessions() — when building the Rich table row:

    s.session_id[:8],  # Truncate ID for readability
    
  2. _session_list_dict() — for the "Most Recent" summary field:

    most_recent = sorted_sessions[0].name or sorted_sessions[0].session_id[:8]
    
  3. _session_list_dict() — for the "Oldest" summary field:

    oldest = sorted_sessions[-1].name or sorted_sessions[-1].session_id[:8]
    

The truncation in list_sessions() is the primary user-facing issue. The truncations in _session_list_dict() also propagate into the Summary panel and into machine-readable output formats (JSON/YAML), compounding the problem.

Expected Behavior

agents session list should display the full 26-character ULID for every session so that users can copy and use the ID directly with session tell, session show, session delete, session export, and any other command that accepts a session ID.

Acceptance Criteria

  • agents session list displays the full session ULID (all 26 characters) in the ID column of the Rich table.
  • The "Most Recent" and "Oldest" entries in the Summary panel display the full ULID when no session name is set.
  • The sessions[*].id field in --format json and --format yaml output contains the full ULID.
  • A session ID copied verbatim from agents session list can be passed directly to agents session tell --session <ID> without error.
  • No regression in any existing session list BDD scenarios.

Supporting Information

Reproduction steps:

# 1. Create a session
uv run agents session create

# 2. List sessions — note the ID column shows only 8 characters
uv run agents session list

# 3. Copy the truncated ID from the list and try to use it
uv run agents session tell --session <8-char-ID-from-list> "hello"
# → Session not found: <8-char-ID>

Affected file: src/cleveragents/cli/commands/session.py
Affected method (table row): cleveragents.cli.commands.session.list_sessions
Affected method (summary dict): cleveragents.cli.commands.session._session_list_dict

Subtasks

  • Remove [:8] slice from s.session_id[:8] in list_sessions() (Rich table row)
  • Remove [:8] slice from sorted_sessions[0].session_id[:8] in _session_list_dict() (Most Recent summary)
  • Remove [:8] slice from sorted_sessions[-1].session_id[:8] in _session_list_dict() (Oldest summary)
  • Tests (Behave): Add/update scenario verifying that session list output contains full ULIDs
  • Tests (Behave): Add scenario verifying a session ID from session list can be used with session tell
  • Verify coverage ≥ 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.
## Metadata - **Commit Message**: `fix(cli): display full session IDs in session list output` - **Branch**: `bugfix/m3-session-list-truncated-id` ## Background and Context The `agents session list` command is the natural way for a user to discover existing session IDs after creating sessions with `agents session create`. A user would expect to copy an ID from `session list` and pass it directly to `agents session tell --session <ID>`. However, the IDs shown in `session list` are silently truncated to only 8 characters, while `session tell` (and every other session command) requires the full 26-character ULID. This makes the output of `session list` functionally useless for any follow-up command. ## Current Behavior `agents session list` displays only the first 8 characters of each session ID in the table: ``` ┏━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓ ┃ ID ┃ Name ┃ Actor ┃ Messages ┃ Updated ┃ ┡━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩ │ 01KQV8AZ │ (unnamed) │ (none) │ 0 │ 2026-05-05 05:03 │ └──────────┴───────────┴────────┴──────────┴──────────────────┘ ``` The "Most Recent" and "Oldest" entries in the Summary panel are also truncated to 8 characters. When a user copies this truncated ID and uses it with `session tell`, the command fails: ``` $ agents session tell --session 01KQV8AZ "hello" Session not found: 01KQV8AZ ``` The full ULID (26 characters) is required and does work: ``` $ agents session tell --session 01KQV8AZ1MQHZ4MRBAY3MPNJTN "hello" user: hello assistant: Acknowledged: hello ``` **Root Cause (identified, not yet fixed):** In `src/cleveragents/cli/commands/session.py`, there are three locations where the session ID is sliced to 8 characters: 1. **`list_sessions()`** — when building the Rich table row: ```python s.session_id[:8], # Truncate ID for readability ``` 2. **`_session_list_dict()`** — for the "Most Recent" summary field: ```python most_recent = sorted_sessions[0].name or sorted_sessions[0].session_id[:8] ``` 3. **`_session_list_dict()`** — for the "Oldest" summary field: ```python oldest = sorted_sessions[-1].name or sorted_sessions[-1].session_id[:8] ``` The truncation in `list_sessions()` is the primary user-facing issue. The truncations in `_session_list_dict()` also propagate into the Summary panel and into machine-readable output formats (JSON/YAML), compounding the problem. ## Expected Behavior `agents session list` should display the full 26-character ULID for every session so that users can copy and use the ID directly with `session tell`, `session show`, `session delete`, `session export`, and any other command that accepts a session ID. ## Acceptance Criteria - [x] `agents session list` displays the full session ULID (all 26 characters) in the ID column of the Rich table. - [x] The "Most Recent" and "Oldest" entries in the Summary panel display the full ULID when no session name is set. - [x] The `sessions[*].id` field in `--format json` and `--format yaml` output contains the full ULID. - [x] A session ID copied verbatim from `agents session list` can be passed directly to `agents session tell --session <ID>` without error. - [x] No regression in any existing `session list` BDD scenarios. ## Supporting Information **Reproduction steps:** ```bash # 1. Create a session uv run agents session create # 2. List sessions — note the ID column shows only 8 characters uv run agents session list # 3. Copy the truncated ID from the list and try to use it uv run agents session tell --session <8-char-ID-from-list> "hello" # → Session not found: <8-char-ID> ``` **Affected file:** `src/cleveragents/cli/commands/session.py` **Affected method (table row):** `cleveragents.cli.commands.session.list_sessions` **Affected method (summary dict):** `cleveragents.cli.commands.session._session_list_dict` ## Subtasks - [x] Remove `[:8]` slice from `s.session_id[:8]` in `list_sessions()` (Rich table row) - [x] Remove `[:8]` slice from `sorted_sessions[0].session_id[:8]` in `_session_list_dict()` (Most Recent summary) - [x] Remove `[:8]` slice from `sorted_sessions[-1].session_id[:8]` in `_session_list_dict()` (Oldest summary) - [x] Tests (Behave): Add/update scenario verifying that `session list` output contains full ULIDs - [x] Tests (Behave): Add scenario verifying a session ID from `session list` can be used with `session tell` - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done.
hurui200320 added this to the v3.2.0 milestone 2026-05-05 05:07:18 +00:00
Author
Member

Implementation Notes

Design decision: Removing the [:8] truncation on session IDs in all three locations — Rich table row (list_sessions()), Most Recent summary (_session_list_dict()), and Oldest summary (_session_list_dict()). The 26-character ULIDs are the canonical session identifiers and must be usable directly from session list output for copy-paste into any session command (tell, show, delete, export).

Changes made in cleveragents.cli.commands.session:

  • list_sessions() (line ~350): Changed s.session_id[:8] to s.session_id in the Rich table row construction. Updated comment from "Truncate ID for readability" to "Full ULID for copy-paste compatibility with session tell".
  • _session_list_dict() (line ~154): Changed sorted_sessions[0].session_id[:8] to sorted_sessions[0].session_id for the Most Recent summary.
  • _session_list_dict() (line ~155): Changed sorted_sessions[-1].session_id[:8] to sorted_sessions[-1].session_id for the Oldest summary.

Note: The _session_list_dict() already stores s.session_id (full ULID) in the id field of each session entry in the dict — this was never truncated. The truncation only affected the summary fields (most_recent/oldest fallbacks) and the Rich table display. JSON and YAML structured output was already correct (the id field in sessions[*].id was never truncated); only the summary panel fields leaked the truncation into those formats.

## Implementation Notes **Design decision:** Removing the `[:8]` truncation on session IDs in all three locations — Rich table row (`list_sessions()`), Most Recent summary (`_session_list_dict()`), and Oldest summary (`_session_list_dict()`). The 26-character ULIDs are the canonical session identifiers and must be usable directly from `session list` output for copy-paste into any session command (`tell`, `show`, `delete`, `export`). **Changes made in `cleveragents.cli.commands.session`:** - `list_sessions()` (line ~350): Changed `s.session_id[:8]` to `s.session_id` in the Rich table row construction. Updated comment from "Truncate ID for readability" to "Full ULID for copy-paste compatibility with session tell". - `_session_list_dict()` (line ~154): Changed `sorted_sessions[0].session_id[:8]` to `sorted_sessions[0].session_id` for the Most Recent summary. - `_session_list_dict()` (line ~155): Changed `sorted_sessions[-1].session_id[:8]` to `sorted_sessions[-1].session_id` for the Oldest summary. **Note:** The `_session_list_dict()` already stores `s.session_id` (full ULID) in the `id` field of each session entry in the dict — this was never truncated. The truncation only affected the summary fields (`most_recent`/`oldest` fallbacks) and the Rich table display. JSON and YAML structured output was already correct (the `id` field in `sessions[*].id` was never truncated); only the summary panel fields leaked the truncation into those formats.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
cleveragents/cleveragents-core#10970
No description provided.