Skip to content

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

Fix Hermes session resolution to consult extra and session_key

Cursor Agent2010f8762cd1
diff --git a/cli/beacon-hooks/cmd/helpers.go b/cli/beacon-hooks/cmd/helpers.go
index 7ffe4625..31662ee2 100644
--- a/cli/beacon-hooks/cmd/helpers.go
+++ b/cli/beacon-hooks/cmd/helpers.go
@@ -70,7 +70,7 @@ func resolveSessionID(input map[string]interface{}, platform string) string {
case "grok":
return getFirstStr(input, "sessionId", "session_id", "sessionID")
case "hermes":
- return getFirstStr(input, "session_id", "sessionId", "task_id")
+ return hermesFirstString(input, "session_id", "sessionId", "session_key", "task_id")
case "opencode":
return getFirstStr(input, "session_id", "sessionID")
default:
@@ -114,8 +114,8 @@ func resolveSessionIDWithTranscript(input map[string]interface{}, platform strin
sessionID = getFirstStr(input, "sessionId", "session_id", "sessionID")
return
case "hermes":
- sessionID = getFirstStr(input, "session_id", "sessionId", "task_id")
- transcriptPath = getFirstStr(input, "transcript_path", "transcriptPath")
+ sessionID = hermesFirstString(input, "session_id", "sessionId", "session_key", "task_id")
+ transcriptPath = hermesFirstString(input, "transcript_path", "transcriptPath")
return
case "opencode":
sessionID = getFirstStr(input, "session_id", "sessionID")
diff --git a/cli/beacon-hooks/cmd/helpers_test.go b/cli/beacon-hooks/cmd/helpers_test.go
index 37ca3751..f054268d 100644
--- a/cli/beacon-hooks/cmd/helpers_test.go
+++ b/cli/beacon-hooks/cmd/helpers_test.go
@@ -51,6 +51,53 @@ func TestResolveSessionID_Cursor(t *testing.T) {
platform: "copilot",
want: "ff2d7803-5799-4f18-83f0-3633b2c11809",
},
+ {
+ name: "hermes uses top-level session_id",
+ input: map[string]interface{}{
+ "session_id": "hermes-sess-1",
+ },
+ platform: "hermes",
+ want: "hermes-sess-1",
+ },
+ {
+ name: "hermes uses session_key",
+ input: map[string]interface{}{
+ "session_key": "hermes-key-1",
+ },
+ platform: "hermes",
+ want: "hermes-key-1",
+ },
+ {
+ name: "hermes reads session_id from extra",
+ input: map[string]interface{}{
+ "extra": map[string]interface{}{
+ "session_id": "hermes-extra-sess",
+ },
+ },
+ platform: "hermes",
+ want: "hermes-extra-sess",
+ },
+ {
+ name: "hermes reads session_key from extra",
+ input: map[string]interface{}{
+ "extra": map[string]interface{}{
+ "session_key": "hermes-extra-key",
+ },
+ },
+ platform: "hermes",
+ want: "hermes-extra-key",
+ },
+ {
+ name: "hermes top-level session_id takes precedence over extra",
+ input: map[string]interface{}{
+ "session_id": "top-level",
+ "extra": map[string]interface{}{
+ "session_id": "from-extra",
+ },
+ },
+ platform: "hermes",
+ want: "top-level",
+ },
}
for _, tt := range tests {