-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat(explorer): add coding agent handoff UI for explorer autofix #105873
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
Add frontend support for coding agent handoff in explorer-based autofix: - Add `CodingAgentHandoffCard` component to display coding agent status - Add dropdown to "Write a Code Fix" button showing available coding agents - Add `triggerCodingAgentHandoff` mutation to useExplorerAutofix hook - Add `ExplorerCodingAgentState` type and `coding_agents` field to state - Load coding agent integrations via `useCodingAgentIntegrations` hook - Hide "Write a Code Fix" button when coding agents or code changes exist Uses split-button dropdown pattern matching legacy autofix UI.
| setWaitingForResponse(true); | ||
|
|
||
| try { | ||
| await api.requestPromise(`/organizations/${orgSlug}/issues/${groupId}/autofix/`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the endpoint an autofix endpoint or is it an explorer endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's an autofix endpoint, the behavior just routes based on the feature flag
| queryClient.invalidateQueries({ | ||
| queryKey: makeExplorerAutofixQueryKey(orgSlug, groupId), | ||
| }); | ||
| } catch (e: any) { | ||
| setWaitingForResponse(false); | ||
| addErrorMessage(e?.responseJSON?.detail ?? 'Failed to launch coding agent'); | ||
| throw e; | ||
| } | ||
| }, | ||
| [api, orgSlug, groupId, queryClient] | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: The triggerCodingAgentHandoff function sends step: 'coding_agent_handoff', but the backend API doesn't support this value, causing a 400 error and breaking the feature.
Severity: CRITICAL
🔍 Detailed Analysis
The frontend function triggerCodingAgentHandoff sends a request to the backend with the parameter step: 'coding_agent_handoff'. However, the backend's ExplorerAutofixRequestSerializer only accepts ["root_cause", "solution", "code_changes", "impact_assessment", "triage"] as valid choices for the step field. Consequently, any attempt to use the coding agent handoff feature will result in a 400 Bad Request error from the API, rendering the feature non-functional. The backend currently lacks any implementation to handle the 'coding_agent_handoff' step.
💡 Suggested Fix
Update the backend to support the coding agent handoff feature. This involves adding 'coding_agent_handoff' to the list of allowed choices in the ExplorerAutofixRequestSerializer. Additionally, implement the necessary backend logic to process this new step and handle the integration_id parameter sent in the request.
🤖 Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/components/events/autofix/useExplorerAutofix.tsx#L407-L432
Potential issue: The frontend function `triggerCodingAgentHandoff` sends a request to
the backend with the parameter `step: 'coding_agent_handoff'`. However, the backend's
`ExplorerAutofixRequestSerializer` only accepts `["root_cause", "solution",
"code_changes", "impact_assessment", "triage"]` as valid choices for the `step` field.
Consequently, any attempt to use the coding agent handoff feature will result in a 400
Bad Request error from the API, rendering the feature non-functional. The backend
currently lacks any implementation to handle the `'coding_agent_handoff'` step.
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 8423948
| run_id: number; | ||
| status: 'processing' | 'completed' | 'error' | 'awaiting_user_input'; | ||
| updated_at: string; | ||
| coding_agents?: Record<string, ExplorerCodingAgentState>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing coding agent status check causes slow polling
Medium Severity
The isActivelyProcessing function doesn't account for pending or running coding agents when determining poll interval. The legacy useAutofix.tsx includes a check for coding_agents with PENDING or RUNNING status to enable fast polling (500ms). Without this check, when a coding agent is launched via triggerCodingAgentHandoff, the UI falls back to slow polling (2500ms) and isPolling returns false, causing delayed status updates and potentially incorrect UI state indicators for the coding agent handoff feature.
Additional Locations (1)
aliu39
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stamping
Add frontend support for coding agent handoff in explorer-based autofix. Uses split-button dropdown pattern matching legacy autofix UI.