Repository navigation
Add Retrigger control to re-run a Failed task's log modal - #374
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Summary
Adds an owner-scoped agents.retrigger mutation that recovers a finished Job's run parameters from its pod-template env and replays them through deploy, plus a Retrigger button in the log-modal header for Failed tasks, a /dev/log-modal harness, unit tests, and a Playwright spec.
The design is sound and safe in the ways that matter most: it deliberately recovers only parameters (never the baked-in secrets), re-resolves credentials via deploy, mirrors terminate's owner-scoped label selector for the job lookup, and delegates the real authorization gate to deploy (which re-runs assertRepoAccess on the annotation-derived repo). Env-var names line up with what create-job.ts writes, the issue/review "don't double-expand CLAUDE_TASK" reasoning is correct, and the DOM ordering the e2e asserts matches the Modal layout. Tests pass locally (6/6). Nice work.
I have no blocking concerns — a few parameter-fidelity gaps worth a look, all of which degrade gracefully rather than break:
-
modelProvider/modelAuthare not recovered (agents.ts~1165). The original deploy pins the run to a specific provider and credential kind (subscription vs. metered API key) via these fields; retrigger omits both, so the re-run falls back toselectRunCredentials' precedence. For a model id served by more than one provider, or a run the user pinned to a subscription, the retriggered run can silently land on a different backend or a metered key (cost implication) than the original. Worth documenting as an intentional limitation, or recovering where feasible. -
Issue-run operator context is dropped (
agents.ts~1161). For an issue-sourced run,taskbecomes""anddeployre-expands from GitHub with empty additional context. The operator's extratasktext from the original run isn't recoverable fromCLAUDE_TASK(which holds the already-expanded prompt), so the re-run loses it. Given the code can't cleanly recover it, a one-line comment noting the loss would help. -
Per-task compute overrides (
cpu/memory) are not recovered — a run with a custom CPU/memory limit re-runs on repo/user defaults. Minor, but a fidelity gap in the same family as (1). -
Failure feedback is tooltip-only (
log-modal.tsx:329). On a rejected retrigger the only signal isretrigger.error?.messagein the buttontitle; the button just re-enables with no visible toast/inline error. Easy to miss. -
canRetriggeronly checksstatus === "Failed"(log-modal.tsx:229), yet the PR title/description say "Failed (or cancelled)". Pod phase has no "Cancelled" value, so this is fine if cancelled tasks surface as phaseFailed— worth confirming the cancelled path actually reaches this button, otherwise that half of the description is unreachable.
None of these block merging.
| repoFullName: | ||
| input.repoFullName ?? annotations["bandolier.io/repo"] ?? undefined, | ||
| branch: envValue("BRANCH") ?? "main", | ||
| model, |
There was a problem hiding this comment.
modelProvider and modelAuth from the original run aren't recovered here, so deploy falls back to selectRunCredentials' precedence rather than the provider/credential-kind the original run was pinned to. For a model id served by multiple providers this can re-run on a different backend, and a run pinned to a subscription can re-run on a metered API key (cost implication). If they can't be recovered reliably, consider a comment marking this as an intentional limitation.
| // deploy time, so replaying the already-expanded CLAUDE_TASK would apply | ||
| // that context twice; hand them their source instead. Everything else | ||
| // replays the task prompt verbatim. | ||
| const task = |
There was a problem hiding this comment.
For an issue-sourced run this correctly avoids double-expanding CLAUDE_TASK, but the operator's original additional context (the raw task passed alongside the issue) is lost — deploy re-expands with an empty task. Since it isn't separately recoverable from the env, a note here about the dropped context would save a future reader some confusion.
There was a problem hiding this comment.
Fix this. User's additional context should be preserved between re-runs.
|
|
||
| // A finished-but-unsuccessful task can be re-run from here (needs its job | ||
| // name to look the original up server-side). | ||
| const canRetrigger = status === "Failed" && !!jobName; |
There was a problem hiding this comment.
Only status === "Failed" enables the control, but the PR describes "Failed (or cancelled)". K8s pod phase has no Cancelled value — confirm cancelled/terminated tasks actually surface here as phase Failed, otherwise the cancelled case is unreachable from this button.
| }} | ||
| disabled={retrigger.isPending} | ||
| title={ | ||
| retrigger.error?.message ?? "Run this task again as a new task" |
There was a problem hiding this comment.
On a failed retrigger the only feedback is this title tooltip; the button silently re-enables. Consider a visible inline/toast error so a user who isn't hovering knows the re-run didn't happen.
d591a49 to
b302c41
Compare
|
🤖 Bando is resuming work on this pull request. View task on the dashboard (job: |
b302c41 to
83d8d2f
Compare
There was a problem hiding this comment.
Re-review of PR #374 (updated)
The two new commits (extractOperatorContext + preserve the operator's additional context on retrigger) cleanly resolve point #2 from my previous review — an issue-run retrigger no longer silently drops the operator's additional context.
I traced the full round-trip and it's correct:
buildIssueUserMessageappends operator context under a singleOPERATOR_CONTEXT_HEADINGconstant, now shared with the extractor.extractOperatorContextsplits on the exact\n\n<heading>\n\nmarker and returns the trailing section (or""), inverting the builder precisely.retriggerpasses that recovered context back astask, anddeploy → resolveIssueContext → buildIssueUserMessage(issue, operatorTask)re-embeds it alongside the freshly-fetched issue body — so the issue body isn't double-expanded and the operator's note survives.- Review runs still replay with an empty task (PR rebuilt from GitHub); plain runs replay
CLAUDE_TASKverbatim.
Unit coverage is good: the new extractOperatorContext describe block covers the happy path, multi-paragraph verbatim preservation, and the empty case. All 34 tests in issue-prompt.test.ts + agents.deploy.test.ts pass locally.
Still open from the previous review (all non-blocking)
These weren't part of this update and remain as-is:
modelProvider/modelAuthnot recovered — a run pinned to a subscription (or an ambiguous multi-provider model id) can re-run on a different backend / metered key, since retrigger only forwardsmodel.- Per-task
cpu/memoryoverrides not recovered — a retrigger falls back to repo/user defaults rather than the original run's compute. - Retrigger failure only surfaces in the button
titletooltip — an error is easy to miss; the modal also closes on success but a failed mutation leaves the user without a visible message. - Client gates on
status === "Failed"only, while the PR title/description say "Failed (or cancelled)." Worth confirming a cancelled/terminated task actually reports phase"Failed"here (its pod is deleted onterminate), otherwise the "or cancelled" affordance never appears.
Minor note on the new code
extractOperatorContext uses indexOf on the marker, so if an issue body itself contained the literal line ## Additional context from the operator surrounded by blank lines, the earlier (body) occurrence would win and mis-extract. This is pathological and not worth guarding in practice — flagging only for awareness.
Overall this is a solid, well-tested increment that addresses the most substantive of my earlier points.
| const marker = `\n\n${OPERATOR_CONTEXT_HEADING}\n\n`; | ||
| const at = issueUserMessage.indexOf(marker); | ||
| if (at === -1) return ""; | ||
| return issueUserMessage.slice(at + marker.length).trim(); |
There was a problem hiding this comment.
Nice inverse — sharing OPERATOR_CONTEXT_HEADING between builder and extractor keeps the round-trip in lockstep. One marginal edge: indexOf takes the first marker occurrence, so an issue body that itself contained this exact heading (with surrounding blank lines) would mis-extract. Pathological and fine to leave; noting for awareness.
| ? extractOperatorContext(storedTask) | ||
| : storedTask; | ||
|
|
||
| const caller = createCallerFactory(agentsRouter)(ctx); |
There was a problem hiding this comment.
modelProvider/modelAuth and the per-task cpu/memory overrides still aren't recovered from the original Job's env here, so a retrigger can land on a different credential kind or different compute than the run it replays. Non-blocking, but the env carries enough (provider/auth aren't stored, but compute is on the pod spec) to close the compute gap if you want parity.
There was a problem hiding this comment.
This is still unfixed. We should guarantee that reruns use the same keys and model provider.
|
🤖 Bando is resuming work on this pull request. View task on the dashboard (job: |
There was a problem hiding this comment.
Re-review — retrigger now replays the original run's compute
The two new commits (fix(agents): replay the original run's compute on retrigger + its test) address point #3 from my earlier review: the per-task CPU/memory are no longer dropped on re-run. I traced the full round-trip and it's correct:
retriggerreadscontainer.resources.limits.{cpu,memory}from the original Job's pod spec and threads them intodeployascpu/memory.deployruns them back throughparseComputeInput→mergeCompute, where the explicit override beats the re-resolved repo/user defaults, andpodResourcesre-derivesrequests = limits/2consistently.- The new unit test asserts
parseComputeInputis called with the exact recovered quantities ("4","8Gi"). All 35 tests in the two touched suites pass locally.
Combined with the earlier commit, this closes points #2 (operator context) and #3 (compute) from my first pass. Nothing in the new diff is blocking — keeping this as a COMMENT.
One consideration on the new code (non-blocking)
Because podResources always stamps a limit onto the pod (falling back to DEFAULT_CPU_LIMIT/DEFAULT_MEMORY_LIMIT when no override was given), the recovered limits are always present, so every retrigger now pins the compute the original run happened to get — even runs that never set an override. That's the stated intent (comment: "lands on the same box … rather than re-deriving from the (possibly since changed) repo/user defaults"), and it's a reasonable default. The one edge worth being aware of: a task that Failed because its compute was too low (e.g. OOMKilled) will retrigger with the identical limits and fail the same way, rather than picking up a since-raised repo default. Fine to leave as-is; flagging only so the tradeoff is a conscious one.
Still open from the earlier review (unchanged, all non-blocking)
modelProvider/modelAutharen't recovered — a run pinned to a subscription or an ambiguous multi-provider model id can re-run on a different backend / metered key.- Retrigger failure surfaces only in the button's
titletooltip; a user who doesn't hover won't see why nothing happened. - The client gates the control on
status === "Failed"while the PR/UI copy says "Failed (or cancelled)" — a terminated pod is deleted and won't appear in the list, so "cancelled" is effectively unreachable here. Worth aligning the wording with the actual gate.
Nice, well-tested increment overall.
| // though: replay the exact CPU/memory limits the run used so a retrigger | ||
| // lands on the same box, rather than re-deriving from the (possibly since | ||
| // changed) repo/user defaults. | ||
| const limits = container?.resources?.limits; |
There was a problem hiding this comment.
Solid — this closes the compute-parity gap from the last review. Note the round-trip pins compute unconditionally: podResources always stamps a limits value (defaulting to DEFAULT_CPU_LIMIT/DEFAULT_MEMORY_LIMIT), so even runs that set no override get their effective limits recovered and replayed here as an explicit override. Intended per the comment, but it does mean a run that Failed due to insufficient compute (e.g. OOMKilled) will retrigger with the same limits rather than a since-raised repo default. Non-blocking.
1422bfa to
145e02c
Compare
|
🤖 Bando is resuming work on this pull request. View task on the dashboard (job: |
d8c8a52 to
6862ed7
Compare
Recovers a run's parameters (task, model, branch, effort, output type, issue/review source, …) from the original Job's pod template and replays them through `deploy`, so a Failed or cancelled task can be run again as a brand-new task under freshly resolved credentials. Owner-scoped, mirroring `terminate`: a shared repo namespace still only lets you retrigger your own tasks. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
Adds a "Retrigger" button to the log modal header, beside the close ✕, shown only for a Failed (or cancelled) task. It calls agents.retrigger and, on success, surfaces the fresh task in the list and closes the now-stale log view. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
Unit tests exercise the retrigger mutation's job lookup and parameter recovery (404 when the job is gone, model-required guard, and review params threaded back into deploy). A /dev/log-modal harness plus a browser smoke test assert the Retrigger control renders beside the close ✕ for a Failed task and is absent otherwise. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
…ntext The inverse of buildIssueUserMessage: pulls the operator's additional context back out of an already-expanded issue user message. Both sides now share a single heading constant so the round trip can't drift. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
An issue-sourced run bakes the operator's additional context into CLAUDE_TASK under a dedicated heading, alongside the issue body. Retrigger was dropping the whole task to avoid double-expanding the issue body, which also silently lost that operator context. Recover just the operator section via extractOperatorContext and hand it back to deploy, which re-embeds it alongside the freshly fetched issue. Review runs still replay with an empty task since they carry no operator context. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
The provider/auth kind a run resolved to isn't stored on the Job, so credentials stay freshly re-resolved by deploy. Compute, though, is on the pod spec: recover the CPU/memory limits the run used and hand them back to deploy so a retrigger lands on the same box, rather than silently re-deriving from the (possibly since changed) repo/user defaults. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
Spies on parseComputeInput so the recovered pod-spec limits can be observed threading into deploy, and extends fakeJob to carry resource limits. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
6862ed7 to
bf7f09a
Compare
Add modelProvider/modelAuth to JobSpec and stamp them as annotations (bandolier.io/model-provider, bandolier.io/model-auth) on the Job and pod. The secrets themselves are never recoverable, but which provider and credential kind a run resolved to is exactly what a retrigger needs to replay the run on the same keys instead of re-deriving from the current precedence. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
…igger deploy now stamps the provider + credential kind it resolved to onto the Job, and retrigger reads them back off the annotations and threads them into deploy as modelProvider/modelAuth. Without this, a retrigger re-derived credentials from the current precedence, so it could land on a different provider or a different credential kind (metered API key vs. subscription) than the run it replays. deploy still resolves the secret material freshly — only the selection is pinned. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
… trip Asserts createAgentJob stamps the model-provider/model-auth annotations, and that retrigger threads the recovered selection into deploy: a run recorded on Gemini (or the subscription kind) re-runs against those, surfacing the no-credentials error when only an Anthropic API key is configured — proving the recorded selection, not the current precedence, drives the re-run. Signed-off-by: based64god <6633471+based64god@users.noreply.github.com>
There was a problem hiding this comment.
Re-review after the provider/auth commits. This update adds three commits that close point #1 from my first review — the run's resolved provider and credential kind are now recovered on retrigger, so a re-run no longer silently lands on a different backend or a differently-metered key.
I verified the round-trip end to end:
buildJobManifest(create-job.ts:769-777) stampsbandolier.io/model-providerandbandolier.io/model-authonto the shared annotations object, so they land on both the Job metadata and the pod template — andretriggerreadsjob.metadata.annotations, which is populated. TheRunProviderNamecovers thegollm:<id>case, and thedeployinput'sz.enum(...).or(z.custom<gollm:...>)schema re-validates whatever the annotation held, so a tampered/legacy value is rejected rather than trusted blindly.retriggerthreadsmodelProvider/modelAuthintodeploy, which feeds them toselectRunCredentials— the selection is replayed while the secret material is still resolved fresh. Secrets remain unrecoverable from the Job.- New tests are sharp: the deploy suite proves the recovered provider (Gemini) and auth kind (subscription) actually drive credential selection — each fails with
No model credentialsbecause only an Anthropic key exists, which only happens if the annotation, not the current precedence, won. create-job asserts both annotation placements.tsc --noEmitis clean and all 81 tests across the two touched suites pass locally.
With this, my earlier points #1 (provider/auth), #2 (operator context), and #3 (compute) are all resolved — I'm not repeating that feedback.
One conscious tradeoff to note (non-blocking, same shape as the compute pinning): pinning provider + auth means a retrigger now fails with No model credentials if the user has since removed those specific credentials, rather than gracefully falling back to another configured provider. That's the intended fidelity-over-convenience choice and the error is clear, so I'd only surface it in release notes. Legacy Jobs deployed before this PR carry no annotation and degrade to the old precedence-based behavior — fine.
Remaining non-blocking items from earlier still stand: retrigger failure only surfaces in the button tooltip (retrigger.error?.message), and the client still gates the control on status === "Failed" while the PR copy says "Failed (or cancelled)" — worth confirming a cancelled task actually reports status "Failed" here, or the control never appears for it.
Solid, well-tested increment. Keeping this as COMMENT.
| // on the same keys, not whatever is primary now. `deploy` still resolves | ||
| // the secret material freshly; only the *selection* is replayed. The | ||
| // secrets themselves are never recoverable from the Job. | ||
| const modelProvider = annotations["bandolier.io/model-provider"] as |
There was a problem hiding this comment.
Nice: pinning to the recorded provider/auth means a re-run replays the original credential selection instead of re-deriving from the current precedence. The cast to RunProviderName/AuthKind is safe because deploy's modelProvider/modelAuth zod schema re-validates the annotation value downstream. One tradeoff worth being aware of: if the user has since removed those specific credentials, the retrigger fails with No model credentials rather than falling back to another configured provider — intended fidelity, just flag it in release notes.
Lets a user re-run a Failed (or cancelled) task as a brand-new run directly from its log modal, by recovering the original run's parameters and replaying them through
deploy.Changes
agents.retriggermutation that reads the original Job's pod template (model, effort, branch, output type, issue/review source, etc.) and replays it throughdeployto spawn a fresh task, mirroringterminate's ownership scoping./dev/log-modaldev-only harness route (with?status=param) for exercising the modal's header controls in a browser.agents.retrigger(404 on missing job, 400 on missing model, and correct threading of review params) and a Playwright e2e spec asserting the Retrigger control's visibility and placement.