UAT: agents cleanup purge --all shows misleading 'Session cleanup not implemented' note even when no inactive sessions exist #3993

Open
opened 2026-04-06 08:22:08 +00:00 by freemo · 0 comments
Owner

Metadata

  • Branch: fix/cleanup-purge-misleading-session-note
  • Commit Message: fix(cli): remove misleading session-cleanup note from agents cleanup purge --all output
  • Milestone: (backlog — no milestone assigned)
  • Parent Epic: #365 (Epic: Concurrency & Cleanup)

Backlog note: This issue was discovered during autonomous operation
on milestone v3.7.0. It does not block milestone completion and has been
placed in the backlog for human review and future milestone assignment.

Background and Context

The agents cleanup purge --all command in src/cleveragents/cli/commands/cleanup.py unconditionally displays a note about session cleanup being unimplemented whenever --all is used and report.sessions.removed == 0. Because _purge_sessions() is a no-op stub (see #3941), this condition is always true — meaning every invocation of agents cleanup purge --all shows the note, regardless of whether any inactive sessions actually exist.

This is a UX bug distinct from #3941 (which tracks implementing the actual session cleanup). Even once #3941 is resolved, the note's condition (sessions.removed == 0) would still fire incorrectly when cleanup runs successfully but finds no sessions to remove.

Current Behavior

# src/cleveragents/cli/commands/cleanup.py ~lines 130-143
if purge_all and report.sessions.removed == 0:
    console.print(
        "\n[dim]Note: Session cleanup is not yet implemented. "
        "Inactive sessions must be removed manually.[/dim]"
    )

This condition is always true because _purge_sessions() is a no-op stub. Every agents cleanup purge --all invocation shows:

Note: Session cleanup is not yet implemented. Inactive sessions must be removed manually.

even when there are zero inactive sessions in the database (a valid, clean outcome).

Steps to reproduce:

  1. Run: agents cleanup purge --all --yes
  2. Observe: "Note: Session cleanup is not yet implemented. Inactive sessions must be removed manually."
  3. This note appears even if there are zero inactive sessions in the database.

Expected Behavior

When agents cleanup purge --all --yes is run and there are no inactive sessions, the command should complete cleanly without showing a misleading note about unimplemented features. The note about session cleanup being unimplemented should only appear when the feature is actually unimplemented — not as a permanent fixture of the output gated on sessions.removed == 0.

Acceptance Criteria

  • The misleading sessions.removed == 0 note is removed from cleanup.py.
  • Running agents cleanup purge --all --yes on a system with no inactive sessions produces clean output with no misleading notes.
  • Once #3941 is implemented, the output naturally shows sessions.removed=N when sessions are cleaned, with no spurious notes.
  • All existing cleanup tests continue to pass.

Supporting Information

Code location:

  • src/cleveragents/cli/commands/cleanup.pypurge() function, lines ~130–143

Fix suggestion:
Remove the misleading note block entirely. Once session cleanup is implemented (see #3941), the output will naturally show sessions.removed=N when sessions are cleaned. If a transitional "not yet implemented" note is desired, it should be unconditional (not gated on sessions.removed == 0) and removed when #3941 is resolved:

# Remove this block entirely:
# if purge_all and report.sessions.removed == 0:
#     console.print(
#         "\n[dim]Note: Session cleanup is not yet implemented. "
#         "Inactive sessions must be removed manually.[/dim]"
#     )

Related issues:

  • #3941 — UAT: CleanupService session scan and purge are placeholder stubs (the root cause; this issue is a UX symptom)
  • #3843 — Refactor: Implement DB session logic in cleanup_service.py

Subtasks

  • Remove the if purge_all and report.sessions.removed == 0: note block from cleanup.py
  • Verify agents cleanup purge --all --yes produces clean output with no misleading notes when no inactive sessions exist
  • Tests (Behave): Add/update scenario asserting no misleading note appears in purge --all output when sessions count is zero
  • Run nox (all default sessions), fix any errors
  • Verify coverage ≥ 97% via nox -s coverage_report

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • The misleading session-cleanup note is removed from cleanup.py.
  • 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.
  • All nox stages pass.
  • Coverage ≥ 97%.

Automated by CleverAgents Bot
Supervisor: UAT Testing | Agent: ca-new-issue-creator

## Metadata - **Branch**: `fix/cleanup-purge-misleading-session-note` - **Commit Message**: `fix(cli): remove misleading session-cleanup note from agents cleanup purge --all output` - **Milestone**: *(backlog — no milestone assigned)* - **Parent Epic**: #365 (Epic: Concurrency & Cleanup) > **Backlog note:** This issue was discovered during autonomous operation > on milestone v3.7.0. It does not block milestone completion and has been > placed in the backlog for human review and future milestone assignment. ## Background and Context The `agents cleanup purge --all` command in `src/cleveragents/cli/commands/cleanup.py` unconditionally displays a note about session cleanup being unimplemented whenever `--all` is used and `report.sessions.removed == 0`. Because `_purge_sessions()` is a no-op stub (see #3941), this condition is **always true** — meaning every invocation of `agents cleanup purge --all` shows the note, regardless of whether any inactive sessions actually exist. This is a UX bug distinct from #3941 (which tracks implementing the actual session cleanup). Even once #3941 is resolved, the note's condition (`sessions.removed == 0`) would still fire incorrectly when cleanup runs successfully but finds no sessions to remove. ## Current Behavior ```python # src/cleveragents/cli/commands/cleanup.py ~lines 130-143 if purge_all and report.sessions.removed == 0: console.print( "\n[dim]Note: Session cleanup is not yet implemented. " "Inactive sessions must be removed manually.[/dim]" ) ``` This condition is always true because `_purge_sessions()` is a no-op stub. Every `agents cleanup purge --all` invocation shows: > `Note: Session cleanup is not yet implemented. Inactive sessions must be removed manually.` even when there are zero inactive sessions in the database (a valid, clean outcome). **Steps to reproduce:** 1. Run: `agents cleanup purge --all --yes` 2. Observe: "Note: Session cleanup is not yet implemented. Inactive sessions must be removed manually." 3. This note appears even if there are zero inactive sessions in the database. ## Expected Behavior When `agents cleanup purge --all --yes` is run and there are no inactive sessions, the command should complete cleanly without showing a misleading note about unimplemented features. The note about session cleanup being unimplemented should only appear when the feature is actually unimplemented — not as a permanent fixture of the output gated on `sessions.removed == 0`. ## Acceptance Criteria - The misleading `sessions.removed == 0` note is removed from `cleanup.py`. - Running `agents cleanup purge --all --yes` on a system with no inactive sessions produces clean output with no misleading notes. - Once #3941 is implemented, the output naturally shows `sessions.removed=N` when sessions are cleaned, with no spurious notes. - All existing cleanup tests continue to pass. ## Supporting Information **Code location:** - `src/cleveragents/cli/commands/cleanup.py` — `purge()` function, lines ~130–143 **Fix suggestion:** Remove the misleading note block entirely. Once session cleanup is implemented (see #3941), the output will naturally show `sessions.removed=N` when sessions are cleaned. If a transitional "not yet implemented" note is desired, it should be unconditional (not gated on `sessions.removed == 0`) and removed when #3941 is resolved: ```python # Remove this block entirely: # if purge_all and report.sessions.removed == 0: # console.print( # "\n[dim]Note: Session cleanup is not yet implemented. " # "Inactive sessions must be removed manually.[/dim]" # ) ``` **Related issues:** - #3941 — UAT: `CleanupService` session scan and purge are placeholder stubs (the root cause; this issue is a UX symptom) - #3843 — Refactor: Implement DB session logic in cleanup_service.py ## Subtasks - [ ] Remove the `if purge_all and report.sessions.removed == 0:` note block from `cleanup.py` - [ ] Verify `agents cleanup purge --all --yes` produces clean output with no misleading notes when no inactive sessions exist - [ ] Tests (Behave): Add/update scenario asserting no misleading note appears in `purge --all` output when sessions count is zero - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage ≥ 97% via `nox -s coverage_report` ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - The misleading session-cleanup note is removed from `cleanup.py`. - 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. - All nox stages pass. - Coverage ≥ 97%. --- **Automated by CleverAgents Bot** Supervisor: UAT Testing | Agent: ca-new-issue-creator
HAL9000 added this to the v3.5.0 milestone 2026-04-09 03:12:13 +00:00
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.

Blocks
#365 Epic: Concurrency & Cleanup
cleveragents/cleveragents-core
Reference
cleveragents/cleveragents-core#3993
No description provided.