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 <noreply@anthropic.com>
This commit is contained in:
Erik LaBianca
2026-01-10 19:26:32 -05:00
committed by GitHub
parent 40c67e0796
commit 84b6780a87

View File

@@ -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)