fix(dashboard): use runBdCmd for bd show routing in getIssueDetailsBatch

getIssueDetailsBatch was using runCmd for bd show, which doesn't set
cmd.Dir. This caused bd to use default routing instead of the town's
routes.jsonl, leading to dashboard slowness or missing data.

Use runBdCmd(f.townBeads, ...) to ensure proper database routing,
consistent with other bd commands in fetcher.go.

(gt-0v19)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
warboy
2026-01-26 12:30:40 -08:00
committed by John Ogle
parent 1c9ce267d5
commit bad278d797

View File

@@ -19,9 +19,9 @@ import (
// Command timeout constants // Command timeout constants
const ( const (
cmdTimeout = 5 * time.Second // timeout for most commands cmdTimeout = 5 * time.Second // timeout for most commands
ghCmdTimeout = 10 * time.Second // longer timeout for GitHub API calls ghCmdTimeout = 10 * time.Second // longer timeout for GitHub API calls
tmuxCmdTimeout = 2 * time.Second // short timeout for tmux queries tmuxCmdTimeout = 2 * time.Second // short timeout for tmux queries
) )
// runCmd executes a command with a timeout and returns stdout. // runCmd executes a command with a timeout and returns stdout.
@@ -81,7 +81,6 @@ func NewLiveConvoyFetcher() (*LiveConvoyFetcher, error) {
}, nil }, nil
} }
// FetchConvoys fetches all open convoys with their activity data. // FetchConvoys fetches all open convoys with their activity data.
func (f *LiveConvoyFetcher) FetchConvoys() ([]ConvoyRow, error) { func (f *LiveConvoyFetcher) FetchConvoys() ([]ConvoyRow, error) {
// List all open convoy-type issues // List all open convoy-type issues
@@ -278,7 +277,7 @@ func (f *LiveConvoyFetcher) getIssueDetailsBatch(issueIDs []string) map[string]*
args := append([]string{"show"}, issueIDs...) args := append([]string{"show"}, issueIDs...)
args = append(args, "--json") args = append(args, "--json")
stdout, err := runCmd(cmdTimeout, "bd", args...) stdout, err := runBdCmd(f.townBeads, args...)
if err != nil { if err != nil {
return result return result
} }
@@ -736,7 +735,7 @@ func (f *LiveConvoyFetcher) FetchPolecats() ([]PolecatRow, error) {
if issue, ok := assignedIssues[assignee]; ok { if issue, ok := assignedIssues[assignee]; ok {
issueID = issue.ID issueID = issue.ID
issueTitle = issue.Title issueTitle = issue.Title
// Keep full title - CSS handles overflow // Keep full title - CSS handles overflow
} }
// Calculate work status based on activity age and issue assignment // Calculate work status based on activity age and issue assignment
@@ -913,13 +912,13 @@ func (f *LiveConvoyFetcher) FetchMail() ([]MailRow, error) {
} }
var messages []struct { var messages []struct {
ID string `json:"id"` ID string `json:"id"`
Title string `json:"title"` Title string `json:"title"`
Status string `json:"status"` Status string `json:"status"`
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
Priority int `json:"priority"` Priority int `json:"priority"`
Assignee string `json:"assignee"` // "to" address stored here Assignee string `json:"assignee"` // "to" address stored here
CreatedBy string `json:"created_by"` // "from" address CreatedBy string `json:"created_by"` // "from" address
Labels []string `json:"labels"` Labels []string `json:"labels"`
} }
if err := json.Unmarshal(stdout.Bytes(), &messages); err != nil { if err := json.Unmarshal(stdout.Bytes(), &messages); err != nil {
@@ -1013,7 +1012,7 @@ func formatAgentAddress(addr string) string {
if addr == "mayor/" || addr == "mayor" { if addr == "mayor/" || addr == "mayor" {
return "Mayor" return "Mayor"
} }
parts := strings.Split(addr, "/") parts := strings.Split(addr, "/")
if len(parts) >= 3 && parts[1] == "polecats" { if len(parts) >= 3 && parts[1] == "polecats" {
return fmt.Sprintf("%s (%s)", parts[2], parts[0]) return fmt.Sprintf("%s (%s)", parts[2], parts[0])