Repository: UKGovernmentBEIS/inspect_ai
Issue: Setting `INSPECT_LOG_LEVEL_TRANSCRIPT` to `debug` causes invalid log level `trace` error
Root cause: Validation Gap

Setting `INSPECT_LOG_LEVEL_TRANSCRIPT` to `debug` causes the following error:

```
pydantic_core._pydantic_core.ValidationError: 1 validation error for LoggingMessage
level
  Input should be 'debug', 'http', 'sandbox', 'info', 'warning', 'error' or 'critical' [type=literal_error, input_value='trace', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
```

Full stack trace is:

```
Traceback (most recent call last):
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/bin/inspect", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_cli/main.py", line 56, in main
    inspect(auto_envvar_prefix="INSPECT")
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/click/core.py", line 1161, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/click/core.py", line 1082, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/click/core.py", line 1697, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/click/core.py", line 1443, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/click/core.py", line 788, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_cli/common.py", line 51, in wrapper
    return cast(click.Context, func(*args, **kwargs))
                               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_cli/common.py", line 101, in wrapper
    return cast(click.Context, func(*args, **kwargs))
                               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_cli/eval.py", line 405, in wrapper
    return cast(click.Context, func(*args, **kwargs))
                               ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_cli/eval.py", line 481, in eval_command
    eval_exec(
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_cli/eval.py", line 827, in eval_exec
    eval(**params)
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_eval/eval.py", line 165, in eval
    return task_display().run_task_app(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_display/textual/display.py", line 47, in run_task_app
    raise result.value
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/textual/worker.py", line 368, in _run
    self._result = await self.run()
                   ^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/textual/worker.py", line 352, in run
    return await (
           ^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/textual/worker.py", line 339, in _run_async
    return await self._work
           ^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_eval/eval.py", line 416, in eval_async
    await eval_run(
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_eval/run.py", line 214, in eval_run
    return await run_single(task_run_options)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_eval/run.py", line 237, in run_single
    return await asyncio.gather(*asyncio_tasks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_eval/task/run.py", line 391, in task_run
    eval_log = await logger.log_finish(
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_eval/task/log.py", line 172, in log_finish
    return await self.recorder.log_finish(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/log/_recorders/eval.py", line 195, in log_finish
    await log.flush()
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/log/_recorders/eval.py", line 368, in flush
    with trace_action(logger, "Log Write", self._file):
  File "/opt/anaconda3/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_util/trace.py", line 60, in trace_action
    logger.log(
  File "/opt/anaconda3/lib/python3.12/logging/__init__.py", line 1609, in log
    self._log(level, msg, args, **kwargs)
  File "/opt/anaconda3/lib/python3.12/logging/__init__.py", line 1684, in _log
    self.handle(record)
  File "/opt/anaconda3/lib/python3.12/logging/__init__.py", line 1700, in handle
    self.callHandlers(record)
  File "/opt/anaconda3/lib/python3.12/logging/__init__.py", line 1762, in callHandlers
    hdlr.handle(record)
  File "/opt/anaconda3/lib/python3.12/logging/__init__.py", line 1028, in handle
    self.emit(record)
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_util/logger.py", line 112, in emit
    notify_logger_record(record, write)
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/_util/logger.py", line 184, in notify_logger_record
    transcript()._event(LoggerEvent(message=LoggingMessage.from_log_record(record)))
                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/inspect_ai/log/_message.py", line 46, in from_log_record
    return LoggingMessage(
           ^^^^^^^^^^^^^^^
  File "/Users/trevor/Dev/ai/pivotal/single-function/.venv/lib/python3.12/site-packages/pydantic/main.py", line 214, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)

pydantic_core._pydantic_core.ValidationError: 1 validation error for LoggingMessage
level
  Input should be 'debug', 'http', 'sandbox', 'info', 'warning', 'error' or 'critical' [type=literal_error, input_value='trace', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
```


This should be addressed here: https://github.com/UKGovernmentBEIS/inspect_ai/commit/d49607dd4666185bcdd07943b6cac45f434c6736