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
Refuse an ambiguous session prefix rather than share the log's match
Claudec340f5c28860
diff --git a/cli/beacon/cmd/share.go b/cli/beacon/cmd/share.goindex 28bf3b07..dbbf0c70 100644--- a/cli/beacon/cmd/share.go+++ b/cli/beacon/cmd/share.go@@ -462,6 +462,12 @@ func resolveShareSubject(harness, id string) (shareSubject, error) {if findErr == nil {return shareSubject{session: session}, nil}+ // A prefix that names several sessions is the person's to narrow: falling back to the log+ // would share whichever of them the log happens to hold.+ var ambiguous *handoff.AmbiguousError+ if errors.As(findErr, &ambiguous) {+ return shareSubject{}, findErr+ }// Not in any store, or a store could not be read: the runtime log may have the session.var notFound *handoff.NotFoundErrorisNotFound := errors.As(findErr, ¬Found)diff --git a/cli/beacon/cmd/share_test.go b/cli/beacon/cmd/share_test.goindex 908c392f..7b8329e0 100644--- a/cli/beacon/cmd/share_test.go+++ b/cli/beacon/cmd/share_test.go@@ -682,3 +682,33 @@ func TestShareReadsTheLogWhenTheStoreCannotBeRead(t *testing.T) {t.Fatalf("--session err = %v, want the store's permission error", err)}}++func TestShareRefusesAnAmbiguousPrefix(t *testing.T) {+ env := newShareEnv(t)+ srv := newFakeShareServer(t)+ srv.signIn(account.ScopeTracesWrite)+ twin := shareTestSession[:8] + "-ffff-4fff-8fff-000000000002"+ stubHandoffSources(t, stubHandoffSource{+ harness: handoff.HarnessClaude,+ sessions: []handoff.Session{+ {Harness: handoff.HarnessClaude, ID: shareTestSession, Directory: env.projectDir, UpdatedAt: time.Now()},+ {Harness: handoff.HarnessClaude, ID: twin, Directory: env.projectDir, UpdatedAt: time.Now()},+ },+ events: shareFixtureEvents(env.projectDir),+ })+ // Only one of the two is in the runtime log.+ shareFixtureInLog(t, env)+ for _, args := range [][]string{+ {"--session", shareTestSession[:8]},+ {"refresh", shareTestSession[:8]},+ } {+ _, _, err := runShareCommand(t, append(args, "--log-path", env.logPath)...)+ var ambiguous *handoff.AmbiguousError+ if !errors.As(err, &ambiguous) {+ t.Fatalf("share %v: err = %v, want the ambiguity", args, err)+ }+ }+ if len(srv.requests) != 0 {+ t.Fatalf("requests = %v", srv.requests)+ }+}