Commit Graph
2 Commits
Author SHA1 Message Date
yetone f15542d2ea sessions: OpenCode 2 subagents show their type, and a Kimi Code subagent opens on its task, not a context chip (#2290, infinitr0us)
OpenCode 2.0.29 keeps a child session's agent in session_v2.agent and
titles it with the task alone, so ocSubagentTitle found no kind and every
OpenCode subagent row showed only its title and time. The kind now comes
from session_v2.agent when set (ocV2DB.agent, kept once found; a missing
column or NULL reads as none and isn't kept), and the "(@agent subagent)"
title split stays the fallback for older versions.

A Kimi Code subagent's own wire.jsonl starts with the task its parent
gave it, a turn.prompt whose origin is {kind: system_trigger, name:
subagent}; the transcript folded every system_trigger as context. In a
subagent's own wire (not agents/main) that prompt now opens as its first
user message (kimiTask). Other system triggers, and a "subagent" one in
the session's main wire, stay folded.

Fixtures follow the reporter's described shapes: ocMakeV2's real
session_v2 schema with agent 'explore' and a task-only title beside a
child with no agent and an older suffixed title; a 1.5-shaped subagent
wire (agentId, promptId, turnId) with the subagent trigger, a reply and a
background_task trigger, plus a subagent trigger appended to main.
No real OpenCode child sessions or Kimi Code subagents on this machine.
No GUI change: the Sessions client already draws a subagent's kind.

Run: TestOpenCodeV2SubagentKind and TestKimiSubagentTask fail on the old
subagents.go/transcript_kimi.go (no kind; user/context first), and
TestKimiSubagentTask fails with the agents/main scope check dropped.
go test -p 1 -tags nogui ./internal/sessions/ ok at the rebased head;
gofmt -l clean; go vet -tags nogui ./internal/sessions/ for darwin,
GOOS=linux and GOOS=windows.
Full suite: SUITE_LINE
2026-10-15 23:08:01 +08:00
yetone 2d8f2a86a5 sessions: Kimi Code sessions open as a transcript (#2056)
infinitr0us: a Kimi Code session on the Sessions page had no transcript
to open. HasTranscript now lists kimi, and kimiTranscript reads the
session's main wire.jsonl:
- protocol 1.4/1.5: turn.prompt and turn.steer (a prompt not from the
  user, a skill's activation or a background task's news, is folded as
  context), and the loop events content.part (text, think), tool.call
  and tool.result, a result named for its call. These are there for
  every session, finished or running; agent.message.appended (1.5, only
  at a turn's end) and the timed context.append_message records say the
  same again and are passed over.
- kimi-cli imports (1.0, and the head of a ses_* session Kimi Code
  reopened): the untimed context.append_message records, with an
  assistant's toolCalls in both shapes (name/arguments and OpenAI's
  function.{name,arguments}).
Search and markdown export read the same parts.

Run:
- TestKimiCodeTranscript on the #1607 reporter's wire files in testdata
  (1.4, a cancelled 1.4, an early 1.5 started by a skill, a failed 1.5,
  a kimi-cli import), and TestKimiCodeTranscriptOrder on a synthetic
  file in the same record shapes, exact part order plus SearchSession.
- Broken by hand: kimi out of HasTranscript fails both tests; reading
  the timed context.append_message records fails both (user/text 9,
  not 3).
- A nogui build's `magpie web` under a sandbox HOME, KIMI_CODE_HOME on
  the reporter's whole zip (8 sessions, the July subagent session and
  a reopened ses_* among them): all 8 listed with a transcript;
  /api/sessions/transcript gave 105, 13 and 205 parts for June, the
  reopened ses_* and July; the markdown export worked.
- gofmt -l clean; go vet darwin, linux -tags nogui, windows;
  go test -tags nogui ./internal/sessions/ ./internal/gui/.

Not tried: a live Kimi Code session on this machine (none here; the kimi
installed is kimi-cli 1.52.0), the GUI's look of the transcript, WSL.
A subagent's own wire file isn't shown; the main agent's is.
2026-10-14 08:28:52 +08:00