Skip to content

Conversation

@roaga
Copy link
Member

@roaga roaga commented Jan 7, 2026

Add frontend support for coding agent handoff in explorer-based autofix. Uses split-button dropdown pattern matching legacy autofix UI.

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.
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 7, 2026
setWaitingForResponse(true);

try {
await api.requestPromise(`/organizations/${orgSlug}/issues/${groupId}/autofix/`, {
Copy link
Member

@aayush-se aayush-se Jan 9, 2026

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?

Copy link
Member Author

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

@roaga roaga marked this pull request as ready for review January 9, 2026 23:14
@roaga roaga requested a review from a team as a code owner January 9, 2026 23:14
Comment on lines +422 to +432
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]
);
Copy link

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>;
Copy link
Contributor

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)

Fix in Cursor Fix in Web

Copy link
Member

@aliu39 aliu39 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stamping

@roaga roaga merged commit 7990923 into master Jan 12, 2026
54 checks passed
@roaga roaga deleted the explorer/coding-agent-handoff-fe branch January 12, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants