Inspecting a session
====================

Use the **Session Detail** page to inspect every SQL statement an AI
agent executed, along with its execution metadata, in two views: a
step-by-step reconstruction and a flat audit log.

Inspecting the page header
--------------------------

The header shows:

- **Session ID** — the session identifier, as a large monospace title.

- **Started** — the formatted timestamp of the first statement.

- **Purpose** — a tag showing the declared purpose, when one is
  available.

- **Steps** — a badge showing the total statement count.

Viewing the step-by-step reconstruction
---------------------------------------

Use the **Reconstruction** tab to step through the session
chronologically. Each step is a single SQL statement with its full
execution context, presented as an expandable accordion.

Collapsed step
^^^^^^^^^^^^^^

Each collapsed step shows, at a glance:

- The step number, for example Step 1.

- A command tag for the SQL command type (``SELECT`` , ``INSERT`` ,
  ``UPDATE`` , ``DELETE`` , and so on).

- An error severity tag, shown only when the statement errored (red for
  ``ERROR`` , ``FATAL`` , or ``PANIC`` ).

- The timestamp and duration, right-aligned — for example
  ``14:30:45 · 45ms`` .

Expanded step
^^^^^^^^^^^^^

Selecting a step expands it to reveal the request panel, which is shown
by default and contains:

- **SQL statement** — the statement, in a syntax-highlighted code block.

- **SQLSTATE code** — shown as a tag when it isn’t ``00000`` (success).

- **Properties** — a grid of execution metadata:

.. csv-table::
  :header: Property,Description
  :widths: 10,30
  :align: left
  :class: longtable

  Database,Target database name
  User,Postgres role used
  PID,Backend process ID
  PG Session ID,Postgres session identifier
  Query ID,Internal query plan ID
  Duration,Execution time in milliseconds
  application_name,"The full Airman tag, for example `airman:billing/a1b2c3d4`"

Accordion mode
^^^^^^^^^^^^^^

By default, you can expand multiple steps at once. When **Accordion
steps** is enabled in settings, expanding a step automatically collapses
the previously open one — useful for sessions with many steps where
screen space is limited.

Viewing the flat audit log
--------------------------

The **Audit Log** tab presents the same session data as a flat table,
optimized for scanning and filtering across all steps at once.

Audit log columns
^^^^^^^^^^^^^^^^^

.. csv-table::
  :header: Column,Description
  :widths: 10,30
  :align: left
  :class: longtable

  Time,"Timestamp, monospace and right-aligned"
  SQL,"Statement text, monospace, truncated with an ellipsis"
  Purpose,Declared purpose

Searching the audit log
^^^^^^^^^^^^^^^^^^^^^^^

The toolbar’s search field matches across the SQL text, purpose, and
timestamps. Type a term to filter the table, and clear it to show all
steps again.

Configuring page size
^^^^^^^^^^^^^^^^^^^^^

The table shows 10 rows per page by default, configurable to 10, 20, or
50.
