Skip to content

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

Open
fabienfleureau wants to merge 3 commits into
stagingfrom
feat-agentic-task-replay
Open

fabienfleureau wants to merge 3 commits into
stagingfrom
feat-agentic-task-replay

Conversation

@fabienfleureau

@fabienfleureau fabienfleureau commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

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.

Written for commit 7f9a055. Summary will update on new commits.

View guided diff Turn on auto-fix

Copilot AI balanced review requested due to automatic review settings October 14, 2026 09:18
@nx-cloud

nx-cloud Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7f9a055

Command Status Duration Result
nx run console:build --parallel=3 --configurati... ✅ Succeeded 59s View ↗
nx affected --target=test --parallel=3 --config... ✅ Succeeded 3m 58s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded 2m 17s View ↗
nx-cloud record -- yarn nx format:check ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-10-14 10:44:46 UTC

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 6 files

Reply with feedback, questions, or to request a fix.

View guided diff | Turn on auto-fix | Re-trigger cubic

Copilot AI 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.

🟡 Changes recommended

Pending replays permit duplicate keyboard submissions, and CORS failures can incorrectly imply that no run started.

2 open findings
What changed in this PR

Adds browser-side replay of stored webhook payloads from agent-task run details.

Changes:

  • Adds replay mutation/hook with content-type inference, toasts, and history invalidation.
  • Adds a conditional Replay button with loading and disabled states.
  • Covers payload, trigger, success, and failure scenarios.
File Description
domains-services-data-access.ts Implements webhook replay request.
use-replay-agentic-workflow-run.ts Handles mutation feedback and cache invalidation.
use-replay-agentic-workflow-run.spec.tsx Tests replay mutation behavior.
agentic-workflow-runs.tsx Adds Replay action to run details.
agentic-workflow-runs.spec.tsx Tests Replay UI states and interactions.
index.ts Exports the replay hook.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@codecov

codecov Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 40.00000% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 52.28%. Comparing base (ac7c13b) to head (7f9a055).
⚠️ Report is 2 commits behind head on staging.

Files with missing lines Patch % Lines
...ata-access/src/lib/domains-services-data-access.ts 0.00% 13 Missing ⚠️
...ib/agentic-workflow-runs/agentic-workflow-runs.tsx 85.71% 0 Missing and 1 partial ⚠️
...ic-workflow-run/use-replay-agentic-workflow-run.ts 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           staging    #3106      +/-   ##
===========================================
- Coverage    52.40%   52.28%   -0.12%     
===========================================
  Files         1296     1353      +57     
  Lines        28962    30757    +1795     
  Branches      8782     9299     +517     
===========================================
+ Hits         15177    16081     +904     
- Misses       11368    12135     +767     
- Partials      2417     2541     +124     
Flag Coverage Δ
unittests 52.28% <40.00%> (-0.12%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cubic-dev-ai cubic-dev-ai Bot 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.

All reported issues were addressed across 4 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

View guided diff | Turn on auto-fix | Re-trigger cubic

}}
>
<Icon iconName="rotate-right" iconStyle="regular" />
Replay

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we make this an icon-only button with rotate-right and a “Replay” tooltip on hover?

async replayAgenticWorkflowRun({ webhookUrl, payload }: { webhookUrl: string; payload?: string | null }) {
let response: Response
try {
response = await fetch(webhookUrl, {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we keep this behind our usual API flow instead of posting directly to the webhook from the browser? CORS and replay delivery should be handled by the backend or infra. We shouldn't need to infer the content type with isJson or handle uncertain delivery here

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.

3 participants