The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu
Go agent-ai-cliagent-harnessesagent-securitybrowser-extensionciclaude-codecloudcodexcursordetection-engineeringjevknowledge-basememorymobile-device-managementobservabilitysecuritysecurity-information-and-event-managementsecurity-toolstelemetrytraces
Hide a share's reply only when the session itself ran the share
Claude93f42f4de447
diff --git a/cli/beacon/internal/endpoint/dashboard/history_store.go b/cli/beacon/internal/endpoint/dashboard/history_store.goindex 4c51245d..6a4f8f05 100644--- a/cli/beacon/internal/endpoint/dashboard/history_store.go+++ b/cli/beacon/internal/endpoint/dashboard/history_store.go@@ -41,7 +41,7 @@ const (// historyDerivationVersion covers everything computed from a stored line: trace keys, event// numbers, types, summaries and search text. Bump it when that projection changes; the next// catch-up recomputes it from the stored lines, so history survives the change.- historyDerivationVersion = 7 // 2: trace events carry the event's policy block; 3: and its error; 4: usage carries the 1h cache-write split; 5: sharing goes stale on newer activity and carries a refresh command; 6: staleness compares against what a share covered (shared_through); 7: a share's own events (its command, the reply about it) do not make it stale+ historyDerivationVersion = 8 // 2: trace events carry the event's policy block; 3: and its error; 4: usage carries the 1h cache-write split; 5: sharing goes stale on newer activity and carries a refresh command; 6: staleness compares against what a share covered (shared_through); 7: a share's own events (its command, the reply about it) do not make it stale; 8: only when the session holds the share calldefaultHistoryRetentionDays = 90// maxHistoryRetentionDays is 100 years: a retention this long or longer means nothing expires.diff --git a/cli/beacon/internal/endpoint/dashboard/share_activity.go b/cli/beacon/internal/endpoint/dashboard/share_activity.goindex 0a8bba56..32e528f0 100644--- a/cli/beacon/internal/endpoint/dashboard/share_activity.go+++ b/cli/beacon/internal/endpoint/dashboard/share_activity.go@@ -11,7 +11,9 @@ import (// shareActivity decides which of a session's events count as activity that makes its shared trace// stale. Besides Beacon's own bookkeeping, a share made from inside the session is followed by// events about the share itself: the runtime's events for the `beacon share` command (its call and-// its completion, matched by gen_ai.tool.call.id) and the agent's reply about it. Counting those+// its completion, matched by gen_ai.tool.call.id) and the agent's reply about it -- only when the+// session itself holds that share call, in the reply's turn (prompt.id) or, for a runtime without+// turn ids, between its last other activity and the record. Counting those// would leave a session shared or refreshed from inside itself stale forever. Anything else -- a// new prompt, another tool call, a file write, a command that is not the share -- still counts.//@@ -22,7 +24,12 @@ type shareActivity struct {ShareCalls map[string]bool `json:"share_calls,omitempty"`// SharePrompts are the turns (prompt.id) that ran `beacon share`.SharePrompts map[string]bool `json:"share_prompts,omitempty"`- // QuietSinceShare is true from a session.shared record until the next event that counts.+ // ShareCallPending is true from a `beacon share` call in this session until the next event+ // that counts: a session.shared record that arrives meanwhile is that call's.+ ShareCallPending bool `json:"share_call_pending,omitempty"`+ // QuietSinceShare is true from a session.shared record that this session's own share call+ // wrote until the next event that counts. A record on its own (a share from another terminal,+ // or --follow) never starts it: the agent's output after such a record was not uploaded.QuietSinceShare bool `json:"quiet_since_share,omitempty"`}@@ -39,7 +46,7 @@ func isBeaconShareCommand(command string) bool {func (s *shareActivity) counts(event schema.Event) bool {action := event.Event.Actionif action == "session.shared" {- s.QuietSinceShare = true+ s.QuietSinceShare = s.ShareCallPendingreturn false}if shareBookkeeping(action) {@@ -60,6 +67,7 @@ func (s *shareActivity) counts(event schema.Event) bool {}s.SharePrompts[promptID] = true}+ s.ShareCallPending = truereturn false}if callID != "" && s.ShareCalls[callID] {@@ -71,7 +79,7 @@ func (s *shareActivity) counts(event schema.Event) bool {}return true}- s.QuietSinceShare = false+ s.QuietSinceShare, s.ShareCallPending = false, falsereturn true}diff --git a/cli/beacon/internal/endpoint/dashboard/sharing_view_test.go b/cli/beacon/internal/endpoint/dashboard/sharing_view_test.goindex ee53e199..a313ba96 100644--- a/cli/beacon/internal/endpoint/dashboard/sharing_view_test.go+++ b/cli/beacon/internal/endpoint/dashboard/sharing_view_test.go@@ -1,6 +1,7 @@package dashboardimport (+ "strings""testing""time")@@ -194,6 +195,13 @@ func TestShareFromInsideTheSessionIsNotStale(t *testing.T) {}}t.Run("share and its reply", func(t *testing.T) { check(t, inside, "shared") })+ t.Run("without turn ids", func(t *testing.T) {+ var bare []string+ for _, line := range inside {+ bare = append(bare, strings.ReplaceAll(line, `"prompt":{"id":"p1"},`, ""))+ }+ check(t, bare, "shared")+ })t.Run("later tool call", func(t *testing.T) {check(t, append(append([]string{}, inside...),`{"timestamp":"2026-06-11T10:05:00Z","event":{"id":"e7","action":"tool.invoked","category":"tool"},"harness":{"name":"claude_code"},"session":{"id":"in1"},"prompt":{"id":"p1"},"tool":{"name":"Edit","path":"main.go"},"gen_ai":{"tool":{"call":{"id":"call-edit"}}}}`,@@ -205,3 +213,26 @@ func TestShareFromInsideTheSessionIsNotStale(t *testing.T) {), "stale")})}++// A share made from outside the session (another terminal, --follow) does not hide the agent's+// later output: it was not uploaded, so the share is stale.+func TestShareFromOutsideTheSessionGoesStaleOnAReply(t *testing.T) {+ path := newTestLog(t, sharingLines(+ `{"timestamp":"2026-06-11T10:00:00Z","event":{"id":"o1","action":"prompt.submitted","category":"prompt"},"harness":{"name":"claude_code"},"session":{"id":"out1"},"prompt":{"text":"work"}}`,+ `{"timestamp":"2026-06-11T10:00:09Z","event":{"id":"o2","action":"session.shared","category":"session","fidelity":"inferred"},"harness":{"name":"claude_code"},"session":{"id":"out1"},"raw":{"shared_url":"https://beacon.sh/s/out1","visibility":"direct","shared_at":"2026-06-11T10:00:09Z","last_refreshed_at":"2026-06-11T10:00:09Z","shared_through":"2026-06-11T10:00:06Z"}}`,+ `{"timestamp":"2026-06-11T10:00:15Z","event":{"id":"o3","action":"agent.message","category":"agent"},"harness":{"name":"claude_code"},"session":{"id":"out1"},"message":"Here is the answer."}`,+ ))+ withoutHistory(t)+ if s := sessionSharing(t, path, EventQuery{})["out1"]; s == nil || s.State != "stale" {+ t.Fatalf("session sharing = %+v, want stale", s)+ }+ list, err := ReadTraceList(path, TraceQuery{Limit: 50})+ if err != nil {+ t.Fatal(err)+ }+ for _, trace := range list.Traces {+ if trace.ID == "session:claude_code:out1" && trace.Sharing.State != "stale" {+ t.Fatalf("trace sharing = %+v, want stale", trace.Sharing)+ }+ }+}