You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/09/04 14:28:40 UTC
(skywalking-ai-sessionizer) branch main updated: Six findings from the receiving side
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-ai-sessionizer.git
The following commit(s) were added to refs/heads/main by this push:
new 770be3b Six findings from the receiving side
770be3b is described below
commit 770be3b102be2b6dc231fee662b4a41167a2bdb1
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Fri Sep 4 22:28:32 2026 +0800
Six findings from the receiving side
The service a session is pushed under is now the runtime that produced
it, read off its landed header's adapter, Claude Code or Mock Agent,
rather than the adapter the configuration names; an sd build pushed from
its own configuration said Claude Code, and the guide said Mock Agent. A
root that holds both kinds is pushed as both. Every scenario's push check
now also runs once without a configured service and expects the runtime.
A build refused a DIR/asz.yaml a person had appended the export block
to, so the guide's own recipe could not be followed across stages; a file
that starts with what the build writes is the build's.
The conversation list's time span was the talks' span while the document
and the wire carry the session node's; they differed by the gap between
a reset's summary and its boundary. The list reads the session node.
--repeat started at the second id and never emitted the scenario's own;
the first session is the scenario's now.
The three-rounds scenario has a child agent in its third stage, so every
stage lands files of more than one kind.
A round's lines in the document is the file's line count, as it is for
every other file, rather than a count of frames.
---
asz.yaml | 7 +--
cmd/asz/push.go | 20 +++++----
cmd/asz/scenario.go | 13 +++---
docs/en/changes/changes-0.2.0.md | 9 ++--
docs/en/guides/scenario.md | 7 +--
docs/en/setup/configuration.md | 2 +-
docs/en/setup/export-otlp.md | 2 +-
internal/export/otlp/otlp_test.go | 21 +++++++--
internal/export/otlp/push.go | 75 +++++++++++++++++++++++++++-----
internal/scenario/build.go | 7 ++-
internal/scenario/run/push.go | 34 ++++++++++++++-
internal/scenario/run/run.go | 2 +-
internal/view/api.go | 8 ++++
internal/view/conversationview.go | 2 +-
tests/scenarios/three-rounds.expect.yaml | 8 ++--
tests/scenarios/three-rounds.yaml | 4 +-
16 files changed, 171 insertions(+), 50 deletions(-)
diff --git a/asz.yaml b/asz.yaml
index 3e52b95..edcc02a 100644
--- a/asz.yaml
+++ b/asz.yaml
@@ -91,9 +91,10 @@ export:
# listens on its REST port, http://127.0.0.1:12800 by default. Empty
# means asz push refuses to run.
endpoint: ""
- # The service every record is attributed to. Empty means the runtime the
- # adapter reads, "Claude Code" for claude-code-local: one service per
- # kind of agent.
+ # The service every record is attributed to. Empty means the runtime
+ # that produced each session, read off its landed header: "Claude Code"
+ # for claude-code-local, "Mock Agent" for mock. One service per kind of
+ # agent.
service_name: ""
# Sent as service.instance.id, the identity of this sender. Empty means
# a new UUID each time asz push starts. The session a record belongs to
diff --git a/cmd/asz/push.go b/cmd/asz/push.go
index ce39e67..81afcaa 100644
--- a/cmd/asz/push.go
+++ b/cmd/asz/push.go
@@ -23,6 +23,7 @@ import (
"time"
"github.com/apache/skywalking-ai-sessionizer/internal/adapters/claudecode"
+ "github.com/apache/skywalking-ai-sessionizer/internal/adapters/mock"
"github.com/apache/skywalking-ai-sessionizer/internal/config"
"github.com/apache/skywalking-ai-sessionizer/internal/export/otlp"
"github.com/apache/skywalking-ai-sessionizer/internal/storage"
@@ -30,7 +31,7 @@ import (
// cmdPush sends the storage root's landed files and rounds to an
// OpenTelemetry logs receiver, once or on the export interval.
-func cmdPush(cfg *config.Config, ad config.Adapter, once bool) error {
+func cmdPush(cfg *config.Config, _ config.Adapter, once bool) error {
o := cfg.Export.OTLP
if o.Endpoint == "" {
return fmt.Errorf("push: set export.otlp.endpoint, the receiver's base URL, for example http://127.0.0.1:12800")
@@ -39,18 +40,15 @@ func cmdPush(cfg *config.Config, ad config.Adapter, once bool) error {
if err != nil {
return err
}
- // The service is the configured name, or else the runtime the adapter
- // reads: one service per kind of agent, which is how a receiver lists
- // them.
- service := o.ServiceName
- if service == "" && ad.Name == config.AdapterClaudeCodeLocal {
- service = claudecode.RuntimeName
- }
+ // The service is the configured name, or else the runtime that produced
+ // each session, read off its landed headers: one service per kind of
+ // agent, which is how a receiver lists them.
p := &otlp.Pusher{
Zone: storage.NewZone(zoneRoot),
Client: &otlp.Client{Endpoint: o.Endpoint, Headers: o.Headers},
Version: version,
- ServiceName: service,
+ ServiceName: o.ServiceName,
+ Runtimes: map[string]string{claudecode.Name: claudecode.RuntimeName, mock.Name: mock.RuntimeName},
InstanceID: o.InstanceID,
Layer: o.Layer,
BatchBytes: o.BatchBytes,
@@ -58,6 +56,10 @@ func cmdPush(cfg *config.Config, ad config.Adapter, once bool) error {
if err := p.Prepare(); err != nil {
return err
}
+ service := o.ServiceName
+ if service == "" {
+ service = "the runtime of each session (Claude Code, Mock Agent)"
+ }
fmt.Printf("storage root: %s\nendpoint : %s/v1/logs\nservice : %s\ninstance : %s\nlayer : %s\n",
zoneRoot, o.Endpoint, service, p.InstanceID, o.Layer)
pass := func() error {
diff --git a/cmd/asz/scenario.go b/cmd/asz/scenario.go
index f31c96f..9e8cf37 100644
--- a/cmd/asz/scenario.go
+++ b/cmd/asz/scenario.go
@@ -165,10 +165,10 @@ func cmdScenario(args []string) int {
}
}
-// repeatedSession names the k-th session of a repeated build. A session id
-// in the UUID shape discovery requires stays in that shape, its last group
-// counted up by k; any other name gets a suffix; an unnamed session takes
-// the derived id and varies the same way.
+// repeatedSession names the k-th session of a repeated build. The first is
+// the scenario's own. A session id in the UUID shape discovery requires
+// stays in that shape, its last group counted up; any other name gets a
+// suffix; an unnamed session takes the derived id and varies the same way.
func repeatedSession(sc *scenario.Scenario, k int) string {
id := sc.Session
if id == "" {
@@ -178,6 +178,9 @@ func repeatedSession(sc *scenario.Scenario, k int) string {
}
id = p.Session
}
+ if k == 1 {
+ return id
+ }
if !uuidShape.MatchString(id) {
return fmt.Sprintf("%s-%d", id, k)
}
@@ -186,7 +189,7 @@ func repeatedSession(sc *scenario.Scenario, k int) string {
if err != nil {
return fmt.Sprintf("%s-%d", id, k)
}
- return id[:len(id)-12] + fmt.Sprintf("%012x", (n+uint64(k))&0xffffffffffff)
+ return id[:len(id)-12] + fmt.Sprintf("%012x", (n+uint64(k-1))&0xffffffffffff)
}
var uuidShape = regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`)
diff --git a/docs/en/changes/changes-0.2.0.md b/docs/en/changes/changes-0.2.0.md
index fbb5eca..45d24b5 100644
--- a/docs/en/changes/changes-0.2.0.md
+++ b/docs/en/changes/changes-0.2.0.md
@@ -21,9 +21,9 @@
and sequence a round's reference resolves against. Each file is sent once; `push.state` records
which. A request carries up to `batch_bytes`, 8 MiB by default, under the 10 MiB the OAP accepts
over HTTP, and a larger file goes alone.
- The service is `export.otlp.service_name`, or the runtime the adapter reads, `Claude Code`, so a
- receiver lists conversations by the agent that produced them; the layer is `AI_AGENT`, spelled
- as the OAP spells a layer. A round's record also carries `asz.conversation.title` and the
+ The service is `export.otlp.service_name`, or the runtime that produced each session, read off
+ its landed header, `Claude Code` or `Mock Agent`, so a receiver lists conversations by the agent
+ that produced them; the layer is `AI_AGENT`, spelled as the OAP spells a layer. A round's record also carries `asz.conversation.title` and the
fold's counts, and every record is stamped with a time inside the session's range, so a receiver
lists conversations and bounds its reads without decoding a body.
The protobuf encoding is written in the project, so the module still has one dependency. Each
@@ -74,6 +74,9 @@
the session was parsed in. A server holding the same files, such as the SkyWalking OAP, builds the same
document. See the format page.
+- The conversation list's time span is the session node's, when it began and its last activity,
+ the same pair the document and the wire carry; it was the span of the talks, which ended before
+ a reset's boundary.
- The page reads Session Data and Session Flow and nothing else. It took every record's time from
the index; it now takes it from the record, so a root that arrives with only its landed files
and its rounds renders in full, and the index is assembly's alone.
diff --git a/docs/en/guides/scenario.md b/docs/en/guides/scenario.md
index fbebfbd..db17b87 100644
--- a/docs/en/guides/scenario.md
+++ b/docs/en/guides/scenario.md
@@ -40,9 +40,10 @@ adapter and is attributed to `Claude Code`; an `sd` build carries the `mock/1` d
attributed to `Mock Agent`, so a receiver never lists an invented conversation as a real one.
A demo corpus is one scenario repeated: `--repeat 20` builds twenty sessions end to end on the
-clock, each with its own id, and `--at 2026-06-01T09:00:00Z --scale 60` puts them on a day rather
-than in a burst. `build` refuses to change a `DIR/asz.yaml` that says something else, so a
-directory holds one configuration.
+clock, the first with the scenario's own id and the rest counted up from it, and `--at
+2026-06-01T09:00:00Z --scale 60` puts them on a day rather than in a burst. `build` refuses a
+`DIR/asz.yaml` it did not write, so a directory holds one configuration; what a person appends to
+it, such as the export block, is kept across builds.
| Flag | Meaning |
| --- | --- |
diff --git a/docs/en/setup/configuration.md b/docs/en/setup/configuration.md
index 5257bab..7139584 100644
--- a/docs/en/setup/configuration.md
+++ b/docs/en/setup/configuration.md
@@ -95,7 +95,7 @@ export:
| Key | Default | Meaning |
| --- | --- | --- |
| `endpoint` | empty | The OpenTelemetry logs receiver's base URL; `/v1/logs` is appended. The SkyWalking OAP listens on its REST port, `http://127.0.0.1:12800` by default. Empty means `asz push` refuses to run. |
-| `service_name` | empty | The service every record is attributed to. Empty means the runtime the adapter reads, `Claude Code` for `claude-code-local`: one service per kind of agent. |
+| `service_name` | empty | The service every record is attributed to. Empty means the runtime that produced each session, read off its landed header: `Claude Code` for `claude-code-local`, `Mock Agent` for `mock`. One service per kind of agent. |
| `instance_id` | empty | Sent as `service.instance.id`, the identity of this sender. Empty means a new UUID each time `asz push` starts. |
| `layer` | `AI_AGENT` | Sent as `service.layer`, the layer the receiver places the service in. The OAP selects its rules by layer, and a layer name is upper case with underscores. |
| `headers` | none | Headers added to every request, for example `Authorization`. |
diff --git a/docs/en/setup/export-otlp.md b/docs/en/setup/export-otlp.md
index 6567993..b91ede3 100644
--- a/docs/en/setup/export-otlp.md
+++ b/docs/en/setup/export-otlp.md
@@ -39,7 +39,7 @@ The resource, which names the service a record belongs to:
| Attribute | Value |
| --- | --- |
-| `service.name` | `export.otlp.service_name`, or when empty the runtime the adapter reads, `Claude Code` for `claude-code-local`: one service per kind of agent |
+| `service.name` | `export.otlp.service_name`, or when empty the runtime that produced each session, read off its landed header's adapter: `Claude Code` for `claude-code-local`, `Mock Agent` for `mock`. One service per kind of agent, and a root that holds both is pushed as both |
| `service.instance.id` | `export.otlp.instance_id`, the identity of this sender, or when empty a new UUID each time `asz push` starts; the session a record belongs to is on the record as `asz.session` |
| `service.layer` | `export.otlp.layer`, `AI_AGENT` by default, the layer the receiver places the service in. The OAP selects its rules by layer, and a layer name is upper case with underscores |
| `telemetry.sdk.name` | `asz`, so a receiver can tell these records apart from any other source |
diff --git a/internal/export/otlp/otlp_test.go b/internal/export/otlp/otlp_test.go
index 81c5fb2..82eb595 100644
--- a/internal/export/otlp/otlp_test.go
+++ b/internal/export/otlp/otlp_test.go
@@ -426,13 +426,26 @@ func TestPushSendsAFileLargerThanTheBudgetAlone(t *testing.T) {
}
}
-// A pusher without a service name refuses to run: the command supplies the
-// runtime's name when nothing is configured, so an empty one is a wiring bug.
-func TestPushRefusesToRunWithoutAServiceName(t *testing.T) {
+// A pusher with neither a service name nor runtime names refuses to run;
+// with runtime names, a session is attributed to the runtime its landed
+// header names.
+func TestServiceIsTheRuntimeThatProducedTheSession(t *testing.T) {
z, _ := zoneWithOneSession(t)
p := &otlp.Pusher{Zone: z, Client: &otlp.Client{Endpoint: "http://127.0.0.1:1"}, Version: "test"}
if err := p.Prepare(); err == nil {
- t.Fatal("Prepare accepted an empty service name")
+ t.Fatal("Prepare accepted a pusher with no service name and no runtime names")
+ }
+ rcv := &receiver{}
+ srv := httptest.NewServer(rcv.handler())
+ defer srv.Close()
+ p = &otlp.Pusher{Zone: z, Client: &otlp.Client{Endpoint: srv.URL}, Version: "test",
+ Runtimes: map[string]string{"test": "Test Runtime"}}
+ if _, err := p.Pass(); err != nil {
+ t.Fatal(err)
+ }
+ res, _ := parseRequest(t, rcv.reqs[0])
+ if res[0]["service.name"] != "Test Runtime" {
+ t.Fatalf("service.name is %q; the header's adapter test/0 names the runtime Test Runtime", res[0]["service.name"])
}
}
diff --git a/internal/export/otlp/push.go b/internal/export/otlp/push.go
index 4654a9d..441e25f 100644
--- a/internal/export/otlp/push.go
+++ b/internal/export/otlp/push.go
@@ -53,10 +53,14 @@ type Pusher struct {
Client *Client
// Version is what the sender reports about itself.
Version string
- // ServiceName is the service every record is attributed to. The command
- // supplies the runtime's name, such as Claude Code, when none is
- // configured; the pusher itself refuses to run without one.
+ // ServiceName is the service every record is attributed to, when one is
+ // configured. Empty means the runtime that produced each session, read
+ // off its landed header's adapter and named through Runtimes.
ServiceName string
+ // Runtimes names the runtime behind each adapter: claude-code-local is
+ // Claude Code, mock is Mock Agent. An adapter with no entry is named by
+ // its own name.
+ Runtimes map[string]string
// InstanceID identifies this sender as service.instance.id. Empty means a
// new UUID, made once per Pusher.
InstanceID string
@@ -86,8 +90,8 @@ func (p *Pusher) Prepare() error {
if p.Client == nil || p.Client.Endpoint == "" {
return errors.New("otlp: no endpoint")
}
- if p.ServiceName == "" {
- return errors.New("otlp: no service name")
+ if p.ServiceName == "" && len(p.Runtimes) == 0 {
+ return errors.New("otlp: no service name and no runtime names")
}
if p.BatchBytes <= 0 {
p.BatchBytes = 8 << 20
@@ -120,13 +124,17 @@ func (p *Pusher) Pass() (*Stats, error) {
if err != nil {
return nil, err
}
- b := &batch{p: p, st: st, state: state}
+ b := &batch{p: p, st: st, state: state, services: map[string]string{}}
for _, session := range sessions {
files, err := storage.LandedFiles(p.Zone, session)
if err != nil {
st.Errors = append(st.Errors, err)
continue
}
+ // A session's records are attributed to the runtime that produced
+ // them, which its landed headers name. The rounds of its
+ // conversation follow the session.
+ b.services[session] = p.serviceOf(files)
for _, lf := range files {
rel, _ := filepath.Rel(p.Zone.Root(), lf.Path)
rel = filepath.ToSlash(rel)
@@ -180,6 +188,9 @@ type batch struct {
bytes int64
pending []pendingFile
+ // services is the service each session's records are attributed to.
+ services map[string]string
+
// latest is the latest record time of each session, read once per pass
// when a file without timed records needs a timestamp.
latest map[string]uint64
@@ -236,10 +247,46 @@ func (b *batch) flush() error {
return b.state.save(b.p.statePath(), b.p.Now())
}
-// resource names the sender and the service its records belong to.
-func (b *batch) resource() []Attr {
+// serviceOf is the service a session's records are attributed to: the
+// configured name, or the runtime named by the adapter on the session's
+// first landed header.
+func (p *Pusher) serviceOf(files []storage.LandedFile) string {
+ if p.ServiceName != "" {
+ return p.ServiceName
+ }
+ for _, lf := range files {
+ f, err := os.Open(lf.Path)
+ if err != nil {
+ continue
+ }
+ line, err := readLine(bufio.NewReaderSize(f, 1<<20))
+ f.Close()
+ if err != nil {
+ continue
+ }
+ var hdr struct {
+ Adapter string `json:"adapter"`
+ }
+ if json.Unmarshal(line, &hdr) != nil || hdr.Adapter == "" {
+ continue
+ }
+ name, _, _ := strings.Cut(hdr.Adapter, "/")
+ if runtime, ok := p.Runtimes[name]; ok {
+ return runtime
+ }
+ return name
+ }
+ return "unknown"
+}
+
+// resource names the sender and the service a session's records belong to.
+func (b *batch) resource(session string) []Attr {
+ service := b.services[session]
+ if service == "" {
+ service = b.p.ServiceName
+ }
attrs := []Attr{
- {Key: "service.name", Str: b.p.ServiceName},
+ {Key: "service.name", Str: service},
{Key: "service.instance.id", Str: b.p.InstanceID},
{Key: "telemetry.sdk.name", Str: "asz"},
{Key: "telemetry.sdk.version", Str: b.p.Version},
@@ -303,7 +350,7 @@ func (b *batch) addLanded(rel string, lf storage.LandedFile, session string, fil
}
now := uint64(b.p.Now().UnixNano())
rec := Record{TimeNano: stamp, ObservedNano: now, Severity: 9, SeverityText: "INFO", Body: string(data), Attrs: attrs}
- return b.add(b.resource(), rec, rel, digest)
+ return b.add(b.resource(session), rec, rel, digest)
}
// addRound sends one round file as one record. A round carries no time of
@@ -383,7 +430,13 @@ func (b *batch) addRound(rel, path, conv string) error {
stamp = now
}
rec := Record{TimeNano: stamp, ObservedNano: now, Severity: 9, SeverityText: "INFO", Body: string(data), Attrs: attrs}
- return b.add(b.resource(), rec, rel, digest)
+ if _, known := b.services[session]; !known {
+ files, err := storage.LandedFiles(b.p.Zone, session)
+ if err == nil {
+ b.services[session] = b.p.serviceOf(files)
+ }
+ }
+ return b.add(b.resource(session), rec, rel, digest)
}
// sessionLatest is the latest record time among a session's landed files,
diff --git a/internal/scenario/build.go b/internal/scenario/build.go
index 53e770d..9d8aa12 100644
--- a/internal/scenario/build.go
+++ b/internal/scenario/build.go
@@ -22,6 +22,7 @@ import (
"fmt"
"os"
"path/filepath"
+ "strings"
"time"
)
@@ -110,10 +111,12 @@ adapters:
# otlp:
# endpoint: http://127.0.0.1:12800
`, out, source)
- if old, err := os.ReadFile(path); err == nil && string(old) == text {
+ // A file that starts with what the build writes is the build's, with
+ // whatever a person appended, such as the export block for a push.
+ if old, err := os.ReadFile(path); err == nil && strings.HasPrefix(string(old), text) {
return path, nil
} else if err == nil {
- return "", errors.New("scenario: " + path + " exists and differs; use another --out")
+ return "", errors.New("scenario: " + path + " exists and is not this build's; use another --out")
}
return path, os.WriteFile(path, []byte(text), 0o644)
}
diff --git a/internal/scenario/run/push.go b/internal/scenario/run/push.go
index b4ee189..fad9439 100644
--- a/internal/scenario/run/push.go
+++ b/internal/scenario/run/push.go
@@ -32,7 +32,10 @@ import (
"sync"
"time"
+ "github.com/apache/skywalking-ai-sessionizer/internal/adapters/claudecode"
+ "github.com/apache/skywalking-ai-sessionizer/internal/adapters/mock"
"github.com/apache/skywalking-ai-sessionizer/internal/export/otlp"
+ "github.com/apache/skywalking-ai-sessionizer/internal/scenario"
"github.com/apache/skywalking-ai-sessionizer/internal/scenario/expect"
"github.com/apache/skywalking-ai-sessionizer/internal/storage"
"github.com/apache/skywalking-ai-sessionizer/internal/verify"
@@ -78,7 +81,7 @@ var wireKinds = map[string]bool{
// the ones it must not, the stamp a receiver bounds a read on, delivery
// once and at least once, and the export path: writing every body back
// gives a root that verifies and folds the same.
-func pushFollowsTheWire(out, session string, want *expect.Push) ([]string, error) {
+func pushFollowsTheWire(out, session string, f scenario.Format, want *expect.Push) ([]string, error) {
rcv := &receiver{}
srv := httptest.NewServer(rcv.handler())
defer srv.Close()
@@ -98,6 +101,35 @@ func pushFollowsTheWire(out, session string, want *expect.Push) ([]string, error
out2 = append(out2, "push_follows_the_wire: "+fmt.Sprintf(format, a...))
}
+ // With no service configured, a session is attributed to the runtime
+ // that produced it, read off its landed header: the adapter's runtime
+ // for a runtime format, the mock's for sd.
+ named := newPusher()
+ named.ServiceName = ""
+ named.Runtimes = map[string]string{claudecode.Name: claudecode.RuntimeName, mock.Name: mock.RuntimeName}
+ if _, err := named.Pass(); err != nil {
+ return nil, err
+ }
+ wantService := mock.RuntimeName
+ if f == scenario.FormatClaudeCode {
+ wantService = claudecode.RuntimeName
+ }
+ for i, req := range rcv.reqs {
+ groups, err := otlp.Decode(req)
+ if err != nil {
+ return nil, err
+ }
+ for _, g := range groups {
+ if got := attrMap(g.Resource)["service.name"]; got != wantService {
+ bad("request %d without a configured service names %q, want the runtime %q", i, got, wantService)
+ }
+ }
+ }
+ rcv.mu.Lock()
+ rcv.reqs = nil
+ rcv.mu.Unlock()
+ _ = os.Remove(filepath.Join(out, "push.state"))
+
// A refused pass leaves everything for the next one.
rcv.fail = true
st, err := newPusher().Pass()
diff --git a/internal/scenario/run/run.go b/internal/scenario/run/run.go
index 6a01b89..668ddca 100644
--- a/internal/scenario/run/run.go
+++ b/internal/scenario/run/run.go
@@ -226,7 +226,7 @@ func checkFormat(sc *scenario.Scenario, ex *expect.File, f scenario.Format, out
{"immutable_rounds", ex.Properties.ImmutableRounds, func() ([]string, error) { return expect.ImmutableRounds(out, session) }},
{"records_well_formed", ex.Properties.RecordsWellFormed, func() ([]string, error) { return expect.RecordsWellFormed(out, session) }},
{"repack_keeps_structure", ex.Properties.RepackKeepsStructure, func() ([]string, error) { return repackKeepsStructure(out, session, ex.Parse.MaxRoundBytes) }},
- {"push_follows_the_wire", ex.Properties.PushFollowsTheWire, func() ([]string, error) { return pushFollowsTheWire(out, session, ex.Push) }},
+ {"push_follows_the_wire", ex.Properties.PushFollowsTheWire, func() ([]string, error) { return pushFollowsTheWire(out, session, f, ex.Push) }},
{"view_covers_the_session", ex.Properties.ViewCoversTheSession, func() ([]string, error) { return expect.ViewCoversTheSession(out, session) }},
{"reproducible", ex.Properties.Reproducible, func() ([]string, error) {
// Two parses of identical landed evidence must produce identical
diff --git a/internal/view/api.go b/internal/view/api.go
index c40c786..d9606b9 100644
--- a/internal/view/api.go
+++ b/internal/view/api.go
@@ -121,6 +121,14 @@ func (s *Server) apiList(w http.ResponseWriter, _ *http.Request) {
}
}
row.From, row.To = Millis(row.From), Millis(row.To)
+ // The session node carries when the session began and its last
+ // activity, the same pair the document and the wire carry; the
+ // talks' span is the fallback for a chain from before that field.
+ if sn := c.View.Nodes[sessionflow.NodeID("session", c.Session)]; sn != nil {
+ if from, to := millisOf(attrString(sn, "from_time")), millisOf(attrString(sn, "through_time")); from != 0 && to != 0 {
+ row.From, row.To = from, to
+ }
+ }
if row.Title == "" {
row.Title = "(untitled)"
}
diff --git a/internal/view/conversationview.go b/internal/view/conversationview.go
index 907e8aa..0a9bb53 100644
--- a/internal/view/conversationview.go
+++ b/internal/view/conversationview.go
@@ -255,7 +255,7 @@ func (c *Conversation) rounds(digests map[uint64]string) (rounds []sessionview.R
round := h.Round
files = append(files, sessionview.File{
File: c.relPath(rf.Path), Format: "sf", Kind: "round", Round: &round,
- Lines: 2 + len(r.Nodes) + len(r.Relations) + len(r.Unresolved), Bytes: int64(len(data)),
+ Lines: countByte(data, '\n'), Bytes: int64(len(data)),
Digest: digestOf(data), FromTime: millisPtr(h.FromTime), ThroughTime: millisPtr(h.ThroughTime),
})
prevDigest, prevInput, prevThrough = r.Commit.Digest, h.InputDigest, h.ThroughSeq
diff --git a/tests/scenarios/three-rounds.expect.yaml b/tests/scenarios/three-rounds.expect.yaml
index 0f749d1..42335ac 100644
--- a/tests/scenarios/three-rounds.expect.yaml
+++ b/tests/scenarios/three-rounds.expect.yaml
@@ -32,7 +32,7 @@ checkpoints:
rounds: 3
written: true
delta: true
- kinds: {talk: 6, stream: 2, epoch: 3, epoch.boundary: 1, tool: 2} # the reset's summary opens a talk of its own
- talks_on: {main: 5, checker: 1}
- relations: {starts: 1, reports: 1, ends_with: 1, follows: 1, summarizes: 1}
- view: {state: verified, rounds: 3, talks: 6}
+ kinds: {talk: 7, stream: 3, epoch: 4, epoch.boundary: 1, tool: 2} # the reset's summary opens a talk of its own
+ talks_on: {main: 5, checker: 1, reviewer: 1}
+ relations: {starts: 2, reports: 2, ends_with: 2, follows: 1, summarizes: 1}
+ view: {state: verified, rounds: 3, talks: 7}
diff --git a/tests/scenarios/three-rounds.yaml b/tests/scenarios/three-rounds.yaml
index cc87836..709f4be 100644
--- a/tests/scenarios/three-rounds.yaml
+++ b/tests/scenarios/three-rounds.yaml
@@ -32,6 +32,8 @@ steps:
checkpoint: second
- input: wrap up
- call: {text: Wrapping up, tool: {name: Bash, input: {command: git status}, result: clean}}
- - reset: {summary: "Summary: built, checked, wrapped up."}
+ - call:
+ agent: {name: reviewer, prompt: review the change, steps: [{call: {text: looks good}}], notify: true}
+ - reset: {summary: "Summary: built, checked, reviewed, wrapped up."}
- input: one more thing
- call: {text: All done.}