[DEV-91] Add 'retry this run' action to Support Dashboard - #85
Open
danii1 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Task: DEV-91
Summary: Add 'retry this run' action to Support Dashboard
Implementation Details
I'll start by exploring the codebase to understand the structure and existing retry logic.
Previous attempts exist. Let me check if they contain useful partial work.
No partial work exists. Let me explore the key pieces: dashboard server, retry gate, and the CLI force flow.
No
ticket-editin codebase — the real mechanism is the CLI's--forceretry gate bypass. Let me check the auth package for identity/roles, the RunStore schema, and existing dashboard tests.Now I understand the architecture. Let me check the remaining UI pieces and docs structure.
I have full context now. Let me set up the work plan and start implementing.
Now let me create the retry module.
Now extend
DashboardDataand add the retry handler indashboard-api.ts:I need to fix a caching bug in
RunRetryAuditStore—listForRuncould cache a readonly connection that later breaks writes. Let me correct it:Now add the
handleRetryRunhandler to dashboard-api.ts:The in-flight guard must persist past the request (the spawned run takes time to appear), so let me switch it to an expiring map:
Now wire the retry info into
handleRunDetailand add the POST route in the server:Backend done. Now the UI. Let me check the utils and button component:
Now update the UI API types and add a
RetrySectioncomponent. First, api.ts:Now update RunDetailView with the retry action, confirmation, feedback, and audit trail:
Let me fix the duplicate imports issue before linting:
Now the tests — a dedicated retry test file plus extending existing dashboard tests:
Let me clean up that messy concurrency test and add a TTL knob for testability:
Now rewrite the concurrency test cleanly:
Now add a server-route test to the existing dashboard-api.test.ts:
Now let me update the docs:
Typecheck passes. Now lint and format:
Lint passes (pre-existing warnings only). Now format and verify formatting checks pass:
All 926 backend tests pass. One cleanup — use
basenameinstead of string split in the spawn helper:Final verification round:
DEV-91 is implemented. Summary of the changes:
Backend (
packages/code)src/lib/run-retry.ts(new): retry eligibility (failed/escalated/abandonedruns with a task key; succeeded/deferred/in-progress and PR-mention runs are rejected with a reason),RunRetryAuditStore(newrun_retry_audittable inqueue.db: who, when, action, command, pid, original run id), actor resolution from the CLI sign-in session, andspawnCliForceRetrywhich re-invokes the same entry script asdevintern <TASK> --forceas a detached subprocess.src/lib/dashboard-api.ts: run detail now embedsretry: { eligible, reason, audit }; newhandleRetryRunenforces eligibility → authentication (devintern login) → optional support-role allowlist (DASHBOARD_RETRY_EMAILS) → per-task concurrency guard (claims + live in-progress runs) before spawning and auditing.src/dashboard-server.ts: routesPOST /api/runs/:id/retry(injectable deps for tests).UI (
packages/dashboard-ui)RunDetailView.tsx: "Retry this run" button on eligible runs, inline confirmation strip explaining the--forcere-run, success/failure banners after triggering, and a "Retry history" audit list.Docs & tests
docs/code/dashboard.md: retry flow, safeguards, env var, and API endpoint documented.tests/dashboard-retry.test.tsplus extended server-route tests — coverage for eligibility matrix, 403/409/404/500 paths, allowlist, concurrency/TTL, audit trail, and end-to-end POST viastartDashboardServer.Verification: full suite 926 pass / 0 fail, dashboard-ui tests 41 pass, typecheck, lint, format check, and vite build all green.
This PR was automatically created by @devintern/code