Skip to content

Decide Codex per-request evidence for Session traces #1047

Open

Description

@JacobStephens2

Decision needed

Raised by the Spec review of #1046 while implementing #983 for #700.

#983 requires every model call's start/end and reported usage from Claude, Grok and Codex. Codex's exec --json stream supplies whole-turn boundaries and aggregate usage, with no individual model-request boundaries or observed Model records. A turn may include multiple requests. The decoder can faithfully normalize turns, tool calls, messages, errors and sub-agents, but cannot recover missing per-request facts from that stream.

Evidence

  • The upstream exec event schema defines turn.started, turn.completed with aggregate Usage, turn.failed, items and errors; no model-request lifecycle or Model is present.
  • The PR's event contract deliberately keeps TurnStarted/TurnEnded distinct from ModelCallStarted/ModelCallEnded.
  • The exact review command cargo test --bin thirdshift harness::interpretation::event_tests::review_codex_fixture_contains_model_call_lifecycles -- --exact ran one test and failed: the fixture's successful turn reports 100 input / 7 output / 20 cached tokens, with zero model-call starts. The regression remains in the PR, explicitly ignored pending this decision. Use -- --exact --ignored to run it in that state.

Why this call belongs to the Day shift

Meeting the literal criterion requires an additional source of Codex evidence (for example retained rollout records or a different transport), or an explicit #700/#983 exception accepting turn aggregates where per-request evidence is unavailable. Choosing that source/transport or changing the Spec's granularity changes the trace contract and later Tickets; fabricating one model call per turn would give false measurements. The decoder implementation should not silently make that decision.

Choose the evidence source and its scope, or amend the Spec to state the accepted Codex limitation. This issue has only needs-triage and creates no blocking edge.

Activity

  1. added
    needs-triage
    on Oct 22, 2026
  2. JacobStephens2 commented on Oct 25, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Triage Notes

    What we've established so far:

    What we still need from you (@JacobStephens2):

    • Accept Codex turn aggregates as the documented limit (amend the ADR 0019 note and delete the ignored test)?
    • Or take per-request facts from Codex rollout files?
  3. added
    enhancement
    needs-info
    and removed
    needs-triage
    on Oct 25, 2026
  4. JacobStephens2 commented on Oct 30, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    New evidence for the rollout question: #1651. On a real Codex Ticket run, the exec --json stream gave thirdshift neither the observed Model (every session recorded model: null) nor the tokens of the session's own native sub-agents. The parent's implement totals under-count input by about 38% and output by about 80%. Both facts are in the session's rollout-*.jsonl files: turn_context.model, and per-thread total_token_usage with parent_thread_id. That makes reading rollouts more than a question of per-request detail.

  5. JacobStephens2 commented on Nov 10, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation of #1651 against Base ecaf0d4 confirms the accounting and Model gaps remain. Codex already has narrow native-rollout readers for patch reconciliation (src/harness/codex/patches.rs) and quota observations (src/harness/codex/limits.rs), but neither supplies observed Models or child usage. Consider deciding whether Model/native-usage enrichment can proceed independently of per-request lifecycle reconstruction. The existing normalized usage contract keeps aggregate turns separate from model calls; enrichment need not invent request boundaries. Recommendation for #1651 is ready-for-human pending this scope decision and a proposed split into Model attribution and native descendant accounting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementneeds-info

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions