Skip to content

Deepen Run metrics Session evidence attribution #2082

Open

Description

@JacobStephens2

Strength: Worth exploring · Dependencies: local-substitutable

Files: src/logs/run_metrics.rs, src/logs/metrics/trends.rs, src/logs/command_record.rs, src/session/recording.rs, tests/run_metrics.rs, tests/metrics.rs

Before

flowchart LR
  C[Completion metrics] -.-> R[Command records]
  W[Weekly trends] -.-> R
  C -.-> E[Session evidence]
  W -.-> E
  classDef leak stroke:#dc2626,stroke-width:2px;
  class C,W leak
Loading

After — opportunity to investigate

flowchart LR
  C[Completion metrics] --> A[Run metrics Session attribution]
  W[Weekly trends] --> A
  A --> R[Command records]
  A --> E[Session evidence]
  classDef deep stroke-width:3px;
  class A deep
Loading

Problem: Completion metrics and weekly trends independently associate Sessions with stages and evidence, spreading identity, first-stage ownership and setup knowledge across their implementations.

Evidence:

  • Completion metrics zip recorded stages with metric stages and deduplicate Session signals by normalized Session identity; review findings instead deduplicate literal paths.
  • Weekly trends independently reconnect metric stages to recorded stages by index, deduplicate normalized Session identities, read exact-Command Model evidence, and track Security review/Resume setup fallback.

Solution: Investigate a deep Run metrics module whose interface owns Session-to-stage attribution and evidence selection at one seam, retaining completion and weekly trends as distinct projections.

Wins

  • Locality: one attribution policy
  • Leverage: completion and weekly trends
  • Tests cross one shared interface

Why not Strong: Some rules serve different projections; the deletion test has not established that consolidation would concentrate meaningful complexity rather than move it into another shallow module.

Investigation: Prototype the attribution seam against shared Session references, former/current filename aliases, repeated Repairs, missing evidence and Security review Resumes; reject a helper that merely returns a normalized path or relocates the existing loops.

Testing: The interface is the test surface; existing completion and CLI trend regressions should survive, with temporary-file test adapters exercising attribution and evidence together and replacing duplicated private-helper tests where applicable.

Constraints: Preserve retained metric formats, read-only historical reconstruction, missing-evidence coverage, exact owning-Command Model evidence and ADR 0019/0021; the Trace ancestry module owns display ancestry and should retain that responsibility.

Priority and overlap: Recent Run metrics work expanded completion recording to Review, Triage and Fix runs (#2047); this seam now affects more callers. All 186 open issue titles and bodies were checked. No open issue proposes this deepening; #2036/#2066 change aggregation and presentation rather than concentrating Session attribution policy.

Activity

  1. added
    needs-triageMaintainer needs to evaluate this issue
    architect-ideaAn Architect idea: the issue an Architecture review with no Strong candidate ended on
    in-progressA Claim: thirdshift has taken this issue
    and removed
    needs-triageMaintainer needs to evaluate this issue
    on Nov 12, 2026
  2. JacobStephens2 commented on Nov 12, 2026

    @JacobStephens2
    OwnerAuthor

    This was generated by AI during triage.

    Investigation summary

    Investigated #2082 against selected Base commit 287d9a9. Code inspection confirms duplicated attribution policy, but does not establish that the proposed consolidation earns its interface cost. Recommend separating the interface proof from production migration.

    Confirmed evidence

    • src/logs/recording.rs:527-543 carries the last Session reference into subsequent stages. Repeated references therefore occur by design.
    • src/logs/run_metrics.rs:54-75 pairs recorded stages with metric stages positionally and assigns Session signals once per normalized identity. Review findings instead deduplicate literal paths at lines 138-143, although src/logs/effects.rs:57-58 resolves their sidecar through the normalized identity. Former/current filename aliases can therefore pass the review deduplication independently; this is a code-derived observation, not a reproduced incident.
    • src/logs/metrics/trends.rs:282-335 independently joins stage evidence by index, deduplicates normalized Session identities, tracks Security review/Resume setup fallback, and counts each Command once per complete Session grouping.
    • These projections have meaningful differences: completion considers all recorded stage references; trends handles Session rows separately from Delivery stages and records missing observations even when a Session stage has no path. A shared interface must distinguish unreferenced, missing and duplicate evidence.
    • src/session/recording.rs:427-430 accepts Model evidence only for the exact owning Command log. Trends applies that evidence, then lets recorded Session signals refine Harness/version. Unknown Security review, its Resume, and orphan Resume setups must remain unknown where evidence is absent.
    • src/logs/run_metrics.rs:95-96 and src/logs/reading.rs:414-429,521-522 preserve historical reconstruction and retained evidence. Historical review counts and Usual ranges are not inferred from current sidecars/history.

    Proposed split

    A. Prove a Run metrics attribution interface using temporary-file evidence adapters and a behavior matrix. Explore ordered stage observations that hide positional matching, normalized identity, first-stage ownership, evidence selection and setup fallback without exposing those algorithms to both callers. Exercise shared references, former/current filename aliases, repeated Repairs, absent/corrupt evidence, no-path stages, mismatched retained stage arrays, wrong-owner Model evidence, Security review Resumes and orphan Resumes. Demonstrate which caller responsibilities disappear; reject a normalization helper or pass-through extraction.
    B. Only after A establishes depth and settles the alias policy, migrate completion and weekly trends through that interface. Keep timing, aggregation, grouping and serialization in their existing projections. Preserve retained formats, saved metrics, historical read-only behavior, missing coverage, requested-versus-observed Model distinctions and ADR 0019/0021. Trace ancestry remains responsible for display attachment and descendant ownership.

    Existing regression anchors include tests/run_metrics.rs:226,271 and tests/metrics.rs:397,465,641,660,715,1151,1267,1358. Future implementation validation should run the focused Run metrics/metrics suites and scripts/affected-tests against its Base branch.

    No matching open issue was found among 186 open issues searched by title/body. #2036 and its related Tickets address aggregation/presentation rather than this interface. Tests were inspected, not executed: this investigation confirms an architectural observation, not a reported runtime failure. No source, Git-history or GitHub changes were made.

    Questionnaire

    For the Day shift deciding how to advance #2082:

    Code inspection confirms repeated Session attribution logic, but the issue's deletion test remains unproven. The proposed scope also contains a potential behavior change: completion review counts deduplicate literal paths while Session signals normalize former/current filenames.

    1. Approve the proposed split into A, an interface prototype with the behavior matrix and explicit evidence of caller simplification, followed by B, production migration blocked on reviewing A's result? Recommended: proceed with A first and authorize B only if the prototype demonstrates depth; otherwise retain the current implementations.
    2. For former/current filenames naming the same Session, should review findings count once under normalized identity, or must literal-path behavior remain compatible? Recommended: count once, consistent with the existing first-Session ownership comment, while preserving already saved metrics. This settles whether B includes an intentional behavior correction or only structural changes.
  3. added
    enhancementNew feature or request
    needs-triageMaintainer needs to evaluate this issue
    and removed
    in-progressA Claim: thirdshift has taken this issue
    on Nov 12, 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-ideaAn Architect idea: the issue an Architecture review with no Strong candidate ended onenhancementNew feature or requestneeds-triageMaintainer needs to evaluate this issueready-for-humanRequires human implementation

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions