Skip to content

Sessions write Session traces beside their Session logs #985

Closed

Description

@JacobStephens2

Parent

#700

What to build

Every agent session, of every kind and on every Harness, also writes its Session trace, using the writer from #982 and the normalized events from #983 and #984. Its Session log is still written beside it. #997 later stops that.

  • <name>.logs.jsonl holds a log record for each Harness event, written as it arrives. Each record carries:
    • the raw event as its body, and an event name;
    • the event's own time where the Harness gives one, and the time thirdshift saw it;
    • the trace ID, and the ID of the span the event belongs to;
    • GenAI convention attributes, and thirdshift.* attributes for what they lack.
  • <name>.spans.jsonl holds a span for the session and for each model call and tool call, each written as it ends. Spans carry GenAI attributes: the operation, the requested and response Model, and token usage. thirdshift.* attributes cover cost, the cache split, rate limits, permission denials, killed work, sub-agents, diffs, pushes and pull-request events, the Harness's setup and the Session prompt.
  • <name> is today's Session log name without .jsonl. Each file's resource names thirdshift's version, the Harness, the requested Model and Effort, the session's kind, the repository and the Command's identity. Each file also names the GenAI conventions version it follows.
  • The trace ID is derived from the Command's log stamp and token, which child processes already inherit. The span IDs of the Command, each Run and each stage are computed from the Command record, from the Run's identity and the stage's name and start. A session's span names its stage as its parent.
  • On interruption, open spans close with an error status before the session returns.
  • The logs inventory and file-name decoding read a session's files as one session. Model evidence and review reports keep their names.

See #700 and ADR 0019.

Acceptance criteria

  • With the fake Harnesses for all six, each session leaves both files, and both decode as OTLP, with The OTLP JSON Lines writer #982's reader and with the official types.
  • The log records' file grows while the session runs, not only at its end.
  • All sessions of a Command share one trace ID, including those of child Runs (Ticket Runs and Base fixes).
  • Each session span's parent is the stage span ID computed from the Command record, and computing it again from the record alone gives the same ID.
  • An interrupted session's open spans end with an error status, and records written before a hard kill remain.
  • logs --json and the Console's Logs page list each session once, and file-name decoding never reads .logs or .spans as part of a session's kind.
  • Model evidence and review reports keep their names, and Security runs' sessions write Session traces on the machine like the rest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agentFully specified, ready for an AFK agent

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions