fix(codex): capture per-turn tokens + model from JSONL#23
Merged
Conversation
Parser now handles token_count events (last_token_usage -> per-completion inputTokens/outputTokens/cacheReadInputTokens) and turn_context events (model = e.g. gpt-5.5). Upload route prefers per-event model over LLM-inferred ai.models. Seed gpt-5.5 OpenAI pricing (5/30/0.50). Without this, every Codex session uploaded to gettrail.vercel.app had inputTokens/outputTokens/cachedTokens/estimatedCostUsd all NULL, even though the raw JSONL contained full usage data. End result: the cost-per-PR dashboard was empty for everyone using Codex.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
janfaris
added a commit
that referenced
this pull request
May 27, 2026
Parser now handles token_count events (last_token_usage -> per-completion inputTokens/outputTokens/cacheReadInputTokens) and turn_context events (model = e.g. gpt-5.5). Upload route prefers per-event model over LLM-inferred ai.models. Seed gpt-5.5 OpenAI pricing (5/30/0.50). Without this, every Codex session uploaded to gettrail.vercel.app had inputTokens/outputTokens/cachedTokens/estimatedCostUsd all NULL, even though the raw JSONL contained full usage data. End result: the cost-per-PR dashboard was empty for everyone using Codex.
janfaris
added a commit
that referenced
this pull request
May 27, 2026
Macrostructure: 04 Stat-Led. The real verified cost from session 161blsz1 ($3.77, gpt-5.5, PR #23) becomes the hero — no fake metrics, no mockups, no Bento Grid SaaS template. - Hero: 200px Fraunces display tabular-num $3.77, italic qualifier underneath - Breakdown: hairline table decomposing the number into in/out/cached - How: three numbered steps (Install / Work / Ship), code-led - Coverage: tier table with honest Primary/Partial labels — Copilot called out for having no per-user token API instead of pretending otherwise - Final CTA strip + Ft7 one-line footer 660 lines → 290 lines. Both CTAs (npm install + Sign in) given equal weight in hero. Anti-slop disciplines applied: tabular-nums everywhere, no re-drawn chrome, ≤3 fonts (Geist + Fraunces + Geist Mono), real numbers only, hairline-rule rhythm. Slop test 69/69.
janfaris
added a commit
that referenced
this pull request
May 31, 2026
Recenter the landing on the receipt as a proof object: real $ cost as a credibility anchor, the linked public PR as the third-party-provable fact, and the Verified Builder badge shown locked/pending until GitHub confirms a merge. Keeps a strict line between "GitHub confirmed it" and "Trail measured it" — claims only what's independently true (real cost, Codex/gpt-5.5, 295 turns, genuinely-merged public PR #23) and never presents a session as merge-verified when it isn't. Adds the social/distribution surfaces (profile, discover, feed, tools, frameworks) framed as an aspirational empty-state, and an honest coverage section. Signed-in users still redirect to /dashboard/cost. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parser was ignoring token_count and turn_context events, so every Codex upload had null tokens/model/cost. This wires up:
Verified locally: real codex session 019e5f53 now parses 38 completions with tokens, totaling 4.63M in / 15.8K out / 4.41M cached, model=gpt-5.5. All 42 parser tests pass.