-
Notifications
You must be signed in to change notification settings - Fork 31
Ambient new Bugfix Workspace #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Complete foundational infrastructure for BugFix Workspace Type feature:
Backend Infrastructure:
- CRD CRUD operations (bugfix.go): Get, List, Upsert, Delete, UpdateStatus
- GitHub Issues integration (issues.go): Parse, Validate, Create, Update, AddComment
- Jira integration extensions: CreateTask, UpdateTask, AddComment, AddRemoteLink
- Git operations (bugfix/git_operations.go): CreateBugFolder, UpdateMarkdown, GetContent
Integration Features:
- Support for both GitHub Issue URL and text description workflows
- Bidirectional GitHub-Jira linking via remote links
- Automated bug folder and documentation file creation in spec repos
- Template generation for bugfix-gh-{issue-number}.md documentation
Technical Details:
- Uses existing GitHub App authentication with token caching
- Jira Cloud and Server/DC support with auto-detection
- Shallow git clones for performance
- Context-aware cancellation for all API calls
Dependencies: Phase 2 (API handlers) blocked until this is complete
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Complete backend API infrastructure for BugFix Workspace: API Handlers (handlers/bugfix/): - create.go: POST /bugfix-workflows (from GitHub Issue URL or text description) - get.go: GET /bugfix-workflows/:id (retrieve workspace details) - list.go: GET /bugfix-workflows (list all workspaces in project) - delete.go: DELETE /bugfix-workflows/:id (remove workspace) - sessions.go: POST/GET /bugfix-workflows/:id/sessions (create and list sessions) - status.go: GET /bugfix-workflows/:id/status (get workflow status) WebSocket Support: - bugfix_events.go: 8 event types for real-time updates * workspace-created, session-started/progress/completed/failed * jira-sync-started/completed/failed Route Registration: - routes.go: 7 new endpoints added to project group - main.go: Dependency injection for BugFix handlers - k8s/resources.go: GetBugFixWorkflowResource() function Features: - Supports both creation flows (GitHub Issue URL + text description) - Duplicate workspace detection via bug folder existence check - Session creation with environment variable injection - Label-based session querying (bugfix-workflow, bugfix-session-type) - WebSocket broadcasting for real-time UI updates Dependencies: Phase 3+ (UI components) can now be implemented 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…T020)
Complete Phase 2 with frontend integration for BugFix Workspace:
API Client (services/api/bugfix.ts):
- Complete TypeScript API client with type-safe interfaces
- Functions: listBugFixWorkflows, getBugFixWorkflow, createBugFixWorkflow
- Functions: deleteBugFixWorkflow, getBugFixWorkflowStatus
- Functions: createBugFixSession, listBugFixSessions, syncBugFixToJira
- Type definitions: BugFixWorkflow, CreateBugFixWorkflowRequest,
TextDescriptionInput, CreateBugFixSessionRequest, BugFixWorkflowStatus,
BugFixSession, SyncJiraRequest/Response
WebSocket Hook (hooks/useBugFixWebSocket.ts):
- Real-time event listener with React Query integration
- 8 event types: workspace-created, session-started/progress/completed/failed,
jira-sync-started/completed/failed
- Auto-reconnection with exponential backoff
- Automatic cache invalidation on relevant events
- Simplified useBugFixEvent() helper for single event subscriptions
Features:
- Type-safe API calls with error handling
- Automatic React Query cache invalidation
- WebSocket connection management with reconnection logic
- Event-specific callbacks for granular control
- Export through service/hook index files
Example Usage:
```tsx
// API client
const workflow = await bugfixApi.createBugFixWorkflow(projectName, {
githubIssueURL: 'https://github.com/org/repo/issues/123',
umbrellaRepo: { url: 'https://github.com/org/specs' }
});
// WebSocket hook
const { isConnected } = useBugFixWebSocket({
projectName: 'my-project',
workflowId: 'bugfix-123',
onSessionProgress: (event) => console.log(event.payload.message),
onJiraSyncCompleted: (event) => toast.success(`Synced: ${event.payload.jiraTaskKey}`)
});
```
Phase 2 Complete: Backend + Frontend infrastructure ready
Next: Phase 3+ (User Story implementations)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
…21-T031) Completed User Story 1 - Create Workspace from GitHub Issue: Frontend UI Implementation: - WorkspaceCreator page with dual-tab interface (GitHub Issue URL + Text Description) - Workspace list page with table view and status indicators - Workspace detail page with Overview/Sessions/Actions tabs - WebSocket integration for real-time updates - Form validation with React Hook Form and Zod Test Scaffolds: - Backend handler tests (T021-T023) with contract test documentation - Frontend integration test scaffold with test case documentation Note: T024-T027 (validation, folder creation, branch creation, duplicate detection) were already implemented in Phase 2 as part of the create handler. Progress: 31/79 tasks complete (39%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
… (T032-T037) Completed User Story 2 - Create Workspace from Text Description: Backend Enhancement: - Added text description validation (title min 10 chars, symptoms min 20 chars, required fields) - Automatic GitHub Issue creation already implemented in Phase 2 - GitHub Issue template generation already implemented in Phase 1 Test Implementation: - Created integration test for text description workflow with 6 test scenarios - Includes validation tests, GitHub API error handling, and duplicate detection Frontend: - Text description form UI already implemented in Phase 3 (dual-tab interface) - Frontend test cases already implemented in Phase 3 Note: Most of Phase 4 work was already completed in earlier phases as part of the dual-flow implementation. This phase adds validation and comprehensive tests. Progress: 37/79 tasks complete (47%) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…hronization Phase 5 - User Story 3: Bug-review Session - Added contract and integration tests for session creation (T038-T039) - Session creation logic with proper env vars and labels (T040-T042) - GitHub Issue comment posting via webhook handler (T043) - SessionSelector UI component for session type selection (T044) - Bug-review session page showing progress and findings (T045) - Frontend tests for SessionSelector component (T046) Phase 6 - User Story 4: Jira Synchronization - Contract and integration tests for Jira sync endpoint (T047-T049) - POST handler for /sync-jira with deduplication logic (T050-T051) - Jira task creation using Feature Request type (T052) - Bidirectional linking between GitHub and Jira (T053-T054) - Update workflow CR with Jira task info (T055) - Proper error handling for auth failures (T056) - JiraSyncButton UI component with confirmation (T057) - Jira sync status display in workspace UI (T058) - Frontend tests for JiraSyncButton (T059) NOTE: Using Feature Request type for Jira issues temporarily, will switch to proper Bug/Task type after Jira Cloud migration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Phase 7 - Bug-resolution-plan Session: - Added webhook handler for Bug-resolution-plan session completion - Creates/updates bugfix.md file with resolution plan - Posts resolution plan to GitHub Issue - Updates workflow CR with bugfixMarkdownCreated=true - Created Bug-resolution-plan session page with real-time updates Phase 8 - Bug-implement-fix Session: - Extended webhook handler for Bug-implement-fix session completion - Updates bugfix.md with implementation details - Posts implementation summary to GitHub Issue with branch info - Updates workflow CR with implementationCompleted=true - Created Bug-implement-fix session page with progress tracking Phase 9 - Generic Session: - Generic session support already existed in creation logic - Created Generic session page with: - Real-time output streaming - Manual stop functionality - Activity log tracking - No automatic GitHub/bugfix.md updates (by design) All session types now have: - Integration tests - Frontend pages with comprehensive tests - WebSocket real-time updates - Proper error handling Signed-off-by: sallyom <somalley@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
- Create BugTimeline component to display workspace activity history - Show events: workspace creation, sessions, Jira syncs, GitHub posts - Add comprehensive test coverage for BugTimeline component - Integrate BugTimeline into workspace detail page overview tab This completes Phase 8 of the BugFix Workspace implementation! Signed-off-by: sallyom <somalley@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com> Co-authored-by: Claude <noreply@anthropic.com>
…nfigurable Remove unused timeout parameter from AgenticSession spec (was never used by runner). Add SESSION_ACTIVE_DEADLINE_SECONDS env var to operator for configuring Job ActiveDeadlineSeconds (defaults to 14400s/4h). Also update default maxTokens to 4000 for bugfix sessions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
… analysis Replace long GitHub Issue comments with concise summaries linking to detailed Gists. Also collect ALL Claude comments (not just most recent) for full context in sessions. Changes: - Add CreateGist() function to create public Gists under user's account - Bug review: Short summary comment + detailed analysis in Gist - Implementation: Short summary comment + implementation details in Gist - Collect all Claude comments from issues for comprehensive context - Fallback to inline comment if Gist creation fails Gists are created using the user's GitHub token, keeping content under their control. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
Signed-off-by: sallyom <somalley@redhat.com>
Example WorkflowIssue: #210 Bug Review Session (
Implementation Session (
Result: Clean GitHub Issue thread, comprehensive documentation in Gists, working fix ready for review. |
…achments
- Includes links to GitHub Issue, branches, and PR details
- Shows assessment and implementation status with visual indicators
- New attachGistsToJira() function fetches and attaches Gist markdown files
- Attaches bug-review-issue-{number}.md and implementation-issue-{number}.md
- Runs on both create and update to ensure latest content
- Makes analysis documents centrally available in Jira (not dependent on individual contributor accounts)
- Enhanced GitHub comments with Gist links
- Create: "🔗 Jira Task Created" with task link and analysis document links
- Update: "🔄 Jira Task Updated" with latest information
- Both include links to bug-review and implementation Gists when available
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>
217d7a7 to
104894e
Compare
The Activity Timeline was showing both "Session Started" (with spinning icon) and "Session Completed" events for the same session, making it appear that sessions were still running even after completion. Now filters out session_started events when a corresponding session_completed or session_failed event exists for the same sessionId. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
6b4e1e8 to
a70b578
Compare
a70b578 to
4d7eb4f
Compare
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
4d7eb4f to
086479b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
@sallyom is there a difference between a 'workspace' and a 'workflow'? They seem to be used interchangeably in this overview. |
Fixed a variable shadowing bug where jiraTaskKey was not being persisted to the BugFixWorkflow CR after successful Jira sync. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
There is no difference - we changed the user-facing text to "Workspace" but didn't update the backend code. We need to fix this, but Workspace == Workflow & all the code references "workflow" |
a0c5d0b to
2bae2db
Compare
Added testing infrastructure for BugFix workflows with automated CI/CD integration and local development documentation. See tests/README.md for complete documentation. **Notes:** - Integration tests require K8s cluster, GitHub token, Jira access - Tests currently serve as documentation pending environment setup - Frontend Vitest setup instructions provided in README 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
2bae2db to
9b7b5a7
Compare
This comment was marked as outdated.
This comment was marked as outdated.
5c7d9b7 to
294e87c
Compare
This comment was marked as outdated.
This comment was marked as outdated.
294e87c to
292365b
Compare
This comment was marked as outdated.
This comment was marked as outdated.
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: sallyom <somalley@redhat.com>
292365b to
5b60bc4
Compare
Comprehensive Code Review: BugFix Workspace FeatureExecutive SummaryOverall Assessment: This is a well-structured, high-quality implementation ✅ The PR adds 11,157 lines across 83 files, implementing a complete AI-powered bug fixing workflow. The code demonstrates excellent adherence to CLAUDE.md guidelines with only minor optimization opportunities. Key Strengths:
Issues Found:
1. Code Quality & Best Practices - EXCELLENT ✅Backend (Go) Highlights✅ Proper User Token Authentication (components/backend/handlers/bugfix/create.go:87-90) reqK8s, reqDyn := GetK8sClientsForRequest(c)
if reqK8s == nil || reqDyn == nil {
c.JSON(http.StatusUnauthorized, gin.H{"error": "Missing or invalid user token"})
return
}Correctly follows CLAUDE.md pattern for user-scoped clients. ✅ Type-Safe Unstructured Access (components/backend/crd/bugfix.go:115-127) spec, found, _ := unstructured.NestedMap(obj.Object, "spec")
if found {
// Handle both int64 and float64 for JSON unmarshaling
if val, ok := spec["githubIssueNumber"].(int64); ok {
workflow.GithubIssueNumber = int(val)
} else if val, ok := spec["githubIssueNumber"].(float64); ok {
workflow.GithubIssueNumber = int(val)
}
}Excellent handling of JSON number types with graceful degradation. ✅ Comprehensive Input Validation (components/backend/handlers/bugfix/create.go:28-62) const (
MaxTitleLength = 200
MaxSymptomsLength = 10000
MaxReproductionStepsLength = 10000
)
var validBranchNameRegex = regexp.MustCompile(`^[a-zA-Z0-9/_.-]+$`)
func validateBranchName(branchName string) error {
if !validBranchNameRegex.MatchString(branchName) {
return fmt.Errorf("branch name contains invalid characters")
}
if strings.Contains(branchName, "..") || strings.Contains(branchName, "//") {
return fmt.Errorf("branch name cannot contain '..' or '//'")
}
return nil
}Proper protection against path traversal and DoS attacks. Frontend (TypeScript) Highlights✅ Zero ✅ Proper Type Definitions (components/frontend/src/services/api/bugfix.ts:11-32) export interface BugFixWorkflow {
id: string;
githubIssueNumber: number;
githubIssueURL: string;
title: string;
description?: string;
branchName: string;
phase: 'Initializing' | 'Ready';
// ...
}Proper string literal unions and optional properties. ✅ React Query Integration (components/frontend/src/app/projects/[name]/bugfix/[id]/page.tsx:62-72) const { data: workflow, isLoading: workflowLoading } = useQuery({
queryKey: ['bugfix-workflow', projectName, workflowId],
queryFn: () => bugfixApi.getBugFixWorkflow(projectName, workflowId),
enabled: !!projectName && !!workflowId,
});Proper query key structure and conditional enabling. ✅ Type-Safe Error Handling (components/frontend/src/components/workspaces/bugfix/SessionSelector.tsx:109-142) onError: (error: unknown) => {
if (error && typeof error === 'object' && 'response' in error) {
const axiosError = error as { response?: { status?: number; data?: unknown } };
if (axiosError.response?.status === 409) {
setPRConflict({ ... });
return;
}
}
errorToast(message);
}2. Security Analysis - EXCELLENT ✅✅ Token Handling
✅ Authorization
✅ Input Validation
✅ Secrets Management
3. Minor Optimization Opportunities🟡 Idempotency Check PlacementLocation: components/backend/handlers/bugfix/session_webhook.go:123-131, 313-320 Issue: Idempotency checks happen AFTER fetching the workflow, not at the start. Impact: Redundant GitHub API calls on duplicate webhook deliveries. Recommendation: // Move idempotency check earlier:
workflow, err := crd.GetProjectBugFixWorkflowCR(reqDyn, project, workflowID)
if err != nil || workflow == nil {
// error handling
}
// Check idempotency FIRST
if workflow.Annotations != nil {
if _, exists := workflow.Annotations["bug-review-comment-id"]; exists {
c.JSON(http.StatusOK, gin.H{"status": "already_processed"})
return
}
}
// Continue with expensive operations...🟡 Gist Content UTF-8 SafetyLocation: components/backend/handlers/bugfix/session_webhook.go:815-827 Issue: Truncation at exact byte boundary could split UTF-8 sequences. Recommendation: Use 🟡 Logging ConsistencyLocation: components/backend/handlers/bugfix/jira_sync.go:169-178 Issue: Debug logging with Recommendation: Use 4. Test Coverage - EXCELLENT STRUCTURE ✅Integration Tests:
All tests have clear documentation with numbered steps and proper Unit Tests:
Frontend Tests:
Recommendation: Consider implementing 1-2 critical path integration tests before GA. 5. Architecture & Design - EXCELLENT ✅Backend Organization: Clean separation by functionality with single responsibility. Frontend Organization: Proper component colocation following DESIGN_GUIDELINES.md. 6. Documentation - GOOD ✅
Minor suggestion: Add JSDoc comments to frontend components for better IDE support. Summary & RecommendationAPPROVE WITH MINOR OPTIMIZATIONS ✅ This is a production-ready implementation that demonstrates:
Suggested merge strategy:
Congratulations on a well-executed feature! 🎉 Review generated using Claude Code with comprehensive analysis of all 83 changed files |
Overview
BugFix Workspace automates the bug fixing process through two distinct AI sessions:
All analysis is posted to GitHub as concise comments with detailed reports in GitHub Gists, keeping issue threads clean while preserving full context.
Key Features
Quick Start
1. Create BugFix Workflow
From GitHub Issue:
From Text Description:
2. Run Bug Review Session
3. Run Implementation Session
4. Review & Merge
What Happens Under the Hood
Bug Review Session
main)Bug Implementation Session
Configuration Options
Session Settings
claude-sonnet-4-20250514(default)0.7(default)4000(default)Workflow Settings
main,develop)bugfix/gh-123)Requirements
GitHub Personal Access Token (PAT)
Your PAT must have these scopes: