Feature: Session CLI MCP logger finally block cleanup
  As a developer
  I want to ensure the MCP logger is properly restored after session operations
  So that logging behavior is consistent and predictable

  Scenario: Session create command restores MCP logger in finally block
    Given the session create function initializes mcp_logger from logging module
    When the session create command is executed with JSON format
    Then the mcp_logger.setLevel should be called to restore orig_level
    And the finally block ensures restoration even on success

  Scenario: Session list command restores MCP logger in finally block
    Given the session list function initializes mcp_logger from logging module
    When the session list command is executed with JSON format
    Then the mcp_logger.setLevel should be called to restore orig_level
    And the finally block ensures restoration even on success

  Scenario: Session create suppresses MCP logger for JSON format
    Given the session create function with format-dependent suppression
    When format is "json"
    Then MCP logger should be set to CRITICAL level

  Scenario: Session create does NOT suppress MCP logger for rich format
    Given the session create function with format-dependent suppression
    When format is "rich"
    Then MCP logger should NOT be set to CRITICAL level

  Scenario: Session list suppresses MCP logger for YAML format
    Given the session list function with format-dependent suppression
    When format is "yaml"
    Then MCP logger should be set to CRITICAL level

  Scenario: Session list does NOT suppress MCP logger for color format
    Given the session list function with format-dependent suppression
    When format is "color"
    Then MCP logger should NOT be set to CRITICAL level
