Fix task ID lookup in triggerTeamCompositionForCouncil

Query the actual task_id from councils table instead of incorrectly
using council_id as task_id.

Issue: Council activation was failing to trigger team composition
because it was looking for a task with ID=council_id which doesn't exist.

Fix: Query SELECT task_id FROM councils WHERE id = council_id

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Code
2025-10-10 09:23:07 +11:00
parent 04509b848b
commit 6d6241df87

View File

@@ -3917,11 +3917,14 @@ func (s *Server) ensureCouncilAgentStatusConstraint(ctx context.Context) error {
// triggerTeamCompositionForCouncil starts team composition for the task linked to the council
func (s *Server) triggerTeamCompositionForCouncil(ctx context.Context, councilID uuid.UUID) error {
// Look up the task associated with this council. For now we assume the task ID matches the council ID.
// Future work could store an explicit mapping in the database.
taskID := councilID.String()
// Look up the task associated with this council from the database
var taskID uuid.UUID
err := s.db.Pool.QueryRow(ctx, "SELECT task_id FROM councils WHERE id = $1", councilID).Scan(&taskID)
if err != nil {
return fmt.Errorf("failed to get task_id for council: %w", err)
}
log := zerolog.Ctx(ctx).With().Str("council_id", councilID.String()).Str("task_id", taskID).Logger()
log := zerolog.Ctx(ctx).With().Str("council_id", councilID.String()).Str("task_id", taskID.String()).Logger()
log.Info().Msg("🔁 Triggering team composition for council-linked task")
// Reuse the monitor's capability to run team composition if available.
@@ -3931,7 +3934,7 @@ func (s *Server) triggerTeamCompositionForCouncil(ctx context.Context, councilID
}
// Use the monitor's helper so the same logic runs as for bzzz-task issues.
go s.repoMonitor.TriggerTeamCompositionForCouncil(ctx, taskID)
go s.repoMonitor.TriggerTeamCompositionForCouncil(ctx, taskID.String())
return nil
}