Skip to content

feat(lane-transcripts): keep cost and cache fields, trace ids and lane outcomes - #17046

Merged
kyle-sexton merged 6 commits into
mainfrom
feat/lane-transcripts-cost-trace-outcomes
Nov 18, 2026
Merged

kyle-sexton merged 6 commits into
mainfrom
feat/lane-transcripts-cost-trace-outcomes

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: an observability addition to the lane transcript sink, with no tracked issue behind it.

Summary

The lane transcript sink now keeps what a retro needs to explain a lane run: cache tokens, the CLI's cost estimate, per-model usage, a trace id and the run's failure class.

Fix

  • Each metrics row gains cache_read_input_tokens, cache_creation_input_tokens, total_cost_usd, model_usage, trace_id, failure_class and failure_class_source. The cost fields are the CLI's own estimate, not a bill.
  • A new pull-outcomes command copies lane-outcome records past GitHub's check-run retention into outcomes.jsonl, and backfill fills the new fields on older rows.
  • The failure class is matched per run attempt: it is set only when every record of the attempt agrees, because a record does not name the leg that wrote it.
  • The lane_runs and lane_outcomes DuckDB views join rows to outcomes on trace_id, and the lane-transcripts contract names the new fields and file.

Verification

  • node --test scripts/lane-transcripts/pull.test.mjs: 51 passed, 0 failed.
  • plugins/harness-ops/skills/observability/otel/lane-runs.test.sh: 7 passed, 0 failed.
  • Left out: a live pull-outcomes run against GitHub, to keep the shared API budget free. The laptop timer that runs it after pull is a separate dotfiles change.

Related

N/A

🤖 Generated with Claude Code

kyle-sexton and others added 3 commits November 17, 2026 23:20
…e outcomes

The transcript sink now keeps, per lane leg, the result message's cache
tokens, the CLI's cost estimate and per-model usage, and the run
attempt's trace id (the lane-outcome record's traceId formula). A new
pull-outcomes command copies validated lane-outcome records from every
lane workflow run's job annotations into outcomes.jsonl, under its own
call budget and resume state, and sets each row's failure class only
when the run attempt's records agree. backfill fills the new fields on
older rows. The puller accepts one extra sealed entry in an artifact
zip. outcomes.jsonl is kept 365 days with the metrics rows.

harness-ops observability gains lane_runs and lane_outcomes DuckDB
views over the sink, joined on trace_id.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A pass after a budget stop listed the same newest runs again and spent
calls on jobs that held no record, so a backlog larger than one budget
could never drain. Each finished run attempt is now kept in the state's
read_runs until it falls behind the next cutoff, and status shows the
outcome pull's budget stop and resume cutoff.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…row fields

The contract now names the fields the puller writes, and outcomes.jsonl
in the sink layout, so a reader can rely on them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review November 18, 2026 05:11
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T05:13:58.470639Z 622a5e2 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 622a5e2c7c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/lane-transcripts/pull.mjs Resolved
A pull interrupted between two records of one job left the job marked as
held, so the next pass skipped the records it never wrote and a run whose
records disagree could get a definite failure class. Each row now names
how many records its job holds, and a pass drops and rereads a job with
fewer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

Lane run report

Field Value
Activity pr-refine/fix-docs
Model rung 0
Leg base
Run job success
Activity step success
Commits pushed none (read lane)
Run 44242606419

Failed GitHub API calls

Method Path Status
GET /repos/{repo}/git/ref/tags/* 404

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 88cdeed0700ace255e7d57895fea870c9395cd6f; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread scripts/lane-transcripts/pull.mjs Resolved
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-review reviewed f1dbdebcedd0247b03c6ead9443d6a35cd9e7eec: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Code review: PR #17046, incremental (8b3cd23..f1dbdeb)

This round was blocking only, because the lane has already reviewed earlier heads. I read the whole incremental diff for all 3 listed files (scripts/lane-transcripts/README.md, pull.mjs, pull.test.mjs). For context I also read the unchanged code the new lines call: status() and main() in pull.mjs, plus the test helpers seedState, fakeDeps and run.

Prior finding (pull exits 1 when pull-outcomes is stale): fixed.

  • Exit code: a successful pull now prints both alerts through alertIfStale(after). Its exit code comes from after.pull_stale alone (pull.mjs:674-676). pull_stale is the transcript pull's own staleness(state) result (pull.mjs:572-578). So a chained pull && pull-outcomes timer still reaches pull-outcomes.
  • Failure path: the catch branch still returns 1, which is right for a pull that failed.
  • Test: the new test seeds outcomes 6 days old and runs a fresh pull. It asserts exit 0 and the pull-outcomes ALERT: line.
  • README: the pull row now states the rule.
  • Thread status: the owner settled it, and no lines changed after the fix, so I am not raising it again.

New findings: none.

Closing issue: none. The PR has no tracked issue, so there are no acceptance criteria to check.

Loosened checks: no existing assertion was changed or removed; the test hunk only adds a test. The prompt had no loosened_check_verdict: or loosened_check_patterns: line, so I used the default verdict and no consumer patterns. Loosened-check verdict: fail.

Not verified: I ran no tests, so the author's test results are their claim and unverified.

Manifests: no plugin manifest changed, so there are no manifest lines.

Verifier dropped 0 of 0 candidates.

status judged only the transcript pull, so a pull-outcomes that kept
missing runs exited 0 until GitHub's retention removed the records. It
now applies the same 5-day checks to pull-outcomes once that has run.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

claude-security-review reviewed f1dbdebcedd0247b03c6ead9443d6a35cd9e7eec: read 3 of 3 changed file(s); 0 finding(s), 0 as inline comments.

Security review (incremental, blocking only): no security issues found

I read every hunk of the 3 files changed since 8b3cd236 (scripts/lane-transcripts/README.md, pull.mjs, pull.test.mjs). None of them matches a trusted-path glob. The change touches no trust control: no trusted-actor check, lane token scope, kill switch, merge hold, workflow or plugin manifest.

What I checked

  • pull.mjs main (pull command, L671–676). The exit code now depends only on after.pull_stale. Before, it came from alertIfStale across both the transcript pull and pull-outcomes.
    • alertIfStale(after) still runs, so a stale pull-outcomes still prints its ALERT: on stderr.
    • status still exits 1 when either check is stale, so nothing is hidden there.
    • This is an exit-code change in an operator-run local tool. It decides no access, no gate and no hold, and no untrusted input reaches it.
  • Test and README. The new test and the README row only describe this behaviour. Neither removes or softens a standing instruction.

This review was blocking only: this lane already reviewed an earlier head, so only CRITICAL and IMPORTANT findings would have been posted. I found none.

critical-findings: 0

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

claude-review: 1 inline finding(s) on 8b3cd236046d1567fb86ef7a48a350214d78de9c; the summary is in this lane's pull request comment.

claude-lane: claude-review

Comment thread scripts/lane-transcripts/pull.mjs Resolved
A stale pull-outcomes made a successful pull exit 1, so a timer chaining
the two would never reach pull-outcomes again. pull still prints the
alert, and its exit code now judges the transcript pull alone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-path: owner-agent Post-merge accounting record (README.md, Merge paths)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant