Agents Builders

Grade narrated trajectory spans

Archived
grade-narrated-trajectory-spans

Created

Jul 01, 06:11

Started

Jul 01, 06:12

Completed

Jul 01, 12:10

DevOps handoff

Type

Feature

Shape

backend

Worktree Slug

grade-narrated-trajectory-spans

Repositories

mcritchie-studio

Release Slug

Branch

feat/grade-narrated-trajectory-spans

Local URL

QA URL

Production URL

data-model

Acceptance Criteria

  • ActionGrade can attach to an AtomicEvent span
  • Alex and McRitchie each grade a span once
  • Grade endpoint persists disposition slug long-form bank
  • Existing per-action grading path unchanged, nothing regressed

Expected Test Plan

  • unit
  • integration

Checks Run

  • [unit] ActionGrade XOR: exactly one of action/event target
  • [unit] event grader-uniqueness: one grade per (event, grader)
  • [unit] for_event scope + span grade persists null action FK
  • [integration] bank!/discard! on an event grade toggles Insight Bank
  • [integration] POST events/:id/grade persists grade + JSON shape
  • [integration] invalid span grade returns 422 JSON, no row written
  • [full-suite@1d6c09c2531486f6fbdc3b304e0478096f416d63] bin/rails test green
  • [rubocop@1d6c09c2531486f6fbdc3b304e0478096f416d63] bin/rubocop clean

Agent Context

Extend the learning heartbeat's grading (ActionGrade) so a grade can target an AtomicEvent SPAN, not only a raw AtomicAction. DESIGN = additive dual-FK, NOT a polymorphic rewrite (keep the working action path intact, low overnight risk): (1) migration adds nullable atomic_event_id FK to action_grades (on_delete: nullify, index), relaxes atomic_action_id to nullable, adds a partial unique index on (atomic_event_id, grader) WHERE atomic_event_id IS NOT NULL — mirror the existing (atomic_action_id, grader) unique index. (2) ActionGrade: add belongs_to :atomic_event, optional: true; keep atomic_action optional:true; add a model validation that EXACTLY ONE of atomic_action_id/atomic_event_id is present (XOR); add scope for_event; keep the grader-uniqueness working for BOTH targets (conditional validation per FK). (3) HeartbeatController: add a NEW action grade_event (route: post 'alex/heartbeat/events/:id/grade', as: :heartbeat_event_grade) that upserts one grade for (event, grader) and returns JSON only — do NOT touch any view/partial or the existing #grade turbo_stream path (E3 owns all heartbeat UI; keeping E2 view-free avoids a merge conflict with E3). Same disposition/slug/long_form/intent=bank|discard semantics as #grade, wrapped in rescue_and_log. (4) grade_counts should keep working (it counts action grades today; leave it, E3 will extend). TESTS: model unit specs for the XOR + event grader-uniqueness + bank/discard on an event grade; a request spec POSTing to the new event-grade route asserting persistence + JSON. Backend discipline: grade writes RAISE (deliberate user action), rescue_and_log with the grade as target. Part of the narrated-events next-draft epic — see project_opsd_learning_layer.

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 MEDIUM Dev MEDIUM Actual XL ≠ forecast
  1. Created Designed
    C Caterpie
    Caterpie
    Model
    Duration
    Tokens
    Cost
    Completed Jul 01, 06:11 · 7 days ago
    api
  2. Designed Building
    C Caterpie
    Caterpie
    Model
    claude-opus-4-8
    Duration
    1 minute
    Tokens
    527,841
    Cost
    ~$0.77
    Started Jul 01, 06:11
    Completed Jul 01, 06:12 · 7 days ago
    cli
  3. Building Submitted
    C Caterpie
    Caterpie
    Model
    claude-opus-4-8
    Duration
    14 minutes
    Tokens
    1,229,816
    Cost
    ~$1.29
    Started Jul 01, 06:12
    Completed Jul 01, 06:26 · 7 days ago
    cli
  4. Submitted Reviewed Review Activity
    C Carl
    Carl primary
    S Shannon
    Shannon light
    Model
    claude-opus-4-8
    Duration
    4 minutes
    Tokens
    2,998,353
    Cost
    ~$2.86
    Started Jul 01, 06:26
    Completed Jul 01, 06:30 · 7 days ago
    cli
  5. Reviewed Assembled
    S Steffon
    Steffon
    Model
    claude-opus-4-8
    Duration
    under a minute
    Tokens
    Cost
    Started Jul 01, 06:30
    Completed Jul 01, 06:30 · 7 days ago
  6. Assembled Shipped
    A Avi
    Avi
    Model
    claude-opus-4-8
    Duration
    about 6 hours
    Tokens
    10,679,335
    Cost
    ~$7.86
    Started Jul 01, 06:30
    Completed Jul 01, 12:10 · 7 days ago
  7. Shipped Archived
    Model
    Duration
    3 days
    Tokens
    Cost
    Started Jul 01, 12:10
    Completed Jul 04, 03:23 · 4 days ago

Conversation

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

No task feedback has been recorded yet.

Sealed-bid sizing

Edit →

Alex (PM)

Avi (PO)

MEDIUM

Dev

MEDIUM

Actual

XL