Skip to content

Deepen retained Experiment reading into one captured observation #1283

Closed

Description

@JacobStephens2

What to build

Deepen retained Experiment reading so one CLI or Console response derives Trial progress, results, Session evidence, Arm minutes, Void causes and usage from one captured observation. Today assembling one view independently walks the same Trials and attempts several times, rereads pending results for older Arms, and checks terminal results again while selecting running Trials.

Keep the existing commands, retained formats and displayed values. Make the observation rules local to one module so another Experiment projection does not need to learn the private folder layout or repeat its reads.

Acceptance criteria

  • One Experiment reading module owns discovery and captures the facts used to assemble the existing retained view. CLI text/JSON, Console list/detail and Session-ID selection use that same interface; their adapters do not discover Trial evidence themselves.
  • Within one view capture, each relevant results, Trials, Trial and attempt Session directory is enumerated at most once, and each selected terminal result, pending result, active marker and attempt-start record is decoded at most once. Missing optional facts are captured too. A Session spans file is read at most once for usage. Projection performs no further filesystem reads.
  • Running Trials and unfinished Trials use the captured terminal-result keys, without fresh terminal-file existence checks. A terminal Trial cannot also be running or unfinished in the same view. Only a Running Experiment projects active markers as running Trials.
  • Pending and terminal records retain their different roles: Arm minutes and Void counts include each captured pending attempt once, including paused attempts; terminal results retain model Scores and captured recheck history; unfinished Trials contain pending results without captured terminal results. A terminal result without a pending record keeps today's accounting behavior.
  • Session evidence preserves deterministic ordering, current attempt indices, legacy pending-log-position fallback, raw-to-Session-trace ID stability, converted-log preference, escaped-path exclusion and ID-only selection. Usage independently includes retained spans without a readable log and retains the current Model, cache, cost, retry and Resume calculations.
  • Tests at the reading interface verify the shared capture, using counted reads and controlled publication between sampling and projection. A later capture sees changes; the existing capture does not silently reread them. Tests cover pending/terminal differences, multiple legacy attempts, span-only usage and optional-file disappearance.
  • Existing CLI/Console pairing, Session evidence, Arm usage, paused minutes and Trace-export regressions pass. Remove superseded discovery paths and any tests that merely mirror those paths; retain behavior regressions and usage-calculation coverage.
  • Update the domain-to-code navigation for the new ownership. Check the hand-written site descriptions of Experiments and Session evidence against the preserved behavior and correct any claim the implementation changes. This refactor introduces no domain term and needs no glossary or ADR change.
  • Run the focused Experiment and Console Experiment tests, then the repository's affected-test selector against the Base branch; complete all checks it selects.

Blocked by

None (can start immediately).

Decisions

The design tree is settled in three rounds: scope and constraints → capture and projections → verification and delivery. Every branch below has a decision and its reason; none needs a Day shift choice.

Reviewed main at ee7fe1134d8a98471f0a6498da6ea35b7fbefe80 and all 118 open issue titles/bodies. None proposes this deepening. #1252 changes the Bar/rechecks, #981 concerns production Run metrics, and #1047 concerns missing Harness evidence. This is the top uncovered Strong recommendation because recent Experiment and Console changes already need the same observation rules, and its complete design follows from existing behavior without a new product decision.

Round 1 — scope and constraints

  1. One standalone Ticket. This is one local refactor across retained-view discovery and its tests, small enough for one fresh context window; it needs neither a Spec nor prerequisite Tickets.
  2. Keep the existing retained-view interface. A private Experiment reading module assembles the existing View from a loaded Experiment; the existing view method delegates once. CLI and Console remain presentation adapters. This adds depth by absorbing discovery and interpretation, rather than adding a pass-through module.
  3. Limit capture to view assembly. Experiment loading, format checks, saved-Verdict compatibility upgrades, locks and mutation-side result reads keep their existing responsibilities. Trial execution, retry scheduling, Graders, Bar rules, rechecks and their publication protocols are outside this refactor. They have different lifetimes and do not need a reader's capture.
  4. Keep Trace writing and attachment discovery separate. Attempt completion reparents older Arms' traces, and Command export selects an exact invocation's trace context plus Grader Sessions. These are different operations from displaying retained Experiment evidence; forcing them through the view would broaden the interface and risk ancestry changes. ADRs 0016 and 0019 remain satisfied. This local, reversible refactor warrants no new ADR or glossary term.

Round 2 — capture and projections, dependent on Round 1

  1. Own one per-view observation, without a cross-request cache or reader lock. Capture terminal results and their key set first, then capture each Trial's pending/active facts and attempt Session entries. Decode a fact once and retain its absence as well as its presence. Materialize the projected values before returning the View; do not retain whole transcripts or all spans merely to support projection. This gives locality without blocking a running Experiment or retaining unbounded evidence in memory.
  2. Promise sampled-fact reuse, not a filesystem transaction. Files can change while capture is in progress. Facts first observed later may be newer; all projections must nevertheless reuse the same captured fact for each path and identity. Completion published after terminal membership was captured appears on the next capture. Derive active and unfinished eligibility from that captured membership, so one response cannot independently observe a second terminal set.
  3. Preserve pending versus terminal semantics. The worker retains completed attempts in pending results before publishing terminal results; model Graders subsequently enrich terminal Scores. Count minutes and Void causes from pending once, never from both copies. Read Scores from terminal results and overlay the loaded recheck history once. Reuse the same pending record for legacy attempt-index inference. This prevents the refactor from losing paused time, replacing model Scores or double-counting attempts.
  4. Use one discovered Session folder with two projections. Readable evidence selects regular log candidates, prefers the converted log over its raw sibling, excludes spans from the evidence list, keeps canonical confinement, hashes the original relative log path and sorts by Trial, attempt and ID. Usage selects spans independently, including span-only evidence, and streams each selected spans file through the current arithmetic. Coupling usage to visible Session links would lose measured work. Attempt-start metadata wins over the legacy pending-output-log position. If neither source identifies the attempt, retain index zero.
  5. Keep optional absence distinct from corruption. An absent optional directory, pending/start record or active marker contributes no fact, including optional records removed before their first read. Preserve the existing skip when a readable Session candidate disappears at canonicalization. Readable malformed metadata or malformed spans, permission failures and other I/O failures remain errors rather than invented empty observations. Capture these outcomes once, so another projection cannot retry a missing fact and see a different answer.
  6. Make discovery internal. Keep the Active writer in its current role, and keep usage arithmetic as an implementation detail that consumes captured Session membership. Remove the view's independent evidence/usage walks and repeated pending reads. The remaining Trace-specific walk keeps its own semantics. Native filesystem access and a counting/controlled test adapter justify a private I/O seam; callers never receive folder traversal duties or adapter configuration.

Round 3 — verification and delivery, dependent on Round 2

  1. The interface is the test surface. Exercise a complete captured view, asserting progress, evidence identity and accounting together. A counting adapter over temporary files verifies the read budget; a controlled adapter changes pending/active/result facts after their first sample to prove reuse. Verify a fresh observation sees the publication. These test the promised observation behavior rather than a chosen helper decomposition.
  2. Pin the distinctions that shared discovery could erase. Include a terminal model/recheck Score differing from pending, a paused Void followed by resume, terminal membership suppressing a still-present active marker, several old attempts with different pending-log positions, a start-index override, converted and raw siblings, and spans with no readable sibling. Assert correct values and ordering, including missing and malformed facts. This covers the actual seam risks without moving policy into callers.
  3. Reuse existing end-to-end evidence. Keep the Experiment regressions for unknown Model/cost, partial usage, session-total precedence, retry/Resume sums, paused minutes and private evidence, plus Console pairing and Session-ID tests. Trace ancestry/export tests survive unchanged because that implementation is outside the refactor. The affected-test selector supplies final local validation. Check navigation and site accuracy as part of this Ticket; no new command or workflow is introduced. During this review, three Arm-usage regressions and two CLI/Console Experiment pairing/evidence regressions passed on the reviewed base head; the affected-test selector reported no changed files.

Architecture review

Strength: Strong · Dependencies: local-substitutable

Files: src/evals/experiment/store.rs (view assembly, lines 304–360), src/evals/experiment/evidence.rs (discovery, lines 56–171), src/evals/experiment/usage.rs (discovery, lines 35–55), src/evals/experiment/trace.rs (existing traversal helpers, lines 179–215), proposed src/evals/experiment/reading.rs, tests/experiments.rs, tests/console/experiments.rs, docs/code-navigation.md.

Before

flowchart LR
  CLI["CLI adapter"] --> View["Experiment view"]
  Console["Console adapter"] --> View
  View --> Results["Trial results"]
  View --> Progress["Trial progress"]
  View --> Sessions["Session evidence"]
  View --> Usage["Arm usage"]
  Results -.-> Files["Retained files"]
  Progress -.-> Files
  Sessions -.-> Files
  Usage -.-> Files
  classDef leak stroke:#dc2626,stroke-width:2px;
  class Progress,Sessions,Usage leak;
Loading

After

flowchart LR
  CLI["CLI adapter"] --> View["Experiment view"]
  Console["Console adapter"] --> View
  View --> Reading
  subgraph Reading["Experiment reading module"]
    Capture["Captured observation"] --> Results["Trial results"]
    Capture --> Progress["Trial progress"]
    Capture --> Sessions["Session evidence"]
    Capture --> Usage["Arm usage"]
  end
  Capture --> Files["Retained files"]
  classDef deep stroke-width:3px;
  class Reading deep;
Loading

Problem: shallow discovery interfaces spread retained-file knowledge across progress, evidence and usage, repeating reads and fresh terminal checks within one response.

Solution: deepen the Experiment reading module so one captured implementation owns discovery behind the existing view interface and its private filesystem seam.

Deletion test: removing the deep module would redistribute discovery, legacy identity and sampled-fact rules across those projections; its depth earns its interface.

Wins

  • Locality: discovery rules live together
  • Leverage: CLI and Console agree
  • One interface tests joint projections
  • Each adapter shares captured facts

Activity

  1. added
    needs-triage
    ready-for-agent
    architect-plan
    in-progress
    and removed
    needs-triage
    ready-for-agent
    on Oct 24, 2026
  2. removed
    in-progress
    on Oct 24, 2026
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

    architect-plan

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions