Skip to content

Support re-triggering a failed run from the Hackbot UI - #6449

Open
suhaibmujahid wants to merge 5 commits into
mozilla:masterfrom
suhaibmujahid:worktree-hackbot-retrigger-run
Open

Support re-triggering a failed run from the Hackbot UI#6449
suhaibmujahid wants to merge 5 commits into
mozilla:masterfrom
suhaibmujahid:worktree-hackbot-retrigger-run

Conversation

@suhaibmujahid

Copy link
Copy Markdown
Member

Resolves #6413

Failed runs previously had to be retried by re-entering every input in the
trigger form, which is tedious for agents with non-trivial inputs such as
build-repair's failure_tasks JSON.

Add a "Re-run with same inputs" button to the run detail page for failed and
timed-out runs. It posts to a new /api/runs/:runId/retrigger route that reads
the stored run server-side and starts a fresh run with the same agent and
inputs, attributed to the signed-in user. The original run is left untouched,
and the new run gets its own id and results prefix.

Key RunDetail on the run id so following the new run remounts with fresh state
instead of rendering the previous run's doc, error and actions.
@suhaibmujahid
suhaibmujahid requested a review from a team as a code owner August 2, 2026 04:02
Copilot AI review requested due to automatic review settings August 2, 2026 04:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds “re-run” support to Hackbot UI for failed runs by introducing a dedicated API endpoint that creates a new run using the failed run’s stored inputs, and wiring that up to the run detail UI.

Changes:

  • Add an isFailed helper for consistent “failed or timed out” status checks across UI and API code.
  • Add POST /api/runs/:runId/retrigger to create a new run with the same inputs as a failed run (attributed to the currently signed-in user).
  • Add a “Re-run with same inputs” button on the run detail page and ensure state resets cleanly when navigating to the newly created run.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
services/hackbot-ui/lib/types.ts Adds isFailed helper and reuses existing RunStatus/RunRef types for retrigger flow.
services/hackbot-ui/components/RunDetail.tsx Adds UI/button + client-side POST to retrigger endpoint and navigates to the newly created run.
services/hackbot-ui/components/RecentRuns.tsx Refactors failed-status checks to use isFailed helper.
services/hackbot-ui/app/runs/[runId]/page.tsx Forces RunDetail remount on runId changes to clear transient UI state after navigation.
services/hackbot-ui/app/api/runs/[runId]/retrigger/route.ts Implements the retrigger API route that re-creates a run from a failed run’s stored inputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@suhaibmujahid
suhaibmujahid requested a review from padenot August 4, 2026 13:17
padenot
padenot previously approved these changes Aug 4, 2026

@padenot padenot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some comments, this largely does what it says it does and what is needed.

const doc = await getRun(runId);
if (!isFailed(doc.status)) {
return NextResponse.json(
{ error: `Only failed runs can be re-run (this one is ${doc.status})` },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why? What if you're not happy with the outcome and want to roll the dice again.

This is probably better served by a "Clone" action that let you edit it (change prompt, change model, etc.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can still trigger it again manually. But supporting that with a button could be tricky without accommodating for cases where re-triggering have side effects that might create noise, like double posting on Bugzilla, or submitting two patches for the same bug.

This is probably better served by a "Clone" action that let you edit it (change prompt, change model, etc.)

I agree!

<Link href="/" className="muted">
← all runs
</Link>
<div style={{ display: "flex", alignItems: "center", gap: 12 }}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we typically do inline style here? I know some framework somehow like that.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Next.js supports CSS-in-JS nicely, but I will refactor that at some point to make a more consistent styling, maybe with Tailwind.

>
{retriggering ? "Re-running…" : "Re-run with same inputs"}
</button>
)}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's nice when UI is always the same look, and you can understand things without thinking. Here, we could have:

  • Enabled, "Re-run with same inputs"
  • Disabled, "Currently re-running"
  • Disabled, "Run succeeded, cannot rerun"

GitHub CI, TreeHerder and others allow to retrigger a run regardless of its final or current state

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done in 017d7db

GitHub CI, TreeHerder and others allow to retrigger a run regardless of its final or current state

We could do that with the "Clone" workflow that you suggested in #6449 (comment)


{error && <div className="error-banner">Refresh error: {error}</div>}
{retriggerError && (
<div className="error-banner">Re-run failed: {retriggerError}</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It's the retrigger that failed, not the re-run, right?

@suhaibmujahid suhaibmujahid Aug 4, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good catch, this pr mixes re-run and retrigger, it should be retrigger since it is more accurate.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 5a06970

Instead of hiding the re-run button when a run isn't failed, always render it but disable it and show a contextual label explaining why it can't be triggered (e.g. run succeeded, run in progress).
Relocates the retrigger button from the header into the run details card, leaving the header with only the back link. This makes the action sit closer to the run metadata it applies to and simplifies the top-level layout.
Updates Hackbot UI and API error messaging to consistently use “retrigger” terminology instead of “re-run” for failed runs. This aligns button labels, status text, and failure messages with the retrigger endpoint behavior.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support re-triggering a faild run from Hackbot UI

3 participants