Skip to content

Deepen Trial results behind one storage interface #1288

Closed

Description

@JacobStephens2

What to build

Deepen the Experiment's Trial results module so Trial Workers, the Model Grader, Experiment metadata and retained Experiment reading share one implementation of result storage. Resuming, grading and observing an Experiment should preserve today's behavior while callers stop coordinating pending and terminal result files themselves.

The module owns Trial result identity, retained progress, completed-attempt publication, terminal membership and Model Grader result updates. Workers retain the Bar's retry and pause decisions; retained reading retains Session evidence discovery.

Acceptance criteria

  • Workers use a per-Trial writer to resume progress, record a completed attempt and finish it. The writer owns result initialization, outcome/Score/attempt updates, and publication in the existing order: attempt output, pending history, then terminal publication when requested. Pending history remains after finishing.
  • Existing saved Experiments resume and render without migration. Trial keys, result filenames, JSON shapes, Trial IDs, saved Model Grader assessment keys, lexical result order and seeded packet associations remain compatible.
  • Retry causes, retry budgets, pause behavior and exhausted-pause terminal publication remain governed by the existing Worker decisions. A stopped retry retains completed attempts and cannot receive a fresh retry budget on resume.
  • Terminal-only reads and retained captures share terminal eligibility and decoding. Terminal-only consumers do not inspect pending files or acquire new failure modes from unrelated pending metadata.
  • A retained capture samples terminal membership first, enumerates Trial folders once, and samples each pending record once. Its captured membership supplies unfinished and active eligibility; retained reading reuses its captured Trial folders and pending history for Session evidence and legacy attempt indices, without probing result files again.
  • Accounting includes each captured pending history once even when a terminal result exists. Terminal results suppress unfinished and active presentation. A terminal result without pending history retains today's zero minutes and Void accounting. Captured absence remains absent until another observation; corruption and permission errors retain their existing behavior.
  • Model grading reads raw terminal results through opaque targets and applies Scores through the module. Each target retains the actual selected filename's existing serialized representation and resolves only against selected terminal entries. A complete validated assessment is saved before per-Trial updates; replay after partial application reuses it and does not rerun completed Trials or the Grader. Pending accounting history remains unchanged by terminal Score updates.
  • Rechecks remain metadata history applied to returned values through one shared operation. Applying or rendering a recheck never writes its overlay into raw mechanical or Model Grader result evidence.
  • The four callers no longer assemble pending/terminal filenames, independently deserialize those records, or implement their overlapping membership/publication rules. Replace the superseded helpers. Update the domain-to-code navigation index to identify the new owner.
  • Preserve the existing capture, resume, Void-budget, Model Grader validation/replay and recheck regressions. Add focused tests through the new module's interface for publication/resume, terminal-only read isolation, pending accounting after Model Grader updates, and recheck overlay isolation. Run the repository's affected-test entry point before completion.

Blocked by

None (can start immediately).

Decisions

The design tree is settled in three rounds: scope and authority; writing, reading and grading; compatibility, errors and tests. Each branch below includes its reason.

  1. Scope and size. Publish one standalone Ticket: the change concentrates one private storage responsibility across four existing callers and fits one fresh implementation session. Keep the current Trial execution, sandbox, Bar, Verdict mathematics, Session evidence and Console behavior because none needs to change to gain storage locality. The existing glossary's Trial, Score and Experiment terms suffice; this reversible internal ownership change needs no new glossary term or ADR.

  2. Module and seam. Place the shared implementation in an Experiment-local Trial results module. Its interface offers per-Trial writing, terminal-only reading, retained capture and Model Score application. The implementation hides layout, decoding, eligibility, publication order and score-target translation. This earns depth: deleting it would redistribute those rules across Workers, metadata, retained reading and the Model Grader.

  3. Interface choice. Choose the worker-oriented writer plus immutable captures. The minimal alternative compressed the work into three callback-based operations; its callback and publication-intent contracts increased what callers had to understand. The flexible alternative added generalized edit/publication commands; those have no second concrete use. Explicit lifecycle operations give the common Worker flow leverage without those extra concepts.

  4. Identity and authority. Keep the current suite/Eval task/Arm/Trial identity and key encoding. Give captured terminal entries an opaque score target whose serialization stays exactly the existing assessment-map filename, including its suffix; use captured entries to resolve targets rather than joining unchecked assessment strings to a path. This preserves old assessments, pre-shuffle order and association with the actual selected file. Retain the Experiment's exclusive mutation lock and one queued Worker per Trial; no new per-record lock or concurrent writer is introduced.

  5. Writer lifecycle. Resume by loading pending history or constructing today's initial Trial result. Expose read-only progress, record-attempt and finish operations. Record-attempt owns appending the completed output, replacing outcome/mechanical Score, and writing the attempt output before pending history. Finish atomically replaces the terminal record and retains pending history. Workers request finish on ordinary completion and on an exhausted pause before returning its pause error. Keeping policy in Workers avoids duplicating the Bar while centralizing storage ordering.

  6. Reading shapes. Provide separate terminal-only reads and full retained captures over one terminal-reading implementation. A terminal-only consumer must remain independent of unrelated pending-file corruption, so a compulsory full capture is rejected. Full captures own terminal membership, captured Trial folders, pending histories and unfinished membership. Retained reading consumes these values for accounting, active eligibility and legacy attempt indices, and continues owning active-file sampling, Session discovery, confinement and usage.

  7. Observation guarantees. Capture terminal membership before pending histories and reuse every captured value. Preserve optional absence and per-file error propagation. This continues the existing observation contract without promising a simultaneous snapshot across files. Pending histories remain available after terminal publication because they supply accounting and legacy attempt attribution; terminal data alone must not become an accounting fallback.

  8. Raw evidence and rechecks. Keep raw terminal values distinct from values carrying human recheck history. Terminal reading supplies raw evidence to the Model Grader; one shared overlay operation supplies the copies consumed by retained views and Verdict/recheck reads. Writer construction takes Trial identity rather than an arbitrary observed result. These choices prevent human overlays from being persisted into Grader evidence and preserve the recently shared recheck behavior.

  9. Model Grader application. Capture raw terminal entries once for the grading stage and group them by Eval task, preserving current lexical order before the seeded shuffle. The Model Grader continues choosing its fixed setup, building blind packets, validating every response and saving the complete assessment before applying it. Trial results applies that assessment to its selected terminal entries using opaque targets and the existing combined-Score operation. Reapplying a saved assessment remains idempotent; pending history remains mechanical. This removes filename coupling and repeated whole-result scans while keeping grading judgments in their existing module.

  10. Storage and failure semantics. Preserve the existing individual-file temporary-write/rename implementation, optional-file handling, filename eligibility and error propagation. A failed multi-file publication may leave its already-written prefix for resume; this refactor adds no cross-file transaction, cleanup, repair or stricter validation policy. That keeps saved data and failure behavior compatible.

  11. Dependency strategy. Dependencies are local-substitutable. Use real temporary directories for writer tests and reuse the existing native and counted/mutating filesystem adapters for capture tests through one private seam shared with retained reading. Rehome that existing seam where needed; do not add another overlapping filesystem contract or expose it to ordinary callers. Two real adapters justify this seam.

  12. Testing. The interface is the test surface. Keep command regressions that exercise Stop/resume, fixed Void budgets, validated assessment replay, raw/effective Scores and CLI/Console observations. Move capture ownership assertions to the owning interface while preserving the joint retained-view tests for sampling once, captured absence, terminal/pending overlap, legacy indices and corruption. Add a terminal-only read with corrupt unrelated pending metadata, a writer dropped after checkpoint then resumed, and a terminal Model Score update followed by accounting and recheck reads. Assert returned progress, captured observations and saved compatible data; delete superseded helper tests once this coverage exists. These tests exercise lifecycle behavior rather than filesystem-call forwarding.

  13. Coverage and priority. No open issue among the 116 refreshed issues proposes this deepening. Spec: a Bar a release that changes nothing can pass #1252 changes the Bar and recheck behavior; it does not own pending/terminal persistence. Closed Deepen retained Experiment reading into one captured observation #1283 deliberately left mutation-side result reads and publication protocols outside its retained-reading change. Recent pending-accounting, capture and overlay corrections make this responsibility active enough to prioritize. No dependency on Spec: a Bar a release that changes nothing can pass #1252 is needed.

Review validation at ed00d8d: all six existing retained-reading tests and the cut-short-retry resume regression passed. The affected-test entry point against origin/main reported no changed files. No source changes were made by this Architecture review.

Architecture review

Strength: Strong · Dependencies: local-substitutable

Files: src/evals/experiment/workers.rs:194–215,385–415, src/evals/experiment/store.rs:242–257,357–371, src/evals/experiment/model_grader.rs:131–137,188–203, src/evals/experiment/reading.rs:99–118,223–234; new Trial results module beside them; src/evals/experiment/reading/tests.rs, tests/experiments.rs, tests/experiments/model_graders.rs, tests/console/experiments.rs, docs/code-navigation.md.

Before

flowchart LR
  W[Trial Workers] -.pending and terminal rules.-> F[Trial result files]
  M[Experiment metadata] -.terminal decoding.-> F
  R[Retained Experiment reading] -.membership and history.-> F
  G[Model Grader] -.score targets and rewrites.-> F
  linkStyle 0,1,2,3 stroke:#dc2626,stroke-width:2px
Loading

After

flowchart LR
  W[Trial Workers] --> T[Trial results module]
  M[Experiment metadata] --> T
  R[Retained Experiment reading] --> T
  G[Model Grader] --> T
  T --> F[Trial result files]
  classDef deep stroke:#2563eb,stroke-width:3px
  class T deep
Loading

Problem: A shallow storage interface leaves four callers coordinating result layout, decoding, publication and pending/terminal precedence across the seam.

Solution: Deepen Trial results so its implementation owns those rules behind one interface, using the existing native and counted filesystem adapter seam.

Wins

  • Locality: publication rules stay together
  • Leverage: four callers share storage
  • Depth: one interface owns lifecycle
  • Tests cross the owning seam
  • Saved Experiment compatibility stays explicit

Activity

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