Agents Builders

Harden timeline usage capture

Archived
usage-capture-hardening

Created

Jun 25, 20:46

Started

Jun 25, 20:59

Completed

Jun 26, 01:50

DevOps handoff

Type

Feature

Shape

backend

Worktree Slug

usage-capture-hardening

Repositories

mcritchie-studio

Release Train

Branch

feat/usage-capture-hardening

Local URL

QA URL

Production URL

backend data

Acceptance Criteria

  • First session move records nonzero token delta
  • Deploy-side moves capture model tokens and cost
  • Genesis and intent events documented as usageless
  • Rake backfill populates historical event usage data
  • Web moves degrade gracefully without usage values

Expected Test Plan

  • [unit] AgentSessionUsage baseline + price specs
  • [integration] bin/task move usage capture end-to-end

Checks Run

  • [unit] TaskUsageBaseline seed/advance + delta isolation (test/lib/task_usage_baseline_test.rb)
  • [unit] AgentSessionUsage price() per-model + delta (test/lib/agent_session_usage_test.rb)
  • [integration] bin/task intent seeds baseline so first review move records real delta (test/lib/task_cli_test.rb)
  • [integration] conductor adopt!/ship! stamp deploy-side model/tokens/cost on TaskEvents (test/models/release/conductor_test.rb)
  • [integration] task_events:backfill_usage fills model only, never fabricates tokens/cost (test/lib/task_events_backfill_test.rb)
  • [integration] full suite green: 1716 runs, 0 failures, 0 errors, 4 skips
  • [full-suite@1bf571c532f88b0f08b9441b0e48c9086a998e44] bin/rails test green
  • [rubocop@1bf571c532f88b0f08b9441b0e48c9086a998e44] bin/rubocop clean

Agent Context

Epic: Task Intelligence (#2 of 4, backend). SEQUENCE: build BEFORE avi-task-sizing (both edit bin/task + app/models/task.rb — must not run in parallel worktrees). Root causes of missing usage (diagnosed): (1) genesis Created→Designed fires in Task.create before any session/usage context — inherently empty, just document; (2) FIRST CLI transition in a session sets the per-(session,slug) baseline so its token delta is ~0 → model shows but tokens/cost zero — fix by seeding the baseline at task CLAIM (move→building) so subsequent deltas are real, or by recording delta-since-claim; see lib/agent_session_usage.rb + bin/task autofill_move_usage; (3) deploy-side moves via bin/release (source conductor) + web never auto-capture — wire transcript capture into conductor/release moves where a session transcript exists. Also: best-effort rake backfill (lib/tasks/task_events.rake) for historical events — note historical usage is mostly unrecoverable, log what was filled vs skipped. PRICING table lives in agent_session_usage.rb.

Stage Timeline

Who handled each stage, the time it took (measured), and the model / tokens / cost reported (best-effort) — plus who's on it right now. means the agent didn't report that metric.

Sizing Avi · PO Dev Actual XL
  1. Created Designed
    R Rhydon
    Rhydon
    Model
    Duration
    Tokens
    Cost
    Completed Jun 25, 20:46 · 1 day ago
    api
  2. Designed Building
    R Rhydon
    Rhydon
    Model
    claude-opus-4-8
    Duration
    12 minutes
    Tokens
    Cost
    Started Jun 25, 20:46
    Completed Jun 25, 20:59 · 1 day ago
    cli
  3. Building Submitted
    R Rhydon
    Rhydon
    Model
    claude-opus-4-8
    Duration
    33 minutes
    Tokens
    22,135,203
    Cost
    ~$19.43
    Started Jun 25, 20:59
    Completed Jun 25, 21:31 · 1 day ago
    cli
  4. Submitted Reviewed
    S Shannon
    Shannon primary
    J Jasper
    Jasper light
    Model
    claude-opus-4-8
    Duration
    32 minutes
    Tokens
    Cost
    Started Jun 25, 21:31
    Completed Jun 25, 22:03 · 1 day ago
    cli
  5. Reviewed Blocked
    Model
    Duration
    42 minutes
    Tokens
    Cost
    Started Jun 25, 22:03
    Completed Jun 25, 22:45 · 1 day ago
    api
  6. Blocked Submitted
    R Rhydon
    Rhydon
    Model
    claude-opus-4-8
    Duration
    13 minutes
    Tokens
    41,894,226
    Cost
    ~$26.24
    Started Jun 25, 22:45
    Completed Jun 25, 22:58 · 1 day ago
    cli
  7. Submitted Reviewed
    S Shannon
    Shannon primary
    J Jasper
    Jasper light
    Model
    claude-opus-4-8
    Duration
    about 3 hours
    Tokens
    Cost
    Started Jun 25, 22:58
    Completed Jun 26, 01:38 · 1 day ago
    cli
  8. Reviewed Assembled
    S Steffon
    Steffon
    Model
    Duration
    1 minute
    Tokens
    Cost
    Started Jun 26, 01:38
    Completed Jun 26, 01:40 · 1 day ago
  9. Assembled Shipped
    A Avi
    Avi
    Model
    Duration
    10 minutes
    Tokens
    Cost
    Started Jun 26, 01:40
    Completed Jun 26, 01:50 · 1 day ago
  10. Shipped Archived
    Model
    Duration
    about 1 hour
    Tokens
    Cost
    Started Jun 26, 01:50
    Completed Jun 26, 03:17 · 1 day ago

Conversation

QA review feedback, agent handoffs, and follow-up notes for this task.

Comment 1 day ago

Review pair APPROVED + ready-to-undraft (both): shannon (heavy) + jasper (light). TypeError-abort (PR #121 bug) cannot recur — guarded at sum_usage (next unless obj.is_a?(Hash)) + defense-in-depth rescue in every TaskUsageBaseline method + autofill_move_usage; capture always degrades to nil/spine-only, never fabricates. All 5 acceptance bullets met (intent/claim baseline seeds true first-move delta; conductor adopt!/ship! thread model/tokens/cost; genesis+intent usageless; backfill recovers model-only; web moves spine-only). Strong failure-mode coverage. CI green (1716 runs). SEQUENCING: must land BEFORE avi-task-sizing #209 (both edit bin/task + app/models/task.rb). Un-drafted.

QA Feedback 1 day ago

Merge conflict vs origin/release after release-mascot-and-timer (current.rb/release.rb/conductor.rb/bin/release) + avi-task-sizing (task.rb/bin/task) landed. Rebase onto origin/release, resolve, push, re-submit — approvals stand pending a clean rebase.

Handoff 1 day ago

Clean rebase onto origin/release (3561760); resolved conflicts vs #212 release-mascot-and-timer (current.rb — kept BOTH conductor_session_id attr + with_task_event_usage; release.rb/conductor.rb/bin/release auto-merged: stamp_session_mascot + usage threading coexist) and #209 avi-task-sizing (task.rb autoderive_actual_size + bin/task --dev-size/sizing flags auto-merged with usage seeding). No leftover conflict markers; mascot/timing + sizing + usage capture all intact. Approvals (shannon heavy + jasper light) stand; PR #208 force-pushed, now MERGEABLE. Full-suite + rubocop green at 1bf571c532f8.

Sealed-bid sizing

Edit →

Alex (PM)

Avi (PO)

Dev

Actual

XL