review: test same-model/different-thinking inspectors link to distinct sessions · Entire

review: test same-model/different-thinking inspectors link to distinct sessions

13e6273→main·

dipree·1mo ago·1 file·+64 added/-0 removed

normalizeReviewModelID strips the thinking-level suffix, so two inspectors on the same agent with claude-sonnet:high / :low normalize to the same model id. Add a manifest test with both sessions starting in the same second to pin that used-session tracking in buildLocalReviewManifestFromSummary still links each worker to a distinct session (without it, both would grab the same most-recent match).

Sessions

9babda34a47bView transcript

[?
Checkout the hand off doc that I just added.Pi·Opus 4.8·2 steps](/content/gh/entireio/cli/session/019eca64-8c2c-7b00-90c6-3aa49738c497#timeline-9babda34a47b/index.html)

Changes

1

782 unmodified lines

// TestBuildLocalReviewManifestFromSummary_DisambiguatesSameModelDifferentThinking
// pins the used-session tracking: two inspectors on the same agent whose models
// normalize identically (claude-sonnet:high / :low -> claude-sonnet), with
// sessions that start in the same second, must still link to distinct sessions
// rather than both grabbing the most recent match.
func TestBuildLocalReviewManifestFromSummary_DisambiguatesSameModelDifferentThinking(t *testing.T) {
    started := time.Date(2026, 5, 7, 10, 0, 0, 0, time.UTC)
    summary := reviewtypes.RunSummary{
        StartedAt: started,
        AgentRuns: []reviewtypes.AgentRun{
            {
                Name:      "claude-code",
                AgentName: "claude-code",
                Model:     "claude-sonnet:high",
                Status:    reviewtypes.AgentStatusSucceeded,
                Buffer:    []reviewtypes.Event{reviewtypes.AssistantText{Text: "high finding"}},
            },
            {
                Name:      "claude-code",
                AgentName: "claude-code",
                Model:     "claude-sonnet:low",
                Status:    reviewtypes.AgentStatusSucceeded,
                Buffer:    []reviewtypes.Event{reviewtypes.AssistantText{Text: "low finding"}},
            },
        },
    }
    // Both sessions resolve to the same model and start in the same second, so
    // only used-session tracking can keep the two workers on distinct sessions.
    sameStart := started.Add(time.Second)
    states := []*session.State{
        {
            SessionID:    "sess-1",
            Kind:         session.KindAgentReview,
            WorktreePath: "/repo",
            BaseCommit:   "abc123",
            StartedAt:    sameStart,
            AgentType:    agenttypes.AgentType("Claude Code"),
            ModelName:    "claude-sonnet-4-5",
        },
        {
            SessionID:    "sess-2",
            Kind:         session.KindAgentReview,
            WorktreePath: "/repo",
            BaseCommit:   "abc123",
            StartedAt:    sameStart,
            AgentType:    agenttypes.AgentType("Claude Code"),
            ModelName:    "claude-sonnet-4-5",
        },
    }

manifest := buildLocalReviewManifestFromSummary("/repo", "abc123", summary, states, "")

if len(manifest.Sources) != 2 {
            t.Fatalf("sources = %d, want 2 (each inspector linked to a session)", len(manifest.Sources))
        }
        a, b := manifest.Sources[0].SessionID, manifest.Sources[1].SessionID
        if a == b {
                t.Fatalf("both inspectors linked to the same session %q; used-session tracking must keep them distinct", a)
        }
        if !(a == "sess-1" || a == "sess-2") || !(b == "sess-1" || b == "sess-2") {
                t.Errorf("sessions = {%q, %q}, want the two distinct sessions sess-1 and sess-2", a, b)
        }
}

Mcmd/entire/cli/review/manifest_test.go+64