From 6d410b810b8ab4fdea2592419887e521cac2bc7b Mon Sep 17 00:00:00 2001 From: Mathias Bergqvist Date: Mon, 20 Apr 2026 08:35:27 +0200 Subject: [PATCH] feat(session): extend Attempt with tier, timing, and verdict fields --- internal/session/session.go | 7 ++++++- internal/session/session_test.go | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/internal/session/session.go b/internal/session/session.go index 77a9dec..1616169 100644 --- a/internal/session/session.go +++ b/internal/session/session.go @@ -32,9 +32,14 @@ type Entry struct { type Attempt struct { Attempt int `json:"attempt"` Model string `json:"model"` + Tier string `json:"tier"` // local | subagent | managed + DurationMs int64 `json:"duration_ms"` + WarmStart bool `json:"warm_start"` // model already loaded in llama-swap + Verified bool `json:"verified"` + Verdict string `json:"verdict,omitempty"` // accept | escalate | error + Feedback string `json:"feedback,omitempty"` // verifier feedback on escalation OutputSummary string `json:"output_summary,omitempty"` RunnerOutput string `json:"runner_output,omitempty"` - Verified bool `json:"verified"` } // Append writes entry as a single JSON line to sessionsDir/{sessionID}.jsonl. diff --git a/internal/session/session_test.go b/internal/session/session_test.go index 279654d..c2e4150 100644 --- a/internal/session/session_test.go +++ b/internal/session/session_test.go @@ -61,3 +61,22 @@ func TestRead_EmptyWhenNoFile(t *testing.T) { require.NoError(t, err) assert.Empty(t, entries) } + +func TestAttemptRoundTrip(t *testing.T) { + a := session.Attempt{ + Attempt: 1, + Model: "ollama/devstral", + Tier: "local", + DurationMs: 4200, + WarmStart: true, + Verified: false, + Verdict: "escalate", + Feedback: "missing line references", + } + data, err := json.Marshal(a) + require.NoError(t, err) + + var got session.Attempt + require.NoError(t, json.Unmarshal(data, &got)) + assert.Equal(t, a, got) +}