feat(agentic-workflow): replay webhook runs from run details

FA
15h ago
+385-1

Summary

Issue: N/A (no ticket supplied)

Adds a Replay button to every row of the agent task run history table, in a new Actions column. It resends a past run to the agent task webhook straight from the browser (no backend endpoint), so CORS behavior can be tested. The button is not in the run details panel anymore.

  • Shown on every row: WEBHOOK, MANUAL and SCHEDULE runs, with or without a stored payload.
  • With a stored payload (an empty string counts), POSTs the exact original raw payload (no parse/re-serialize) to service.webhook.url with credentials: 'omit'. Content-Type is application/json when the payload parses as JSON, otherwise text/plain, since run history does not store request headers.
  • With a null/missing payload, POSTs an empty body (no Content-Type).
  • Disabled until the service (webhook URL) is loaded. Loading state only on the activated row. Click does not bubble, so the run details do not open.
  • Unchanged feedback: success toast + run history refetch, error toast on a non-2xx status (shows the status) or a network/CORS failure.
  • mutations.replayAgenticWorkflowRun (services data-access) now accepts an optional/null payload; useReplayAgenticWorkflowRun hook in the services feature lib.

How to test (staging, agent task with a webhook that allows the Console origin via CORS):

  1. Open the service Runs page. Every row has a Replay button in the Actions column.
  2. Click Replay on a webhook run with a payload. Expect a new run with the same payload in the list and a "Run replayed" toast; the details panel stays closed.
  3. Click Replay on a manual/scheduled run. Expect a new run triggered by the webhook with an empty payload.
  4. Point at a webhook without CORS headers or a failing one. Expect a "Replay failed" toast and no new run.

Screenshots / Recordings

image

Testing

  • Changes tested locally in the relevant Console's pages and Storybooks
  • yarn test or yarn test -u (if you need to regenerate snapshots) — focused run only: npx jest -c libs/domains/services/feature/jest.config.ts libs/domains/services/feature/src/lib/agentic-workflow-runs libs/domains/services/feature/src/lib/hooks/use-replay-agentic-workflow-run (2 suites, 59 tests passed). Full yarn test not run.
  • yarn format (prettier check on changed files clean)
  • yarn lint (nx run-many --target=lint --projects=domains-services-feature,domains-services-data-access passed; not all projects)

PR Checklist

  • I followed naming, styling, and TypeScript rules (see .cursor/rules)
  • I performed a self-review (diff inspected, dead code removed)
  • I titled the PR using Conventional Commits with a scope when possible (e.g. feat(service): add new Terraform service) - required for semantic-release
  • I only kept necessary comments, written in English (watch for useless AI comments)
  • I involved a designer to validate UI changes if I am not a designer
  • I covered new business logic with tests (unit)
  • I confirmed CI is green (Codecov red can be accepted)
  • I reviewed and executed locally any AI-assisted code (unit tests only; the feature was not exercised in a running app)

Summary by cubic

Adds a Replay action to the agent task run history table that resends the stored webhook payload from the browser, so webhook CORS behavior can be tested.

  • Replay is now an Actions column on every run row, shown regardless of trigger or payload, instead of being limited to the run details sheet.
  • Posts the exact original payload to the service webhook URL with application/json if it parses as JSON, otherwise text/plain; for runs without a payload it posts an empty body with no content type.
  • Shows a per-row loading state that disables the row until the request finishes, then a success toast with run-history refetch, or an error toast with the HTTP status or an indeterminate-delivery message for network/CORS failures.
  • Disabled until the webhook URL is loaded.