Fix critical issues in WHOOSH Gitea issue monitoring and task creation

This commit resolves multiple blocking issues that were preventing WHOOSH from
properly detecting and converting bzzz-task labeled issues from Gitea:

## Issues Fixed:

1. **JSON Parsing Error**: Gitea API returns repository owner as string in issue
   responses, but code expected User object. Added IssueRepository struct to
   handle this API response format difference.

2. **Database Error Handling**: Code was using database/sql.ErrNoRows but
   system uses pgx driver. Updated imports and error constants to use
   pgx.ErrNoRows consistently.

3. **NULL Value Scanning**: Database fields (repository, project_id,
   estimated_hours, complexity_score) can be NULL but Go structs used
   non-pointer types. Added proper NULL handling with pointer scanning
   and safe conversion.

## Results:
-  WHOOSH now successfully detects bzzz-task labeled issues
-  Task creation pipeline working end-to-end
-  Tasks API functioning properly
-  First bzzz-task converted: "Logic around registered agents faulty"

The core issue monitoring workflow is now fully operational and ready for
CHORUS integration.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude Code
2025-09-10 12:57:11 +10:00
parent 4173c0c8c8
commit b5c0deb6bc
3 changed files with 58 additions and 30 deletions

View File

@@ -354,13 +354,16 @@ func (s *Service) UpdateTaskStatus(ctx context.Context, update *TaskStatusUpdate
func (s *Service) scanTask(scanner interface{ Scan(...interface{}) error }) (*Task, error) {
task := &Task{}
var sourceConfigJSON, labelsJSON, techStackJSON, requirementsJSON []byte
var repository, projectID *string
var estimatedHours *int
var complexityScore *float64
err := scanner.Scan(
&task.ID, &task.ExternalID, &task.ExternalURL, &task.SourceType, &sourceConfigJSON,
&task.Title, &task.Description, &task.Status, &task.Priority,
&task.AssignedTeamID, &task.AssignedAgentID,
&task.Repository, &task.ProjectID, &labelsJSON, &techStackJSON, &requirementsJSON,
&task.EstimatedHours, &task.ComplexityScore,
&repository, &projectID, &labelsJSON, &techStackJSON, &requirementsJSON,
&estimatedHours, &complexityScore,
&task.ClaimedAt, &task.StartedAt, &task.CompletedAt,
&task.CreatedAt, &task.UpdatedAt, &task.ExternalCreatedAt, &task.ExternalUpdatedAt,
)
@@ -369,6 +372,20 @@ func (s *Service) scanTask(scanner interface{ Scan(...interface{}) error }) (*Ta
return nil, err
}
// Handle nullable fields
if repository != nil {
task.Repository = *repository
}
if projectID != nil {
task.ProjectID = *projectID
}
if estimatedHours != nil {
task.EstimatedHours = *estimatedHours
}
if complexityScore != nil {
task.ComplexityScore = *complexityScore
}
// Parse JSON fields
if len(sourceConfigJSON) > 0 {
json.Unmarshal(sourceConfigJSON, &task.SourceConfig)