From e630c003cd4f8a46c4d6c27d1576e37a9ceb989d Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 13 Nov 2026 12:26:39 +0800 Subject: [PATCH] usage: Devin CLI's own calls are read from its sessions (aohan0905 on X) Usage counted none of Devin CLI's requests. Devin's CLI (3000.11.234, run for real in a sandbox HOME) keeps its sessions in /devin/cli: sessions.db (SQLite: sessions, and message_nodes with each chat_message), or with DEVIN_SESSION_STORE=files a folder per session (log.jsonl + meta.json), whose first run copies the database's sessions in and leaves the database. Each assistant message names its call: request_id, generation_model (swe-2-high, effort and all), created_at and metrics (input/output/cache read/cache write tokens, ttft_ms, total_time_ms), written as two nodes per reply. - sessions: calls_devin.go lists both stores (a session in both once, from the store written last), reads each session whole, one call per request_id (Msg devin:), with the cwd. Registered in callSources and wholeCallReaders; Found lists "devin" for the consent page. - provider: DevinModelEffort splits a variant id into model and effort (claude-haiku-5-5-low -> claude-haiku-5-5, low), so the catalog prices it. swe-2 has no catalog price and shows as unpriced. - agentenv clears DEVIN_SESSIONS_DIR in test sandboxes. Fixtures are the real runs' files: 3 sessions in sessions.sql (schema verbatim, triggers dropped, assistant and user rows only), one session only in the folder store and one in both, project folder renamed. Run (mica): go test ./internal/sessions ./internal/provider ./internal/agentenv ./internal/usage ./internal/usageapi ./internal/cli ./internal/gui ok; go vet darwin, linux -tags nogui, windows on the touched packages ok; gofmt clean. win-run: the Devin tests ok. A built binary's `magpie usage all` / `--csv all` in a sandbox HOME holding the real Devin data: 5 calls under Devin, the two claude-haiku-5-5 calls priced from the catalog ($0.000277, $0.000986), swe-2 unpriced. Broken by hand: devinCallFiles out of callSources (TestDevinCalls and TestDevinDBReadAgain red, 0 calls); a session in both stores listed twice (TestDevinSessionListedOnce red, 9 calls); the per-request dedupe off (red, a request counted twice); DevinModelEffort returning the id whole (TestDevinCalls and TestDevinModelEffort red). Not tried: Devin's folder on Windows (taken as %APPDATA%\devin\cli, as its credentials.toml; not seen on a real Windows install); a long real session or subagents; DEVIN_SESSIONS_DIR set (read from the CLI's behaviour in the sandbox, not from a GUI-started magpie's environment). --- internal/agentenv/agentenv.go | 2 + internal/provider/devin.go | 29 ++ internal/provider/devin_test.go | 20 ++ internal/sessions/access.go | 5 + internal/sessions/call_cache.go | 1 + internal/sessions/calls.go | 1 + internal/sessions/calls_devin.go | 294 ++++++++++++++++++ internal/sessions/calls_devin_test.go | 152 +++++++++ internal/sessions/skills_every_agent_test.go | 1 + .../sessions/testdata/devin/cli/sessions.sql | 43 +++ .../cli/sessions/chrome-radish/log.jsonl | 8 + .../cli/sessions/chrome-radish/meta.json | 13 + .../cli/sessions/cyan-skipjack/log.jsonl | 8 + .../cli/sessions/cyan-skipjack/meta.json | 13 + 14 files changed, 590 insertions(+) create mode 100644 internal/sessions/calls_devin.go create mode 100644 internal/sessions/calls_devin_test.go create mode 100644 internal/sessions/testdata/devin/cli/sessions.sql create mode 100644 internal/sessions/testdata/devin/cli/sessions/chrome-radish/log.jsonl create mode 100644 internal/sessions/testdata/devin/cli/sessions/chrome-radish/meta.json create mode 100644 internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/log.jsonl create mode 100644 internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/meta.json diff --git a/internal/agentenv/agentenv.go b/internal/agentenv/agentenv.go index a42da9469..649995df3 100644 --- a/internal/agentenv/agentenv.go +++ b/internal/agentenv/agentenv.go @@ -61,6 +61,8 @@ var Vars = []string{ // PenguinHarness's data root and the Project its CLI works in // ($PENGUIN_HOME/$PENGUIN_PROJECT_ID/.project_config.toml) "PENGUIN_HOME", "PENGUIN_PROJECT_ID", + // Devin CLI's sessions folder ($DEVIN_SESSIONS_DIR/cli) + "DEVIN_SESSIONS_DIR", // omp "OMP_PROFILE", // Qoder's two builds, the global site's and China's diff --git a/internal/provider/devin.go b/internal/provider/devin.go index d79ed4170..cd3955b38 100644 --- a/internal/provider/devin.go +++ b/internal/provider/devin.go @@ -818,6 +818,35 @@ func devinTierOf(id string) (tier, level string) { return "", devinLevel(id) } +// DevinModelEffort splits a Devin variant id into the model it runs and the +// effort it runs at, the way its own logs name a call (generation_model): +// swe-2-high is ("swe-2", "high"), claude-opus-5-5-high-fast +// ("claude-opus-5-5-fast", "high"), and an id that names no effort +// (glm-5-2-1m, swe-1-6-fast) is itself with none. No family list is needed: +// the effort and tier words are Devin's own (devinLevels, devinTiers). +func DevinModelEffort(id string) (model, effort string) { + tier, level := devinTierOf(id) + if level == "" { + return id, "" + } + rest, sep := id, "" + if tier != "" { + rest, sep = id[:len(id)-len(tier)-1], id[len(id)-len(tier)-1:len(id)-len(tier)] + } + low := strings.ToLower(rest) + for _, l := range devinLevels { + if l.level != level { + continue + } + for _, s := range []string{"-", "_"} { + if strings.HasSuffix(low, s+l.word) { + return rest[:len(rest)-len(l.word)-1] + sep + id[len(id)-len(tier):], level + } + } + } + return id, level +} + // devinEffortOf is the effort a Devin id runs at, in a tier or not. func devinEffortOf(id string) string { _, l := devinTierOf(id) diff --git a/internal/provider/devin_test.go b/internal/provider/devin_test.go index 183c02570..d5f65a3fc 100644 --- a/internal/provider/devin_test.go +++ b/internal/provider/devin_test.go @@ -331,3 +331,23 @@ func TestDevinStatusKeepsTheAccount(t *testing.T) { t.Fatal("Devin's servers unreachable dropped the account") } } + +// TestDevinModelEffort: a Devin CLI log names a call's model with its effort +// (and tier) in it; usage counts the model and the effort apart. +func TestDevinModelEffort(t *testing.T) { + for id, want := range map[string][2]string{ + "swe-2-high": {"swe-2", "high"}, + "claude-haiku-5-5-low": {"claude-haiku-5-5", "low"}, + "claude-opus-5-5-high-fast": {"claude-opus-5-5-fast", "high"}, + "gpt-6-sol-none": {"gpt-6-sol", "none"}, + "gpt-6-sol-xhigh-priority": {"gpt-6-sol-priority", "xhigh"}, + "MODEL_X_HIGH": {"MODEL_X", "high"}, + "model-minimal": {"model", "minimal"}, + "glm-5-2-1m": {"glm-5-2-1m", ""}, + "swe-1-6-fast": {"swe-1-6-fast", ""}, + } { + if m, e := DevinModelEffort(id); m != want[0] || e != want[1] { + t.Errorf("DevinModelEffort(%q) = %q, %q; want %q, %q", id, m, e, want[0], want[1]) + } + } +} diff --git a/internal/sessions/access.go b/internal/sessions/access.go index ba040a1bf..01afc3c34 100644 --- a/internal/sessions/access.go +++ b/internal/sessions/access.go @@ -249,5 +249,10 @@ func Found() []string { add("agy", filepath.Join(AgyDir(), "brain")) add("antigravity", antigravityConversations(), filepath.Join(AntigravityInsidersDir(), "conversations")) add("gemini", geminiTmpDir()) + var devin []string + for _, d := range DevinCLIDirs() { + devin = append(devin, filepath.Join(d, "sessions.db"), filepath.Join(d, "sessions")) + } + add("devin", devin...) return out } diff --git a/internal/sessions/call_cache.go b/internal/sessions/call_cache.go index 48b937860..599fc8319 100644 --- a/internal/sessions/call_cache.go +++ b/internal/sessions/call_cache.go @@ -262,6 +262,7 @@ var wholeCallReaders = map[string]func(file) (*callFile, bool){ "minimax-code": readMiniMaxCalls, "agy": readAgyCalls, // #2097 "antigravity": readAntigravityCalls, // #2190 + "devin": readDevinCalls, // aohan0905 on X } // resumeCallReaders read an agent's calls from a file only appended to that diff --git a/internal/sessions/calls.go b/internal/sessions/calls.go index 400abc81d..4a8db5166 100644 --- a/internal/sessions/calls.go +++ b/internal/sessions/calls.go @@ -347,6 +347,7 @@ func callSourcesInto(out []file, codex []file) []file { minimaxCallFiles(), kimiCallFiles(), wslFiles("kimi"), piCallFiles(), codebuddyCallFiles(), workbuddyAIFiles(), agyCallFiles(), // #2097 antigravityCallFiles(), // #2190 + devinCallFiles(), // aohan0905 on X workbuddyCallFiles(), grokCallFiles()) // #4423 if out == nil { return allowed(distinctOf(lists...)) diff --git a/internal/sessions/calls_devin.go b/internal/sessions/calls_devin.go new file mode 100644 index 000000000..e7f2c7f55 --- /dev/null +++ b/internal/sessions/calls_devin.go @@ -0,0 +1,294 @@ +package sessions + +import ( + "bufio" + "bytes" + "database/sql" + "encoding/json" + "errors" + "io" + "os" + "path/filepath" + "sort" + "strings" + "sync" + "time" + + "github.com/yetone/magpie/internal/appdir" + "github.com/yetone/magpie/internal/provider" +) + +// Devin CLI's calls (aohan0905 on X: Usage counted none of them). Devin's +// CLI (3000.11.234, tried in a sandbox HOME with a real account) keeps its +// sessions beside its sign-in, in /devin/cli, where is +// $XDG_DATA_HOME or ~/.local/share (%APPDATA% on Windows, as its +// credentials.toml), or $DEVIN_SESSIONS_DIR when set: +// +// - sessions.db, SQLite: a sessions row each (id, working_directory, …, +// last_activity_at in unix seconds), and message_nodes, the chat's +// messages as a tree, each a chat_message JSON; +// - with DEVIN_SESSION_STORE=files, sessions//log.jsonl and meta.json +// instead, a {"kind":"node","node":{…,"message":{…}}} line a message. +// On its first run that store copies sessions.db's sessions in and +// leaves the database where it was, so a session can be in both. +// +// An assistant message carries its call in metadata: request_id, +// generation_model (the variant id, swe-2-high, effort and all), created_at, +// and metrics with input_tokens (less what was read from the cache), +// output_tokens, cache_read_tokens, cache_creation_tokens, ttft_ms and +// total_time_ms. Devin writes each reply as two nodes with one request_id, +// so a call is counted once by it, across both stores too (Msg). Devin +// talks to its own backend, never through magpie's gateway, so there is no +// gateway record to pair a call with. + +// DevinCLIDirs are the folders Devin's CLI may keep sessions in. +func DevinCLIDirs() []string { + var out []string + if d := appdir.Getenv("DEVIN_SESSIONS_DIR"); d != "" { + out = append(out, filepath.Join(d, "cli")) + } + d := filepath.Join(filepath.Dir(provider.DevinCredentialsPath()), "cli") + if len(out) == 0 || out[0] != d { + out = append(out, d) + } + return out +} + +// devinCallList is the last listing of each sessions.db, kept while the +// database and its WAL are as they were. +var devinCallList struct { + sync.Mutex + m map[string]devinListing +} + +type devinListing struct { + stamp string + files []file +} + +// devinCallFiles are Devin's sessions as call sources: a folder store's +// log.jsonl, or a database's session as db#id. A session in both stores is +// listed once, from the one written to last. +func devinCallFiles() []file { + if !Reads("devin") { + return nil + } + var out []file + at := map[string]int{} // a session's id → its file in out + put := func(id string, f file) { + if i, ok := at[id]; ok { + if f.mod > out[i].mod { + out[i] = f + } + return + } + at[id] = len(out) + out = append(out, f) + } + for _, dir := range DevinCLIDirs() { + ents, _ := os.ReadDir(filepath.Join(dir, "sessions")) + for _, e := range ents { + if !e.IsDir() { + continue + } + p := filepath.Join(dir, "sessions", e.Name(), "log.jsonl") + fi, err := os.Stat(p) + if err != nil || fi.IsDir() { + continue + } + put(e.Name(), file{agent: "devin", key: "devin:" + e.Name(), path: p, main: true, size: fi.Size(), mod: modOf(fi.ModTime())}) + } + for _, f := range devinDBFiles(filepath.Join(dir, "sessions.db")) { + put(strings.TrimPrefix(f.key, "devin:"), f) + } + } + return out +} + +// devinDBFiles are a sessions.db's sessions, as db#id. +func devinDBFiles(path string) []file { + if !fileExists(path) { + return nil + } + stamp := ocStamp(path) + devinCallList.Lock() + defer devinCallList.Unlock() + if l, ok := devinCallList.m[path]; ok && stamp != "" && l.stamp == stamp { + return append([]file(nil), l.files...) + } + var out []file + ok := withOCCallDB(path, func(db *sql.DB) { + rows, err := db.Query(`SELECT s.id, s.last_activity_at, COUNT(m.row_id), COALESCE(MAX(m.row_id), 0) + FROM sessions s LEFT JOIN message_nodes m ON m.session_id = s.id GROUP BY s.id`) + if err != nil { + return + } + defer rows.Close() + for rows.Next() { + var id string + var last, n, top int64 + if rows.Scan(&id, &last, &n, &top) != nil { + continue + } + // a message added or taken away changes the size, as a line + // added to a file does + out = append(out, file{agent: "devin", key: "devin:" + id, path: path + "#" + id, main: true, size: n<<32 | top, mod: modOf(time.Unix(last, 0))}) + } + }) + if !ok { + return nil + } + if devinCallList.m == nil { + devinCallList.m = map[string]devinListing{} + } + devinCallList.m[path] = devinListing{stamp, out} + return append([]file(nil), out...) +} + +// devinMessage is a chat_message as Devin writes it, the fields a call needs. +type devinMessage struct { + Role string `json:"role"` + Metadata struct { + RequestID string `json:"request_id"` + Model string `json:"generation_model"` + CreatedAt string `json:"created_at"` + Metrics *struct { + TTFT *int64 `json:"ttft_ms"` + Total *int64 `json:"total_time_ms"` + Input *int `json:"input_tokens"` + Output *int `json:"output_tokens"` + CacheRead *int `json:"cache_read_tokens"` + CacheWrite *int `json:"cache_creation_tokens"` + } `json:"metrics"` + } `json:"metadata"` +} + +// readDevinCalls reads a session's calls whole, from its log.jsonl or its +// rows of sessions.db. +func readDevinCalls(f file) (*callFile, bool) { + st := &callFile{Agent: "devin", Path: f.path, Session: strings.TrimPrefix(f.key, "devin:")} + var cwd string + var msgs [][]byte + if i := strings.LastIndex(f.path, "#"); i >= 0 && !strings.HasSuffix(f.path, ".jsonl") { + path, sid := f.path[:i], f.path[i+1:] + if st.Session == "" { + st.Session = sid + } + ok := withOCCallDB(path, func(db *sql.DB) { + _ = db.QueryRow(`SELECT COALESCE(working_directory, '') FROM sessions WHERE id = ?`, sid).Scan(&cwd) + rows, err := db.Query(`SELECT chat_message FROM message_nodes + WHERE session_id = ? AND json_extract(chat_message, '$.role') = 'assistant' ORDER BY row_id`, sid) + if err != nil { + return + } + defer rows.Close() + for rows.Next() { + var b []byte + if rows.Scan(&b) == nil { + msgs = append(msgs, b) + } + } + }) + if !ok { + return st, false + } + } else { + var ok bool + if msgs, ok = devinLogMessages(f.path); !ok { + return st, false + } + var meta struct { + Cwd string `json:"working_directory"` + } + if b, err := os.ReadFile(filepath.Join(filepath.Dir(f.path), "meta.json")); err == nil && json.Unmarshal(b, &meta) == nil { + cwd = meta.Cwd + } + if st.Session == "" { + st.Session = filepath.Base(filepath.Dir(f.path)) + } + } + seen := map[string]bool{} + for _, b := range msgs { + var m devinMessage + if json.Unmarshal(b, &m) != nil { + continue + } + c, ok := devinCall(st, m) + if !ok || seen[c.Msg] { + continue + } + seen[c.Msg] = true + c.Cwd = st.str(cwd) + st.Calls = append(st.Calls, c) + } + sort.SliceStable(st.Calls, func(i, j int) bool { return st.Calls[i].Time.Before(st.Calls[j].Time) }) + return st, true +} + +var devinRequest = []byte(`"request_id"`) + +// devinLogMessages are the messages of a folder store's log.jsonl nodes. +func devinLogMessages(path string) ([][]byte, bool) { + r, err := os.Open(path) + if err != nil { + return nil, false + } + defer r.Close() + var out [][]byte + br := bufio.NewReaderSize(r, scanBuffer(r, 0)) + for { + b, err := br.ReadBytes('\n') + if err != nil && (!errors.Is(err, io.EOF) || len(bytes.TrimSpace(b)) == 0) { + break + } + b = bytes.TrimSpace(b) + if len(b) > 0 && len(b) <= maxLine && bytes.Contains(b, devinRequest) { + var line struct { + Kind string `json:"kind"` + Node struct { + Message json.RawMessage `json:"message"` + } `json:"node"` + } + if json.Unmarshal(b, &line) == nil && line.Kind == "node" && len(line.Node.Message) > 0 { + out = append(out, line.Node.Message) + } + } + if err != nil { + break + } + } + return out, true +} + +// devinCall is an assistant message as a call; one with no metrics (a +// message Devin made itself) is none. +func devinCall(st *callFile, m devinMessage) (Call, bool) { + md := m.Metadata + if m.Role != "assistant" || md.RequestID == "" || md.Metrics == nil || md.Metrics.Input == nil || md.Metrics.Output == nil { + return Call{}, false + } + t, err := time.Parse(time.RFC3339Nano, md.CreatedAt) + if err != nil { + return Call{}, false + } + model, effort := provider.DevinModelEffort(md.Model) + c := Call{Agent: "devin", Time: t, Session: st.Session, Model: st.str(model), Effort: st.str(effort), + Tokens: Tokens{Input: *md.Metrics.Input, Output: *md.Metrics.Output}} + if p := md.Metrics.CacheRead; p != nil { + c.CacheRead = *p + } + if p := md.Metrics.CacheWrite; p != nil { + c.CacheWrite = *p + } + if c.Tokens.zero() { + return Call{}, false + } + if p := md.Metrics.TTFT; p != nil { + c.TTFT = *p + } + if p := md.Metrics.Total; p != nil { + c.Millis = *p + } + c.Msg = "devin:" + md.RequestID + return c, true +} diff --git a/internal/sessions/calls_devin_test.go b/internal/sessions/calls_devin_test.go new file mode 100644 index 000000000..8a6c2adc6 --- /dev/null +++ b/internal/sessions/calls_devin_test.go @@ -0,0 +1,152 @@ +package sessions + +import ( + "database/sql" + "os" + "path/filepath" + "testing" + "time" +) + +// devinSetup puts testdata/devin's sessions where Devin's CLI keeps them, +// $XDG_DATA_HOME/devin/cli (%APPDATA%\devin\cli on Windows): sessions.db, +// made from sessions.sql, and the folder store's sessions/. Both are a +// real Devin CLI's (3000.11.234), cut to the messages and with the project +// folder renamed: plucky-switch and poised-trust only in the database, +// cyan-skipjack only in the folder store, and chrome-radish in both, as the +// folder store's first run copies it over. +func devinSetup(t *testing.T) (cli string) { + t.Helper() + setup(t) + cli = DevinCLIDirs()[0] + copyTree(t, "testdata/devin/cli/sessions", filepath.Join(cli, "sessions")) + q, err := os.ReadFile("testdata/devin/cli/sessions.sql") + if err != nil { + t.Fatal(err) + } + db, err := sql.Open("sqlite", filepath.Join(cli, "sessions.db")) + if err != nil { + t.Fatal(err) + } + defer db.Close() + if _, err := db.Exec(string(q)); err != nil { + t.Fatal(err) + } + return cli +} + +// devinCalls are the Devin calls Calls gives, by request. +func devinCalls(t *testing.T) map[string]Call { + t.Helper() + out := map[string]Call{} + for _, c := range Calls(time.Time{}) { + if c.Agent == "devin" { + if _, dup := out[c.Msg]; dup { + t.Fatalf("request %s counted twice", c.Msg) + } + out[c.Msg] = c + } + } + return out +} + +// Devin CLI's calls reach the usage ledger (aohan0905 on X): each reply's +// tokens, model and effort, from either of its stores, once a request +// though Devin writes each reply twice and a session can be in both. +func TestDevinCalls(t *testing.T) { + devinSetup(t) + cs := devinCalls(t) + if len(cs) != 7 { + t.Fatalf("want 7 Devin calls, got %d: %+v", len(cs), cs) + } + for _, w := range []struct { + req, session, model, effort string + tokens Tokens + }{ + {"d07541eb-60f2-46b4-97b4-eb53c04f19a8", "plucky-switch", "swe-2", "high", Tokens{Input: 2143, Output: 44, CacheRead: 10112}}, + {"29bc2ea6-ee76-4e5d-95c1-ce2be7d94327", "poised-trust", "swe-2", "high", Tokens{Input: 10914, Output: 68, CacheRead: 1344}}, + {"cda0f093-57c7-4c4a-b73e-8f55035b52b7", "poised-trust", "swe-2", "high", Tokens{Input: 2261, Output: 42, CacheRead: 10112}}, + {"7f0d1818-1993-4c66-9fec-d5c5f292062a", "chrome-radish", "claude-haiku-5-5", "low", Tokens{Input: 467, Output: 85, CacheRead: 12633, CacheWrite: 6163}}, + {"03288c50-2fbc-412f-8930-e8e6f0ebcc0e", "chrome-radish", "claude-haiku-5-5", "low", Tokens{Input: 2, Output: 19, CacheRead: 18796, CacheWrite: 635}}, + {"282cedf0-804b-4df6-8d1c-74ce51d981ff", "cyan-skipjack", "claude-haiku-5-5", "low", Tokens{Input: 468, Output: 85, CacheRead: 18796}}, + {"3becd065-65e5-4345-bfa7-d5ccd738876b", "cyan-skipjack", "claude-haiku-5-5", "low", Tokens{Input: 2, Output: 19, CacheRead: 18796, CacheWrite: 636}}, + } { + c, ok := cs["devin:"+w.req] + if !ok { + t.Errorf("request %s (%s) not read", w.req, w.session) + continue + } + if c.Session != w.session || c.Model != w.model || c.Effort != w.effort || c.Tokens != w.tokens || c.Cwd != "/work/proj" { + t.Errorf("request %s: %+v", w.req, c) + } + } + c := cs["devin:7f0d1818-1993-4c66-9fec-d5c5f292062a"] + if want := time.Date(2026, 11, 13, 4, 10, 5, 299749000, time.UTC); !c.Time.Equal(want) || c.Millis != 1548 || c.TTFT != 0 { + t.Errorf("chrome-radish's first call: time %v ms %d ttft %d", c.Time, c.Millis, c.TTFT) + } + if c := cs["devin:03288c50-2fbc-412f-8930-e8e6f0ebcc0e"]; c.TTFT != 1171 || c.Millis != 1210 { + t.Errorf("chrome-radish's second call: ttft %d ms %d", c.TTFT, c.Millis) + } +} + +// A session in both stores is one source, and a source counts each +// request once, so a reader of one source at a time (the Requests page) +// counts a call once too. +func TestDevinSessionListedOnce(t *testing.T) { + devinSetup(t) + got := map[string]int{} + n := 0 + for _, f := range devinCallFiles() { + got[f.key]++ + // a source on its own counts each request once: Devin writes a + // reply as two messages with one request_id + st, ok := readDevinCalls(f) + if !ok { + t.Fatalf("%s not read", f.path) + } + seen := map[string]bool{} + for _, c := range st.Calls { + if seen[c.Msg] { + t.Fatalf("%s: request %s counted twice", f.path, c.Msg) + } + seen[c.Msg] = true + } + n += len(st.Calls) + } + if n != 7 { + t.Fatalf("the sources have %d calls, want 7", n) + } + want := map[string]int{"devin:plucky-switch": 1, "devin:poised-trust": 1, "devin:chrome-radish": 1, "devin:cyan-skipjack": 1} + if len(got) != len(want) { + t.Fatalf("sources %v, want %v", got, want) + } + for k, n := range want { + if got[k] != n { + t.Fatalf("sources %v, want %v", got, want) + } + } +} + +// A session the database alone has, read again after Devin adds to it. +func TestDevinDBReadAgain(t *testing.T) { + cli := devinSetup(t) + if n := len(devinCalls(t)); n != 7 { + t.Fatalf("want 7 calls, got %d", n) + } + db, err := sql.Open("sqlite", filepath.Join(cli, "sessions.db")) + if err != nil { + t.Fatal(err) + } + defer db.Close() + if _, err := db.Exec(`INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) + VALUES (900, 'plucky-switch', 900, 0, '{"role":"assistant","content":"ok","metadata":{"request_id":"r-new","generation_model":"swe-2-high","created_at":"2026-11-13T05:00:00Z","metrics":{"input_tokens":5,"output_tokens":1,"cache_read_tokens":null,"cache_creation_tokens":null}}}', 1794546000, NULL)`); err != nil { + t.Fatal(err) + } + if _, err := db.Exec(`UPDATE sessions SET last_activity_at = 1794546000 WHERE id = 'plucky-switch'`); err != nil { + t.Fatal(err) + } + cs := devinCalls(t) + if c, ok := cs["devin:r-new"]; !ok || c.Tokens != (Tokens{Input: 5, Output: 1}) { + t.Fatalf("the new call: %+v (of %d)", c, len(cs)) + } +} diff --git a/internal/sessions/skills_every_agent_test.go b/internal/sessions/skills_every_agent_test.go index 3022cbca1..d8eb7b3b2 100644 --- a/internal/sessions/skills_every_agent_test.go +++ b/internal/sessions/skills_every_agent_test.go @@ -50,6 +50,7 @@ var skillsCounted = map[string]struct { "agy": {none: "skill_lookup's keys are not known from a real session"}, "antigravity": {none: "its steps' payloads are encrypted at rest; only the usage in steps.metadata is read"}, "minimax-code": {none: "calls only: no Sessions summaries"}, + "devin": {none: "calls only (Usage): no Sessions summaries"}, "gemini": {none: "calls only: no Sessions summaries"}, } diff --git a/internal/sessions/testdata/devin/cli/sessions.sql b/internal/sessions/testdata/devin/cli/sessions.sql new file mode 100644 index 000000000..fb7270ffe --- /dev/null +++ b/internal/sessions/testdata/devin/cli/sessions.sql @@ -0,0 +1,43 @@ +CREATE TABLE sessions ( + id TEXT PRIMARY KEY, + working_directory TEXT NOT NULL, + backend_type TEXT NOT NULL, + model TEXT NOT NULL, + agent_mode TEXT NOT NULL, + created_at INTEGER NOT NULL, + last_activity_at INTEGER NOT NULL, title TEXT, main_chain_id INTEGER, shell_last_seen_index INTEGER DEFAULT 0, cogs_json TEXT, workspace_dirs TEXT, hidden INTEGER NOT NULL DEFAULT 0, metadata TEXT); +CREATE TABLE message_nodes ( + row_id INTEGER PRIMARY KEY AUTOINCREMENT, + session_id TEXT NOT NULL, + node_id INTEGER NOT NULL, -- node_id within this session's forest + parent_node_id INTEGER, -- NULL for root nodes + chat_message TEXT NOT NULL, + created_at INTEGER NOT NULL, metadata TEXT, + FOREIGN KEY (session_id) REFERENCES sessions(id), + UNIQUE(session_id, node_id) +); +INSERT INTO sessions (id, working_directory, backend_type, model, agent_mode, created_at, last_activity_at, title, main_chain_id) VALUES ('plucky-switch','/work/proj','windsurf','swe-2-high','normal',1794542957,1794542959,'Reply with just the word hi',26); +INSERT INTO sessions (id, working_directory, backend_type, model, agent_mode, created_at, last_activity_at, title, main_chain_id) VALUES ('poised-trust','/work/proj','windsurf','swe-2-high','normal',1794542979,1794542982,'Read note.txt and tell me its second word',29); +INSERT INTO sessions (id, working_directory, backend_type, model, agent_mode, created_at, last_activity_at, title, main_chain_id) VALUES ('chrome-radish','/work/proj','windsurf','claude-haiku-5-5-low','normal',1794543003,1794543006,'Read note.txt and tell me its first word',26); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (2,'plucky-switch',1,0,'{"message_id":"f768cc86-1668-42f5-9fa7-2229accd41ec","role":"user","content":"Reply with just the word hi","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:17.899462Z","from_event_id":"b97d2547-6a79-4ceb-88bb-629d88b6d066","telemetry":{"source":"user","operation":"unknown"}}}',1794542957,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (9,'plucky-switch',8,7,'{"message_id":"f768cc86-1668-42f5-9fa7-2229accd41ec","role":"user","content":"Reply with just the word hi","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:17.899462Z","from_event_id":"b97d2547-6a79-4ceb-88bb-629d88b6d066","telemetry":{"source":"user","operation":"unknown"}}}',1794542957,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (16,'plucky-switch',15,14,'{"message_id":"f768cc86-1668-42f5-9fa7-2229accd41ec","role":"user","content":"Reply with just the word hi","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:17.899462Z","from_event_id":"b97d2547-6a79-4ceb-88bb-629d88b6d066","telemetry":{"source":"user","operation":"unknown"}}}',1794542957,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (24,'plucky-switch',23,22,'{"message_id":"f768cc86-1668-42f5-9fa7-2229accd41ec","role":"user","content":"Reply with just the word hi","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:17.899462Z","from_event_id":"b97d2547-6a79-4ceb-88bb-629d88b6d066","telemetry":{"source":"user","operation":"unknown"}}}',1794542957,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (26,'plucky-switch',25,24,'{"message_id":"e7b64a43-3960-4bd6-aac5-7c93a36036cb","role":"assistant","content":"hi","tool_calls":[],"thinking":{"thinking":"The user wants only the word \"hi\" as the response. I don''t need to use any tools for this; the final output should be just \"hi\" with no extra characters or formatting.","signature":"sealed.v1.qxYXeJznleICPxog2wupqnEfATYG0uNjzUDcMPCr1h-PknvcCApss8FO_AboR_RYIGQ8tKkQLQJsw8r440sgJqW1khlijhAEyFQONi1OwdLnCkSD9DvMeEWKES_yK5LAyFjTYGLU1k0BY5EwgO50SBnKgW1laMRzckPo__xGdiXmOb351QkvdiSmPdSLwq9oRQ","signature_type":"sealed"},"metadata":{"num_tokens":44,"is_user_input":null,"request_id":"d07541eb-60f2-46b4-97b4-eb53c04f19a8","metrics":{"ttft_ms":1800,"total_time_ms":1812,"input_tokens":2143,"output_tokens":44,"cache_read_tokens":10112,"cache_creation_tokens":null,"context_input_tokens":12255,"tpot_ms":0.2727272727272727,"tokens_per_sec":3666.6666666666665},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"SWE-2 High"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":2143.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":44.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":10112.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:09:18.743140Z","created_at":"2026-11-13T04:09:19.715449Z","generation_model":"swe-2-high","telemetry":{"source":"assistant","operation":"inference"}}}',1794542959,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (27,'plucky-switch',26,24,'{"message_id":"e7b64a43-3960-4bd6-aac5-7c93a36036cb","role":"assistant","content":"hi","tool_calls":[],"thinking":{"thinking":"The user wants only the word \"hi\" as the response. I don''t need to use any tools for this; the final output should be just \"hi\" with no extra characters or formatting.","signature":"sealed.v1.qxYXeJznleICPxog2wupqnEfATYG0uNjzUDcMPCr1h-PknvcCApss8FO_AboR_RYIGQ8tKkQLQJsw8r440sgJqW1khlijhAEyFQONi1OwdLnCkSD9DvMeEWKES_yK5LAyFjTYGLU1k0BY5EwgO50SBnKgW1laMRzckPo__xGdiXmOb351QkvdiSmPdSLwq9oRQ","signature_type":"sealed"},"metadata":{"num_tokens":44,"is_user_input":null,"request_id":"d07541eb-60f2-46b4-97b4-eb53c04f19a8","metrics":{"ttft_ms":1800,"total_time_ms":1812,"input_tokens":2143,"output_tokens":44,"cache_read_tokens":10112,"cache_creation_tokens":null,"context_input_tokens":12255,"tpot_ms":0.2727272727272727,"tokens_per_sec":3666.6666666666665},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"SWE-2 High"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":2143.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":44.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":10112.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:09:18.743140Z","created_at":"2026-11-13T04:09:19.715449Z","generation_model":"swe-2-high","telemetry":{"source":"assistant","operation":"inference"}}}',1794542959,'{"summarized_from":null,"num_tokens_preceding":12255,"is_system_prefix":null}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (29,'poised-trust',1,0,'{"message_id":"d0fe55ba-0264-4576-af39-d57cf215f063","role":"user","content":"Read note.txt and tell me its second word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:39.862478Z","from_event_id":"8a0d3c76-857e-4f29-84c8-70c98a8611c2","telemetry":{"source":"user","operation":"unknown"}}}',1794542979,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (36,'poised-trust',8,7,'{"message_id":"d0fe55ba-0264-4576-af39-d57cf215f063","role":"user","content":"Read note.txt and tell me its second word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:39.862478Z","from_event_id":"8a0d3c76-857e-4f29-84c8-70c98a8611c2","telemetry":{"source":"user","operation":"unknown"}}}',1794542979,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (43,'poised-trust',15,14,'{"message_id":"d0fe55ba-0264-4576-af39-d57cf215f063","role":"user","content":"Read note.txt and tell me its second word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:39.862478Z","from_event_id":"8a0d3c76-857e-4f29-84c8-70c98a8611c2","telemetry":{"source":"user","operation":"unknown"}}}',1794542979,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (51,'poised-trust',23,22,'{"message_id":"d0fe55ba-0264-4576-af39-d57cf215f063","role":"user","content":"Read note.txt and tell me its second word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:09:39.862478Z","from_event_id":"8a0d3c76-857e-4f29-84c8-70c98a8611c2","telemetry":{"source":"user","operation":"unknown"}}}',1794542979,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (53,'poised-trust',25,24,'{"message_id":"0ca71b5d-f379-4dd2-84e1-6e04ea0b029f","role":"assistant","content":"","tool_calls":[{"id":"exec:0#9d7059ac4a274f03ae83d01a2b0dcbf3","name":"exec","arguments":{"command":"cat note.txt"},"index":0,"kind":"function"}],"thinking":{"thinking":"I need to read the file `note.txt` and extract the second word. This seems straightforward.","signature":"sealed.v1.FvqvfHf8N0AtViQ4AsM8_KxOh1nW4TROTHdKHe06MARzlkh6Sg8mTjUlQ4XaJiwVzoB37ZLYTlP0lbsxmA5xrhPyl2xHsw82nVAHz7o2hcFCuJp5FYO8oGHZuCPVjcei1IkW-jZHhxHIww","signature_type":"sealed"},"metadata":{"num_tokens":68,"is_user_input":null,"request_id":"29bc2ea6-ee76-4e5d-95c1-ce2be7d94327","metrics":{"ttft_ms":1491,"total_time_ms":1493,"input_tokens":10914,"output_tokens":68,"cache_read_tokens":1344,"cache_creation_tokens":null,"context_input_tokens":12258,"tpot_ms":0.029411764705882353,"tokens_per_sec":34000.0},"finish_reason":"tool_calls","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"SWE-2 High"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":10914.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":68.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":1344.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:09:40.861627Z","created_at":"2026-11-13T04:09:41.356999Z","generation_model":"swe-2-high","telemetry":{"source":"assistant","operation":"inference"}}}',1794542981,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (54,'poised-trust',26,24,'{"message_id":"0ca71b5d-f379-4dd2-84e1-6e04ea0b029f","role":"assistant","content":"","tool_calls":[{"id":"exec:0#9d7059ac4a274f03ae83d01a2b0dcbf3","name":"exec","arguments":{"command":"cat note.txt"},"index":0,"kind":"function"}],"thinking":{"thinking":"I need to read the file `note.txt` and extract the second word. This seems straightforward.","signature":"sealed.v1.FvqvfHf8N0AtViQ4AsM8_KxOh1nW4TROTHdKHe06MARzlkh6Sg8mTjUlQ4XaJiwVzoB37ZLYTlP0lbsxmA5xrhPyl2xHsw82nVAHz7o2hcFCuJp5FYO8oGHZuCPVjcei1IkW-jZHhxHIww","signature_type":"sealed"},"metadata":{"num_tokens":68,"is_user_input":null,"request_id":"29bc2ea6-ee76-4e5d-95c1-ce2be7d94327","metrics":{"ttft_ms":1491,"total_time_ms":1493,"input_tokens":10914,"output_tokens":68,"cache_read_tokens":1344,"cache_creation_tokens":null,"context_input_tokens":12258,"tpot_ms":0.029411764705882353,"tokens_per_sec":34000.0},"finish_reason":"tool_calls","extensions":{"chisel/tool_call_content":{"exec:0#9d7059ac4a274f03ae83d01a2b0dcbf3":{"toolCallId":"exec:0#9d7059ac4a274f03ae83d01a2b0dcbf3","title":"Read ./note.txt","status":"pending","content":[{"type":"content","content":{"type":"resource","resource":{"mimeType":"text/x-shellscript","text":"cat note.txt","uri":"tool://preview"},"_meta":{"cognition.ai/preview_is_shell_command":true}}}],"kind":"execute","rawInput":{"command":"cat note.txt"},"_meta":{"cognition.ai/commandNames":["cat"]}}}},"response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"SWE-2 High"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":10914.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":68.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":1344.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:09:40.861627Z","created_at":"2026-11-13T04:09:41.356999Z","generation_model":"swe-2-high","telemetry":{"source":"assistant","operation":"inference"}}}',1794542981,'{"summarized_from":null,"num_tokens_preceding":12258,"is_system_prefix":null}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (56,'poised-trust',28,27,'{"message_id":"c08197ef-a72a-46d6-810f-989c5cb09b28","role":"assistant","content":"The second word is **beta** (the file contains `alpha beta`).","tool_calls":[],"thinking":{"thinking":"The file contains \"alpha beta.\" I see the second word is \"beta.\"","signature":"sealed.v1.n8rlUuTDJDHc9ld-tVlcFLMtlOs9XLLhn7Zp3WdSJg5Ld7zTY2Uyj13wrC8PX8yn2cRvwjwRem9FFqhTzUyPnMsmZy4Qmcsagzdl_mr8ASMusXZDZxk","signature_type":"sealed"},"metadata":{"num_tokens":42,"is_user_input":null,"request_id":"cda0f093-57c7-4c4a-b73e-8f55035b52b7","metrics":{"ttft_ms":1504,"total_time_ms":1556,"input_tokens":2261,"output_tokens":42,"cache_read_tokens":10112,"cache_creation_tokens":null,"context_input_tokens":12373,"tpot_ms":1.2380952380952381,"tokens_per_sec":807.6923076923077},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"SWE-2 High"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":2261.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":42.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":10112.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:09:42.477929Z","created_at":"2026-11-13T04:09:42.942772Z","generation_model":"swe-2-high","telemetry":{"source":"assistant","operation":"inference"}}}',1794542982,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (57,'poised-trust',29,27,'{"message_id":"c08197ef-a72a-46d6-810f-989c5cb09b28","role":"assistant","content":"The second word is **beta** (the file contains `alpha beta`).","tool_calls":[],"thinking":{"thinking":"The file contains \"alpha beta.\" I see the second word is \"beta.\"","signature":"sealed.v1.n8rlUuTDJDHc9ld-tVlcFLMtlOs9XLLhn7Zp3WdSJg5Ld7zTY2Uyj13wrC8PX8yn2cRvwjwRem9FFqhTzUyPnMsmZy4Qmcsagzdl_mr8ASMusXZDZxk","signature_type":"sealed"},"metadata":{"num_tokens":42,"is_user_input":null,"request_id":"cda0f093-57c7-4c4a-b73e-8f55035b52b7","metrics":{"ttft_ms":1504,"total_time_ms":1556,"input_tokens":2261,"output_tokens":42,"cache_read_tokens":10112,"cache_creation_tokens":null,"context_input_tokens":12373,"tpot_ms":1.2380952380952381,"tokens_per_sec":807.6923076923077},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"SWE-2 High"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":2261.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":42.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":10112.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:09:42.477929Z","created_at":"2026-11-13T04:09:42.942772Z","generation_model":"swe-2-high","telemetry":{"source":"assistant","operation":"inference"}}}',1794542982,'{"summarized_from":null,"num_tokens_preceding":12373,"is_system_prefix":null}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (59,'chrome-radish',1,0,'{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}',1794543003,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (65,'chrome-radish',7,6,'{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}',1794543003,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (71,'chrome-radish',13,12,'{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}',1794543003,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (78,'chrome-radish',20,19,'{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}',1794543003,'{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (80,'chrome-radish',22,21,'{"message_id":"4f3edf09-a09a-4551-9552-b1c96e07fd90","role":"assistant","content":"","tool_calls":[{"id":"toolu_01DixosYcMUiMMxFWEu8hYi7","name":"read","arguments":{"file_path":"/work/proj/note.txt"},"index":0,"kind":"function"}],"metadata":{"num_tokens":85,"is_user_input":null,"request_id":"7f0d1818-1993-4c66-9fec-d5c5f292062a","metrics":{"ttft_ms":null,"total_time_ms":1548,"input_tokens":467,"output_tokens":85,"cache_read_tokens":12633,"cache_creation_tokens":6163,"context_input_tokens":19263,"tpot_ms":18.211764705882352,"tokens_per_sec":54.90956072351421},"finish_reason":"tool_calls","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":6630.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":85.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":12633.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:05.099483Z","created_at":"2026-11-13T04:10:05.299749Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}',1794543005,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (81,'chrome-radish',23,21,'{"message_id":"4f3edf09-a09a-4551-9552-b1c96e07fd90","role":"assistant","content":"","tool_calls":[{"id":"toolu_01DixosYcMUiMMxFWEu8hYi7","name":"read","arguments":{"file_path":"/work/proj/note.txt"},"index":0,"kind":"function"}],"metadata":{"num_tokens":85,"is_user_input":null,"request_id":"7f0d1818-1993-4c66-9fec-d5c5f292062a","metrics":{"ttft_ms":null,"total_time_ms":1548,"input_tokens":467,"output_tokens":85,"cache_read_tokens":12633,"cache_creation_tokens":6163,"context_input_tokens":19263,"tpot_ms":18.211764705882352,"tokens_per_sec":54.90956072351421},"finish_reason":"tool_calls","extensions":{"chisel/tool_call_content":{"toolu_01DixosYcMUiMMxFWEu8hYi7":{"toolCallId":"toolu_01DixosYcMUiMMxFWEu8hYi7","title":"Read file","status":"pending","locations":[{"path":"/work/proj/note.txt"}],"kind":"read","rawInput":{"file_path":"/work/proj/note.txt"}}}},"response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":6630.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":85.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":12633.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:05.099483Z","created_at":"2026-11-13T04:10:05.299749Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}',1794543005,'{"summarized_from":null,"num_tokens_preceding":19263,"is_system_prefix":null}'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (83,'chrome-radish',25,24,'{"message_id":"4623b508-3b38-4033-9d1a-23113fb2bf62","role":"assistant","content":"The first word in `note.txt` is **alpha**.","tool_calls":[],"metadata":{"num_tokens":19,"is_user_input":null,"request_id":"03288c50-2fbc-412f-8930-e8e6f0ebcc0e","metrics":{"ttft_ms":1171,"total_time_ms":1210,"input_tokens":2,"output_tokens":19,"cache_read_tokens":18796,"cache_creation_tokens":635,"context_input_tokens":19433,"tpot_ms":2.0526315789473686,"tokens_per_sec":487.1794871794872},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":637.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":19.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:06.483156Z","created_at":"2026-11-13T04:10:06.522177Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}',1794543006,'null'); +INSERT INTO message_nodes (row_id, session_id, node_id, parent_node_id, chat_message, created_at, metadata) VALUES (84,'chrome-radish',26,24,'{"message_id":"4623b508-3b38-4033-9d1a-23113fb2bf62","role":"assistant","content":"The first word in `note.txt` is **alpha**.","tool_calls":[],"metadata":{"num_tokens":19,"is_user_input":null,"request_id":"03288c50-2fbc-412f-8930-e8e6f0ebcc0e","metrics":{"ttft_ms":1171,"total_time_ms":1210,"input_tokens":2,"output_tokens":19,"cache_read_tokens":18796,"cache_creation_tokens":635,"context_input_tokens":19433,"tpot_ms":2.0526315789473686,"tokens_per_sec":487.1794871794872},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":637.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":19.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:06.483156Z","created_at":"2026-11-13T04:10:06.522177Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}',1794543006,'{"summarized_from":null,"num_tokens_preceding":19433,"is_system_prefix":null}'); diff --git a/internal/sessions/testdata/devin/cli/sessions/chrome-radish/log.jsonl b/internal/sessions/testdata/devin/cli/sessions/chrome-radish/log.jsonl new file mode 100644 index 000000000..512102410 --- /dev/null +++ b/internal/sessions/testdata/devin/cli/sessions/chrome-radish/log.jsonl @@ -0,0 +1,8 @@ +{"kind":"node","at":1794543003,"node":{"id":1,"parent_id":0,"metadata":null,"message":{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543003,"node":{"id":7,"parent_id":6,"metadata":{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}},"message":{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543003,"node":{"id":13,"parent_id":12,"metadata":{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}},"message":{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543003,"node":{"id":20,"parent_id":19,"metadata":{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}},"message":{"message_id":"1a52597f-2203-4e0b-9ddc-ffa0577d729c","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:10:03.750917Z","from_event_id":"c43465ce-b075-4e26-9158-53a5c7aee02f","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543003,"node":{"id":22,"parent_id":21,"metadata":null,"message":{"message_id":"4f3edf09-a09a-4551-9552-b1c96e07fd90","role":"assistant","content":"","tool_calls":[{"id":"toolu_01DixosYcMUiMMxFWEu8hYi7","name":"read","arguments":{"file_path":"/work/proj/note.txt"},"index":0,"kind":"function"}],"metadata":{"num_tokens":85,"is_user_input":null,"request_id":"7f0d1818-1993-4c66-9fec-d5c5f292062a","metrics":{"ttft_ms":null,"total_time_ms":1548,"input_tokens":467,"output_tokens":85,"cache_read_tokens":12633,"cache_creation_tokens":6163,"context_input_tokens":19263,"tpot_ms":18.211764705882352,"tokens_per_sec":54.90956072351421},"finish_reason":"tool_calls","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":6630.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":85.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":12633.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:05.099483Z","created_at":"2026-11-13T04:10:05.299749Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} +{"kind":"node","at":1794543003,"node":{"id":23,"parent_id":21,"metadata":{"summarized_from":null,"num_tokens_preceding":19263,"is_system_prefix":null},"message":{"message_id":"4f3edf09-a09a-4551-9552-b1c96e07fd90","role":"assistant","content":"","tool_calls":[{"id":"toolu_01DixosYcMUiMMxFWEu8hYi7","name":"read","arguments":{"file_path":"/work/proj/note.txt"},"index":0,"kind":"function"}],"metadata":{"num_tokens":85,"is_user_input":null,"request_id":"7f0d1818-1993-4c66-9fec-d5c5f292062a","metrics":{"ttft_ms":null,"total_time_ms":1548,"input_tokens":467,"output_tokens":85,"cache_read_tokens":12633,"cache_creation_tokens":6163,"context_input_tokens":19263,"tpot_ms":18.211764705882352,"tokens_per_sec":54.90956072351421},"finish_reason":"tool_calls","extensions":{"chisel/tool_call_content":{"toolu_01DixosYcMUiMMxFWEu8hYi7":{"toolCallId":"toolu_01DixosYcMUiMMxFWEu8hYi7","title":"Read file","status":"pending","locations":[{"path":"/work/proj/note.txt"}],"kind":"read","rawInput":{"file_path":"/work/proj/note.txt"}}}},"response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":6630.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":85.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":12633.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:05.099483Z","created_at":"2026-11-13T04:10:05.299749Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} +{"kind":"node","at":1794543003,"node":{"id":25,"parent_id":24,"metadata":null,"message":{"message_id":"4623b508-3b38-4033-9d1a-23113fb2bf62","role":"assistant","content":"The first word in `note.txt` is **alpha**.","tool_calls":[],"metadata":{"num_tokens":19,"is_user_input":null,"request_id":"03288c50-2fbc-412f-8930-e8e6f0ebcc0e","metrics":{"ttft_ms":1171,"total_time_ms":1210,"input_tokens":2,"output_tokens":19,"cache_read_tokens":18796,"cache_creation_tokens":635,"context_input_tokens":19433,"tpot_ms":2.0526315789473686,"tokens_per_sec":487.1794871794872},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":637.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":19.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:06.483156Z","created_at":"2026-11-13T04:10:06.522177Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} +{"kind":"node","at":1794543003,"node":{"id":26,"parent_id":24,"metadata":{"summarized_from":null,"num_tokens_preceding":19433,"is_system_prefix":null},"message":{"message_id":"4623b508-3b38-4033-9d1a-23113fb2bf62","role":"assistant","content":"The first word in `note.txt` is **alpha**.","tool_calls":[],"metadata":{"num_tokens":19,"is_user_input":null,"request_id":"03288c50-2fbc-412f-8930-e8e6f0ebcc0e","metrics":{"ttft_ms":1171,"total_time_ms":1210,"input_tokens":2,"output_tokens":19,"cache_read_tokens":18796,"cache_creation_tokens":635,"context_input_tokens":19433,"tpot_ms":2.0526315789473686,"tokens_per_sec":487.1794871794872},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":637.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":19.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:10:06.483156Z","created_at":"2026-11-13T04:10:06.522177Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} diff --git a/internal/sessions/testdata/devin/cli/sessions/chrome-radish/meta.json b/internal/sessions/testdata/devin/cli/sessions/chrome-radish/meta.json new file mode 100644 index 000000000..c491be293 --- /dev/null +++ b/internal/sessions/testdata/devin/cli/sessions/chrome-radish/meta.json @@ -0,0 +1,13 @@ +{ + "v": 1, + "id": "chrome-radish", + "working_directory": "/work/proj", + "backend_type": "windsurf", + "model": "claude-haiku-5-5-low", + "agent_mode": "normal", + "created_at": 1794543003, + "last_activity_at": 1794543006, + "title": "Read note.txt and tell me its first word", + "hidden": false, + "main_chain_id": 26 +} \ No newline at end of file diff --git a/internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/log.jsonl b/internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/log.jsonl new file mode 100644 index 000000000..4c81a289e --- /dev/null +++ b/internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/log.jsonl @@ -0,0 +1,8 @@ +{"kind":"node","at":1794543179,"node":{"id":1,"parent_id":0,"metadata":null,"message":{"message_id":"10a4d654-cc85-4b73-96e4-06e3b0fca4fd","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:12:59.355588Z","from_event_id":"70352508-44e1-476c-a4d1-bdd5fbad5622","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543179,"node":{"id":7,"parent_id":6,"metadata":{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}},"message":{"message_id":"10a4d654-cc85-4b73-96e4-06e3b0fca4fd","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:12:59.355588Z","from_event_id":"70352508-44e1-476c-a4d1-bdd5fbad5622","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543179,"node":{"id":13,"parent_id":12,"metadata":{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}},"message":{"message_id":"10a4d654-cc85-4b73-96e4-06e3b0fca4fd","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:12:59.355588Z","from_event_id":"70352508-44e1-476c-a4d1-bdd5fbad5622","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543179,"node":{"id":20,"parent_id":19,"metadata":{"summarized_from":null,"num_tokens_preceding":null,"is_system_prefix":null,"extensions":{"compact/prior_node_ids":[1]}},"message":{"message_id":"10a4d654-cc85-4b73-96e4-06e3b0fca4fd","role":"user","content":"Read note.txt and tell me its first word","metadata":{"num_tokens":null,"is_user_input":true,"request_id":null,"metrics":null,"finish_reason":null,"created_at":"2026-11-13T04:12:59.355588Z","from_event_id":"70352508-44e1-476c-a4d1-bdd5fbad5622","telemetry":{"source":"user","operation":"unknown"}}}}} +{"kind":"node","at":1794543180,"node":{"id":22,"parent_id":21,"metadata":null,"message":{"message_id":"6d94a741-eabe-4cfb-9f6c-cf57e2ad49fc","role":"assistant","content":"","tool_calls":[{"id":"toolu_01DcTBQMEKcsw97unsM7DNfQ","name":"read","arguments":{"file_path":"/work/proj/note.txt"},"index":0,"kind":"function"}],"metadata":{"num_tokens":85,"is_user_input":null,"request_id":"282cedf0-804b-4df6-8d1c-74ce51d981ff","metrics":{"ttft_ms":null,"total_time_ms":1143,"input_tokens":468,"output_tokens":85,"cache_read_tokens":18796,"cache_creation_tokens":null,"context_input_tokens":19264,"tpot_ms":13.447058823529412,"tokens_per_sec":74.36570428696412},"finish_reason":"tool_calls","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":468.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":85.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:13:00.272271Z","created_at":"2026-11-13T04:13:00.502628Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} +{"kind":"node","at":1794543180,"node":{"id":23,"parent_id":21,"metadata":{"summarized_from":null,"num_tokens_preceding":19264,"is_system_prefix":null},"message":{"message_id":"6d94a741-eabe-4cfb-9f6c-cf57e2ad49fc","role":"assistant","content":"","tool_calls":[{"id":"toolu_01DcTBQMEKcsw97unsM7DNfQ","name":"read","arguments":{"file_path":"/work/proj/note.txt"},"index":0,"kind":"function"}],"metadata":{"num_tokens":85,"is_user_input":null,"request_id":"282cedf0-804b-4df6-8d1c-74ce51d981ff","metrics":{"ttft_ms":null,"total_time_ms":1143,"input_tokens":468,"output_tokens":85,"cache_read_tokens":18796,"cache_creation_tokens":null,"context_input_tokens":19264,"tpot_ms":13.447058823529412,"tokens_per_sec":74.36570428696412},"finish_reason":"tool_calls","extensions":{"chisel/tool_call_content":{"toolu_01DcTBQMEKcsw97unsM7DNfQ":{"toolCallId":"toolu_01DcTBQMEKcsw97unsM7DNfQ","title":"Read file","status":"pending","locations":[{"path":"/work/proj/note.txt"}],"kind":"read","rawInput":{"file_path":"/work/proj/note.txt"}}}},"response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":468.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":85.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:13:00.272271Z","created_at":"2026-11-13T04:13:00.502628Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} +{"kind":"node","at":1794543181,"node":{"id":25,"parent_id":24,"metadata":null,"message":{"message_id":"635a8287-a66d-47a8-96c9-df83d1aa9f15","role":"assistant","content":"The first word in `note.txt` is **alpha**.","tool_calls":[],"metadata":{"num_tokens":19,"is_user_input":null,"request_id":"3becd065-65e5-4345-bfa7-d5ccd738876b","metrics":{"ttft_ms":913,"total_time_ms":968,"input_tokens":2,"output_tokens":19,"cache_read_tokens":18796,"cache_creation_tokens":636,"context_input_tokens":19434,"tpot_ms":2.8947368421052633,"tokens_per_sec":345.45454545454544},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":638.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":19.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:13:01.429897Z","created_at":"2026-11-13T04:13:01.485822Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} +{"kind":"node","at":1794543181,"node":{"id":26,"parent_id":24,"metadata":{"summarized_from":null,"num_tokens_preceding":19434,"is_system_prefix":null},"message":{"message_id":"635a8287-a66d-47a8-96c9-df83d1aa9f15","role":"assistant","content":"The first word in `note.txt` is **alpha**.","tool_calls":[],"metadata":{"num_tokens":19,"is_user_input":null,"request_id":"3becd065-65e5-4345-bfa7-d5ccd738876b","metrics":{"ttft_ms":913,"total_time_ms":968,"input_tokens":2,"output_tokens":19,"cache_read_tokens":18796,"cache_creation_tokens":636,"context_input_tokens":19434,"tpot_ms":2.8947368421052633,"tokens_per_sec":345.45454545454544},"finish_reason":"stop","response_dimensions":[{"uid":"agent_messages","group_title":"Response Statistics","kind":{"CumulativeMetric":{"label":"Agent messages","value":1.0,"tail":" message","plural_tail":" messages","prefix":""}}},{"uid":"model","group_title":"Response Statistics","kind":{"Metric":{"label":"Model","value":"Claude Haiku 5.5 Low"}}},{"uid":"input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Input tokens","value":638.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"output_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Output tokens","value":19.0,"tail":" token","plural_tail":" tokens","prefix":""}}},{"uid":"cached_input_tokens","group_title":"Token Usage","kind":{"CumulativeMetric":{"label":"Cached input tokens","value":18796.0,"tail":" token","plural_tail":" tokens","prefix":""}}}],"started_generation_at":"2026-11-13T04:13:01.429897Z","created_at":"2026-11-13T04:13:01.485822Z","generation_model":"claude-haiku-5-5-low","telemetry":{"source":"assistant","operation":"inference"}}}}} diff --git a/internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/meta.json b/internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/meta.json new file mode 100644 index 000000000..f50003aa6 --- /dev/null +++ b/internal/sessions/testdata/devin/cli/sessions/cyan-skipjack/meta.json @@ -0,0 +1,13 @@ +{ + "v": 1, + "id": "cyan-skipjack", + "working_directory": "/work/proj", + "backend_type": "windsurf", + "model": "claude-haiku-5-5-low", + "agent_mode": "normal", + "created_at": 1794543179, + "last_activity_at": 1794543181, + "title": "Read note.txt and tell me its first word", + "hidden": false, + "main_chain_id": 26 +} \ No newline at end of file