Archon icon indicating copy to clipboard operation
Archon copied to clipboard

Fix bug report submission issues (#273)

Open Wirasm opened this issue 4 months ago • 4 comments

Pull Request

Summary

Fixes issue #273 where bug reports were being submitted to the old repository URL and had confusing auto-generated titles.

Changes Made

  • Updated repository reference from dynamous-community/Archon-V2-Alpha to coleam00/Archon in bug report API
  • Removed auto-generated title containing "UserReportedError" text - users now must enter their own title
  • Made bug title field mandatory with proper validation
  • Simplified GitHub issue creation for manual submissions to preserve all user input
  • Removed template parameter from manual submissions to allow full content transfer

Type of Change

  • [x] Bug fix (non-breaking change which fixes an issue)

Affected Services

  • [x] Frontend (React UI)
  • [x] Server (FastAPI backend)

Testing

  • [x] Manually tested affected user flows
  • [x] Docker builds succeed for all services

Test Evidence

# Verified bug report flow works correctly
# Checked that all form fields are preserved when redirecting to GitHub
# Confirmed repository URL points to correct location

Checklist

  • [x] My code follows the service architecture patterns
  • [x] If using an AI coding assistant, I used the CLAUDE.md rules
  • [x] My changes generate no new warnings
  • [x] I have verified no regressions in existing features

Breaking Changes

None - all changes are backward compatible.

Additional Notes

This fix addresses the immediate issue of bug reports failing due to incorrect repository references. The manual submission now uses GitHub's standard issue creation (without the YAML template) to ensure all user-entered data is preserved when redirecting to GitHub.

Fixes #273

Summary by CodeRabbit

  • New Features

    • Bug Report modal now requires a user-entered title with a clear prompt if missing.
    • Error preview shows the actual error message or “Manual bug report” when none is available.
    • “Actual behavior” is auto-filled from the error message to speed up reporting.
    • Manual GitHub submission opens a pre-filled issue with an emoji-prefixed title and formatted body.
  • Chores

    • Default GitHub repository for bug reports updated to the new project location.

Wirasm avatar Aug 22 '25 13:08 Wirasm

Walkthrough

Updates bug reporting: UI now requires a manual title and previews the error message, hooks/services adjust default error name to "Bug Report", and the server switches the default GitHub repository and manual submission URL construction to prefilled parameters without a template.

Changes

Cohort / File(s) Summary
Bug report modal UI
archon-ui-main/src/components/bug-report/BugReportModal.tsx
Remove auto-prefilled title; init title as empty; add required-title validation with toast; set initial actualBehavior from error message; update preview to show error.message or "Manual bug report"; early-return control flow on missing title.
Bug report hook
archon-ui-main/src/hooks/useBugReport.ts
Mostly formatting; fallback bug context error.name changed to "Bug Report"; minor string/style tweaks; trailing comma in return object.
Bug report service
archon-ui-main/src/services/bugReportService.ts
Interface style tweak for severity union literals; default error.name to "Bug Report"; formatting of strings/headers/signatures; no logic changes in submission other than defaults.
Server API (GitHub routing)
python/src/server/api_routes/bug_report_api.py
Default GitHub repo changed to coleam00/Archon; manual submission now builds prefilled issues/new URL (title prefixed with 🐛 and body param), not using template param; comments updated.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant M as BugReportModal
  participant H as useBugReport
  participant S as BugReportService (UI)
  participant A as Server API
  participant GH as GitHub

  U->>M: Open modal and enter details
  M->>M: Validate required title (new)
  alt Missing title
    M-->>U: Toast: "Please provide a title..."
    note over M: Early return
  else Title present
    M->>H: get bug context
    H->>H: Fallback error.name = "Bug Report" (new)
    M->>S: submitBugReport(data, context)
    alt API-driven creation
      S->>A: POST /bug-report
      A->>A: Build repo = coleam00/Archon (new)
      A->>GH: Create issue via API
      GH-->>A: Issue URL
      A-->>S: Success + URL
      S-->>M: Success
      M-->>U: Show success
    else Manual submission
      A->>A: Build prefilled URL without template (new)
      A-->>M: Redirect URL
      M-->>U: Open GitHub issues/new with title/body prefilled
    end
  end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Assessment against linked issues

Objective Addressed Explanation
Fix in-app bug report creation failing with GitHub “not found” (#273)
Ensure manual submission opens a valid prefilled GitHub URL instead of template path (#273)
Use correct default repository for issue creation (#273)

Poem

I thump my paws: a bug revealed!
We changed the route, the fate is sealed.
No 404s, just issues born—
With 🐛 in title, crisp as morn.
A hop, a fix, a tidy slate—
Report away, dear devs—create!


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cb4dba14a0fdc9614c6089456aba43432e23a638 and a88b1cbf109b75b65dc23a0765969ec133a8d21d.

📒 Files selected for processing (4)
  • archon-ui-main/src/components/bug-report/BugReportModal.tsx (3 hunks)
  • archon-ui-main/src/hooks/useBugReport.ts (3 hunks)
  • archon-ui-main/src/services/bugReportService.ts (10 hunks)
  • python/src/server/api_routes/bug_report_api.py (3 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}

📄 CodeRabbit inference engine (CLAUDE.md)

{python/**/*.py,archon-ui-main/src/**/*.{ts,tsx,js,jsx}}: Remove dead code immediately; do not keep legacy/unused functions Avoid comments that reference change history (e.g., LEGACY, CHANGED, REMOVED); keep comments focused on current functionality

Files:

  • archon-ui-main/src/components/bug-report/BugReportModal.tsx
  • python/src/server/api_routes/bug_report_api.py
  • archon-ui-main/src/hooks/useBugReport.ts
  • archon-ui-main/src/services/bugReportService.ts
archon-ui-main/src/components/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place reusable UI components in archon-ui-main/src/components/

Files:

  • archon-ui-main/src/components/bug-report/BugReportModal.tsx
python/src/{server,mcp,agents}/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/src/{server,mcp,agents}/**/*.py: Fail fast on service startup failures, missing configuration, database connection issues, auth failures, critical dependency outages, and invalid data that would corrupt state External API calls should use retry with exponential backoff and ultimately fail with a clear, contextual error message Error messages must include context (operation being attempted) and relevant IDs/URLs/data for debugging Preserve full stack traces in logs (e.g., Python logging with exc_info=True) Use specific exception types; avoid catching broad Exception unless re-raising with context Never signal failure by returning None/null; raise a descriptive exception instead

Files:

  • python/src/server/api_routes/bug_report_api.py
python/src/server/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/src/server/**/*.py: For batch processing and background tasks, continue processing but log detailed per-item failures and return both successes and failures Do not crash the server on a single WebSocket event failure; log the error and continue serving other clients

Files:

  • python/src/server/api_routes/bug_report_api.py
python/**/*.py

📄 CodeRabbit inference engine (CLAUDE.md)

python/**/*.py: Target Python 3.12 with a 120-character line length Use Ruff for linting and Mypy for type checking before commit

Files:

  • python/src/server/api_routes/bug_report_api.py
python/src/server/**

📄 CodeRabbit inference engine (CLAUDE.md)

Keep FastAPI application code under python/src/server/ (routes in api_routes/, services in services/, main in main.py)

Files:

  • python/src/server/api_routes/bug_report_api.py
archon-ui-main/src/hooks/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place custom React hooks in archon-ui-main/src/hooks/

Files:

  • archon-ui-main/src/hooks/useBugReport.ts
archon-ui-main/src/services/**

📄 CodeRabbit inference engine (CLAUDE.md)

Place API communication and business logic in archon-ui-main/src/services/

Files:

  • archon-ui-main/src/services/bugReportService.ts
🧬 Code graph analysis (1)
archon-ui-main/src/hooks/useBugReport.ts (1)
archon-ui-main/src/services/bugReportService.ts (1)
  • bugReportService (259-259)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Docker Build Tests (server)
  • GitHub Check: Backend Tests (Python + pytest)
🔇 Additional comments (14)
python/src/server/api_routes/bug_report_api.py (4)

50-50: Repository URL correctly updated.

The default GitHub repository has been properly changed from "dynamous-community/Archon-V2-Alpha" to "coleam00/Archon", addressing the core issue where bug reports were being submitted to the wrong repository.


246-253: Manual submission URL construction improved.

The updated implementation correctly removes the template parameter and uses direct URL parameters for pre-filling the issue. This approach ensures that all form data (title and body) is preserved when users are redirected to GitHub for manual submission.


250-250: Bug emoji prefix added to title.

The title is now prefixed with the 🐛 emoji, providing visual consistency and making bug reports easily identifiable in the GitHub issue list.


278-278: Health endpoint reflects correct repository.

The health endpoint now correctly reports the updated default repository, ensuring consistency across the API.

archon-ui-main/src/services/bugReportService.ts (4)

39-39: Severity type updated to string literals.

The type change from quoted strings to string literals maintains type safety while ensuring consistent formatting across the codebase.


51-53: Default error context improved.

The default error name changed from "UserReportedError" to "Bug Report" provides clearer, more user-friendly messaging that aligns with the PR objectives to remove confusing auto-generated titles.


157-165: Function signature formatting enhanced.

The multi-line formatting of the submitBugReport function signature improves readability for the complex return type without changing functionality.


239-239: Consistent string formatting.

The update to double quotes for "No stack trace available" maintains consistency with other string literals in the updated codebase.

archon-ui-main/src/hooks/useBugReport.ts (2)

21-23: Fallback context aligned with service changes.

The fallback error context now uses "Bug Report" as the default name, consistent with the changes in bugReportService.ts. The message fallback "Manual bug report" provides clear context when automatic error collection fails.


58-58: Trailing comma added for consistency.

The trailing comma in the return object follows modern JavaScript/TypeScript conventions and makes future additions cleaner.

archon-ui-main/src/components/bug-report/BugReportModal.tsx (4)

27-27: Title field now requires user input.

The title is initialized as an empty string, requiring users to provide their own descriptive title. This addresses the PR objective to remove auto-generated "UserReportedError" titles and ensures more meaningful bug report titles.


31-31: Actual behavior pre-populated from error context.

Pre-populating the actualBehavior field with the error message provides a helpful starting point while still allowing user modification.


43-46: Title validation ensures meaningful reports.

The validation check prevents submission without a title and provides clear user feedback. This enforces the requirement for user-provided titles instead of auto-generated ones.


196-196: Error preview shows contextual information.

The error preview displays either the actual error message or "Manual bug report" for cases without specific error context, providing users with clear feedback about what will be submitted.

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment
  • [ ] Commit unit tests in branch fix/bug-report-submission

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Aug 22 '25 13:08 coderabbitai[bot]

resolves #273

Wirasm avatar Aug 22 '25 13:08 Wirasm

@claude-review

Wirasm avatar Aug 22 '25 13:08 Wirasm

Claude finished @Wirasm's task —— View job


Summary

This PR fixes bug report submission issues by updating the repository URL from the old location to coleam00/Archon, requiring user-entered titles instead of auto-generated ones, and improving the manual submission workflow. The changes affect the frontend modal validation and backend GitHub integration.

Previous Review Comments

First review - no previous comments

Issues Found

Total: 0 critical, 2 important, 3 minor

🟡 Important (Should Fix)

  • Missing TypeScript strict typing - archon-ui-main/src/components/bug-report/BugReportModal.tsx:229 Problem: Using as any type assertion bypasses type safety Fix: Define proper type for severity values: severity: e.target.value as BugReportData['severity']

  • Potential XSS vulnerability - python/src/server/api_routes/bug_report_api.py:252 Problem: User-provided bug report data is URL-encoded but not HTML-escaped for GitHub body Fix: Add HTML escaping for user input in _format_issue_body method before URL encoding

🟢 Minor (Consider)

  • Console logging instead of proper error handling - archon-ui-main/src/components/bug-report/BugReportModal.tsx:116 Should use structured logging service instead of console.error for production code

  • Hardcoded timeout values - archon-ui-main/src/services/bugReportService.ts:121
    Consider making service timeout values configurable rather than hardcoded 2000ms

  • String template formatting - python/src/server/api_routes/bug_report_api.py:132-184 The multiline f-string could be extracted to a template for better maintainability

Security Assessment

Potential Issues Found:

  • Input validation: User-provided content in bug reports is not HTML-escaped before being included in GitHub issue URLs, which could lead to URL injection or malformed GitHub issues
  • The GitHub token is properly handled through environment variables (good practice)
  • No hardcoded secrets detected
  • CORS configuration not visible in this PR but appears to be handled elsewhere

Performance Considerations

No performance concerns - The changes are primarily cosmetic and validation-related:

  • Service health checks use appropriate 2-second timeouts
  • GitHub API calls have proper 30-second timeout
  • Frontend validation prevents unnecessary API calls for empty titles

Good Practices Observed

  • Proper error handling: Backend gracefully falls back to manual submission when GitHub API fails
  • Input validation: Frontend validates required fields before submission
  • User experience: Clear error messages and progress indicators
  • Configuration management: Repository URL properly externalized to environment variable
  • Type safety: Pydantic models used for API request/response validation
  • Logging: Structured logging with context information
  • Alpha development principles: Code removes deprecated auto-generated titles immediately (no backward compatibility)

Questionable Practices

  • Mixed validation approaches: Some validation in frontend, some in backend - consider consolidating validation logic
  • URL building: Manual URL parameter encoding could use a more robust URL building utility
  • Error context: Frontend error context collection could be more comprehensive (currently shows "unknown" for many fields)

Test Coverage

Current Coverage: Low - no visible tests for the changed components Missing Tests:

  1. BugReportModal validation

    • What to test: Title and description required validation, form submission flow
    • Why important: Prevents user frustration with failed submissions
    • Suggested test: Unit tests for form validation and submission success/failure states
  2. GitHub API fallback behavior

    • What to test: Fallback to manual submission when GitHub API fails
    • Why important: Ensures users can always submit reports even when API is down
    • Suggested test: Mock GitHub API failures and verify manual URL generation
  3. URL encoding edge cases

    • What to test: Special characters in bug report content don't break GitHub URLs
    • Why important: Prevents malformed GitHub issue URLs
    • Suggested test: Test with special characters, Unicode, and long content

Recommendations

Merge Decision:

  • [ ] Ready to merge as-is
  • [x] Requires fixes before merging

Priority Actions:

  1. Fix TypeScript type assertion with proper type definition
  2. Add HTML escaping for user input in GitHub issue body generation
  3. Consider adding basic unit tests for the validation logic

Rationale: The PR successfully addresses the core issue (wrong repository URL) and improves user experience by requiring meaningful titles. However, the type safety issue and potential XSS vulnerability should be addressed before merging. The changes align well with alpha development principles of failing fast and removing deprecated functionality.


Review based on Archon V2 Alpha guidelines and CLAUDE.md principles

claude[bot] avatar Aug 22 '25 13:08 claude[bot]

Already fixed in main

leex279 avatar Nov 05 '25 23:11 leex279