From 84b6780a872912ab8c8b2bc4c190e5c952b464f2 Mon Sep 17 00:00:00 2001 From: Erik LaBianca Date: Sat, 10 Jan 2026 19:26:32 -0500 Subject: [PATCH] fix(witness): use town-level beads for role config lookup (#320) The witness manager was using rig-level beads path to look up role configuration, but role beads use the hq- prefix and live in town-level beads. This caused "unexpected end of JSON input" errors when starting witnesses because the rig database (with gt- prefix) couldn't find hq-witness-role. Changed roleConfig() to use townRoot instead of rig.BeadsPath() to correctly resolve town-level role beads. Co-authored-by: Claude Opus 4.5 --- internal/witness/manager.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/witness/manager.go b/internal/witness/manager.go index 942259cc..c88ca699 100644 --- a/internal/witness/manager.go +++ b/internal/witness/manager.go @@ -251,9 +251,9 @@ func (m *Manager) Start(foreground bool, agentOverride string, envOverrides []st } func (m *Manager) roleConfig() (*beads.RoleConfig, error) { - beadsPath := m.rig.BeadsPath() - beadsDir := beads.ResolveBeadsDir(beadsPath) - bd := beads.NewWithBeadsDir(beadsPath, beadsDir) + // Role beads use hq- prefix and live in town-level beads, not rig beads + townRoot := m.townRoot() + bd := beads.NewWithBeadsDir(townRoot, beads.ResolveBeadsDir(townRoot)) roleConfig, err := bd.GetRoleConfig(beads.RoleBeadIDTown("witness")) if err != nil { return nil, fmt.Errorf("loading witness role config: %w", err)