Skip to content

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

handoff: let a harness with a hyphen name itself in the handoff marker

Claudeaab7ee18c2f6
diff --git a/cli/beacon/internal/handoff/resume_test.go b/cli/beacon/internal/handoff/resume_test.go
index 5059148a..f5afcc5b 100644
--- a/cli/beacon/internal/handoff/resume_test.go
+++ b/cli/beacon/internal/handoff/resume_test.go
@@ -412,3 +412,17 @@ func TestRegistryIsConsistent(t *testing.T) {
}
}
}
+
+// A new session is linked to the one it continues only through the marker in its first prompt, so
+// every runtime's name has to fit in one.
+func TestEveryRuntimeCanBeNamedInAHandoffMarker(t *testing.T) {
+ for _, r := range runtimes {
+ if asymptoteobserve.HandoffMarker(r.Harness, "s-1") == "" {
+ t.Errorf("%s cannot be carried in a handoff marker", r.Harness)
+ }
+ prompt := NewSessionPrompt(Session{Harness: r.Harness, ID: "s-1"}, "/tmp/brief.md")
+ if info, ok := asymptoteobserve.ParseHandoffMarker(prompt); !ok || info.SourceHarness != r.Harness || info.SourceSessionID != "s-1" {
+ t.Errorf("%s: the new-session prompt's marker parses back as %+v, %v", r.Harness, info, ok)
+ }
+ }
+}
diff --git a/pkg/asymptoteobserve/handoff.go b/pkg/asymptoteobserve/handoff.go
index 69e2dff5..852b65a9 100644
--- a/pkg/asymptoteobserve/handoff.go
+++ b/pkg/asymptoteobserve/handoff.go
@@ -15,10 +15,10 @@ type HandoffInfo struct {
// The handoff marker is the one line `beacon handoff resume` adds to a new session's first prompt so
// that whatever records the prompt can link the new session to the old one. It is a claim made in
// prompt text, not a verified identity: anyone can type it, and a session.handoff event records that
-// the marker was observed, nothing more.
+// the marker was observed, nothing more. A harness name may carry a hyphen, as devin-cli does.
var (
- handoffMarkerPattern = regexp.MustCompile(`\[beacon-handoff from=([a-z0-9_]{1,64}) session=([A-Za-z0-9._:\-]{1,200})\]`)
- handoffHarnessChars = regexp.MustCompile(`^[a-z0-9_]{1,64}$`)
+ handoffMarkerPattern = regexp.MustCompile(`\[beacon-handoff from=([a-z0-9_-]{1,64}) session=([A-Za-z0-9._:\-]{1,200})\]`)
+ handoffHarnessChars = regexp.MustCompile(`^[a-z0-9_-]{1,64}$`)
handoffSessionChars = regexp.MustCompile(`^[A-Za-z0-9._:\-]{1,200}$`)
)
diff --git a/pkg/asymptoteobserve/handoff_test.go b/pkg/asymptoteobserve/handoff_test.go
index c2b6d969..9ca5ebd8 100644
--- a/pkg/asymptoteobserve/handoff_test.go
+++ b/pkg/asymptoteobserve/handoff_test.go
@@ -12,6 +12,7 @@ func TestHandoffMarkerRoundTrips(t *testing.T) {
{"codex_cli", "019a2b3c-thread", "codex_cli"},
{"opencode", "ses_4f2a1b", "opencode"},
{"cline", "subagent:lead-1:child.2", "cline"},
+ {"devin-cli", "devin-sess-1", "devin-cli"},
} {
marker := HandoffMarker(tc.harness, tc.id)
if marker == "" {