Skip to content

The cross-harness, self-improving memory layer for AI agents. Join our community: https://discord.com/invite/zdNChS2fBu

test(hermes): every home's default cursor shares one session home file

Saurav Singh6120c6157518
diff --git a/cli/beacon/cmd/endpoint_hermes_test.go b/cli/beacon/cmd/endpoint_hermes_test.go
index 48e269c5..53d77f91 100644
--- a/cli/beacon/cmd/endpoint_hermes_test.go
+++ b/cli/beacon/cmd/endpoint_hermes_test.go
@@ -180,3 +180,26 @@ func TestHermesStatusReportsSessionsKeyedByHome(t *testing.T) {
t.Fatalf("status text = %q, want only the cloned session marked keyed", text)
}
}
+
+// Which home keeps a session's unkeyed event ids is decided by the session home file beside the
+// cursor files. Every home a default sweep can read must therefore resolve to one such file per
+// mode, or a cloned profile would never see the claim of the home it came from.
+func TestHermesHomesShareOneSessionHomeFile(t *testing.T) {
+ home := t.TempDir()
+ t.Setenv("HOME", home)
+ t.Setenv("USERPROFILE", home)
+ t.Setenv("HERMES_HOME", "")
+ others := []string{
+ filepath.Join(home, ".hermes", "profiles", "work", "state.db"),
+ filepath.Join(home, "custom-hermes", "state.db"),
+ filepath.Join(home, "custom-hermes", "profiles", "work", "state.db"),
+ }
+ for _, userMode := range []bool{true, false} {
+ want := hermessession.SessionHomesPath(resolveHermesStatePath("", "", userMode))
+ for _, db := range others {
+ if got := hermessession.SessionHomesPath(resolveHermesStatePath("", db, userMode)); got != want {
+ t.Errorf("user mode %v: %s uses session home file %q, want %q", userMode, db, got, want)
+ }
+ }
+ }
+}