Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

sessions: Desktop's Code tab in its 3p mode is Claude Desktop's, not Claude Code's

yetonea54e336e443c
diff --git a/internal/sessions/calls.go b/internal/sessions/calls.go
index c41a705a3..e4d962902 100644
--- a/internal/sessions/calls.go
+++ b/internal/sessions/calls.go
@@ -762,7 +762,7 @@ func claudeCallLine(st *callFile, b []byte) {
if c.Session == "" {
c.Session = st.Session
}
- if st.Agent == "claude" && l.Entrypoint == "claude-desktop" {
+ if st.Agent == "claude" && desktopEntrypoint(string(l.Entrypoint)) {
c.Agent = "claude-desktop"
}
if l.APIError {
@@ -1223,3 +1223,11 @@ func ReadCallSource(s CallSource) []Call {
callsMu.Unlock()
return st.Calls
}
+
+// desktopEntrypoint is a Claude Code transcript's entrypoint when Claude
+// Desktop ran it for its Code tab: "claude-desktop", or
+// "claude-desktop-3p" in its third-party inference mode (Desktop 2.7032's
+// nK: type "3p"), the mode a gateway such as magpie's is set in.
+func desktopEntrypoint(e string) bool {
+ return e == "claude-desktop" || e == "claude-desktop-3p"
+}
diff --git a/internal/sessions/calls_test.go b/internal/sessions/calls_test.go
index b95d4c151..4a47cdd28 100644
--- a/internal/sessions/calls_test.go
+++ b/internal/sessions/calls_test.go
@@ -789,3 +789,17 @@ func TestCallsCoworkMSIX(t *testing.T) {
t.Fatalf("calls: %+v", cs)
}
}
+
+// Desktop's Code tab in its third-party inference mode, the one a gateway
+// is set in, writes "claude-desktop-3p" (cybercaius: its calls were
+// counted as Claude Code's).
+func TestCallsDesktop3pCodeTab(t *testing.T) {
+ d := setupCalls(t)
+ writeLines(t, filepath.Join(d.claude, "projects", "-p", "s3p.jsonl"),
+ swap(swap(claudeMsg("m1", "claude-haiku-5-5", 1, 2, 3, 4, 1), `"entrypoint":"cli"`, `"entrypoint":"claude-desktop-3p"`), `"sessionId":"sess1"`, `"sessionId":"s3p"`))
+ writeLines(t, filepath.Join(d.claude, "projects", "-p", "sess1.jsonl"), claudeMsg("m2", "claude-opus-5-5", 1, 2, 3, 4, 2))
+ cs := Calls(time.Time{})
+ if len(cs) != 2 || cs[0].Agent != "claude" || cs[1].Agent != "claude-desktop" || cs[1].Session != "s3p" {
+ t.Fatalf("calls: %+v", cs)
+ }
+}
diff --git a/internal/sessions/traces_claude.go b/internal/sessions/traces_claude.go
index 9b18f21dd..e8d61b957 100644
--- a/internal/sessions/traces_claude.go
+++ b/internal/sessions/traces_claude.go
@@ -68,7 +68,7 @@ func (c *traceCursor) claude(line []byte, bodies bool) []TraceSpan {
if o.SessionID != "" {
c.session = o.SessionID
}
- if o.Entrypoint == "claude-desktop" {
+ if desktopEntrypoint(o.Entrypoint) {
c.agent = "claude-desktop"
}
type block struct {
diff --git a/internal/sessions/traces_clients_test.go b/internal/sessions/traces_clients_test.go
index 23b87e77b..ff2d3112f 100644
--- a/internal/sessions/traces_clients_test.go
+++ b/internal/sessions/traces_clients_test.go
@@ -384,8 +384,10 @@ func TestGeminiParallelToolResultsStayWithTheirCalls(t *testing.T) {
}
func TestClaudeTraceSubagentsShareSessionWithoutIDCollisions(t *testing.T) {
- for _, agent := range []string{"claude", "claude-desktop"} {
- t.Run(agent, func(t *testing.T) {
+ // Desktop's Code tab writes "claude-desktop", or "claude-desktop-3p"
+ // in its third-party inference mode (cybercaius, a gateway setup)
+ for entry, agent := range map[string]string{"claude": "claude", "claude-desktop": "claude-desktop", "claude-desktop-3p": "claude-desktop"} {
+ t.Run(entry, func(t *testing.T) {
testenv.SetHome(t, t.TempDir())
t.Setenv("CODEX_HOME", t.TempDir())
t.Setenv("PI_CODING_AGENT_DIR", t.TempDir())
@@ -405,8 +407,8 @@ func TestClaudeTraceSubagentsShareSessionWithoutIDCollisions(t *testing.T) {
// No sessionId is required: child paths provide the parent session ID.
var lines []string
for _, event := range []map[string]any{
- {"type": "user", "uuid": "old", "entrypoint": agent, "timestamp": since.Add(-time.Minute), "message": map[string]any{"content": "PRIVATE-OLD"}},
- {"type": "user", "uuid": "same-user", "entrypoint": agent, "timestamp": since, "message": map[string]any{"content": "PRIVATE-NEW"}},
+ {"type": "user", "uuid": "old", "entrypoint": entry, "timestamp": since.Add(-time.Minute), "message": map[string]any{"content": "PRIVATE-OLD"}},
+ {"type": "user", "uuid": "same-user", "entrypoint": entry, "timestamp": since, "message": map[string]any{"content": "PRIVATE-NEW"}},
{"type": "assistant", "timestamp": since.Add(time.Second), "message": map[string]any{"id": "same-message", "model": "claude-sonnet", "stop_reason": "end_turn", "content": []map[string]string{{"type": "text", "text": "PRIVATE-ANSWER"}}, "usage": map[string]int{"input_tokens": 10, "output_tokens": 5}}},
{"type": "system", "subtype": "turn_duration", "timestamp": since.Add(2 * time.Second)},
} {