Skip to content

feat(frontend): triggers section redesign for the agent playground#4978

Merged
ardaerzin merged 10 commits into
big-agentsfrom
fe-feat/cron-drawer-redesign
Jun 30, 2026
Merged

feat(frontend): triggers section redesign for the agent playground#4978
ardaerzin merged 10 commits into
big-agentsfrom
fe-feat/cron-drawer-redesign

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Summary

Reworks the agent-playground Triggers experience for non-technical users: a rebuilt
subscription drawer, a provider-grouped trigger list, an agent-aware event→message mapping,
and event-sourced "Run in playground". No backend changes; the persisted inputs_fields
shape is unchanged.

What changed

Subscription drawer — rebuilt on shared primitives (footer, version rail, list rail,
draft master-detail, event-source picker). Source selection is a browse-first page: a
provider grid with infinite scroll (ScrollSentinel gained root/rootMargin for an
off-screen prefetch buffer) + per-provider connect; picking drills into the event.

Triggers config list — grouped by provider (subscriptions first, schedules last),
collapsible per-provider groups (persisted, counted), de-badged section title, count-badged
nested subheaders. Two-tier actions: provider parent (expand + "add for this provider"),
event children (run + ⋯).

"What the agent gets" — agent-aware:

  • Agent workflows get a two-column token composer (raw-event field panel + inline pills),
    gated by workflowMolecule.selectors.isAgent.
  • Non-agent workflows keep the committed raw-JSON InputsMappingField.
  • The field panel + preview always source the raw event (catalog schema / draft probe),
    never the mapped delivery output.

Runs — parts-aware message extraction is shared across previews and playground replays,
so a triggered run injects the real message (not a JSON blob). "Run in playground" (drawer +
list) uses the event picker (wait / recent deliveries) to run a specific captured event;
saved triggers poll their own deliveries (avoids the provider trigger_id collision). A
trigger test now starts a fresh chat session instead of appending to the current one.

Notes

  • Storage (inputs_fields) and resolver/dispatcher untouched. A composed message is one user
    message whose content is a parts array (the runtime accepts str | ContentBlock[]).
  • Known backend follow-up (routed separately): POST /subscriptions/test 500s when an active
    sub already covers the same event (unique trigger_id collision) — the FE works around it by
    polling deliveries for saved triggers.

Testing

  • @agenta/{shared,ui,entities,entity-ui} tsc --noEmit clean (one pre-existing useModelHarness
    error from base, untouched); eslint clean; 89 gatewayTrigger unit tests pass.
  • Manual: agent draft (catalog fields → test → real values), agent saved (event fields preserved,
    real delivery shown), non-agent (raw-JSON editor), run-in-playground (clean message, new session).

…hnical users

Reworks the gateway-trigger schedule drawer so non-technical users can create
and manage cron schedules from the agent playground.

Builder & message UX
- Friendly cadence builder (daily/weekly/monthly/custom) bridged to cron via a
  new pure scheduleBuilder core (builderToCron/cronToBuilder/describeBuilder),
  with unit tests. Custom mode falls back to a raw cron editor.
- Single "message" composer over inputs_fields via a new messageInputs core:
  chat-shaped apps map to a messages array, completion apps to the schema's
  primary input. Detection uses the runtime executionMode (flag + schema), and
  a schema-agnostic preview powers the list/row summaries. Unit-tested.
- ConfigAccordionSection gains size/status/summaryCollapsedOnly props so config
  sections show required-field status + a collapsed summary.

Playground master-detail
- Drawer becomes master-detail in the playground: a schedule list (scoped to the
  active workflow id + app slug) plus multi-draft create/edit, draft removal and
  schedule deletion with safe fallback selection.
- List ordered newest-first; right pane no longer flashes loading on create
  (detail cache is seeded); Run-in-playground stays disabled until saved; opening
  an existing schedule no longer spawns a phantom draft.

Triggers config rows
- Rows are message-forward with a passive status dot; the run action simulates a
  schedule with its configured inputs (no captured-delivery replay) and uses a
  flask icon.

Engineering
- Use EnhancedDrawer (base drawer) and move all data fetching / master-detail
  state into a ScheduleDrawerContent that mounts only while the drawer is open.
- Theme-aware message/modal: imperative toasts/confirms go through @agenta/ui /
  Modal.useModal so they render correctly in dark mode.
…agent-aware mapping, event-sourced runs

Subscription drawer rebuilt on shared primitives (footer, version rail, list rail,
draft master-detail, event-source picker). Source selection is a browse-first page:
a provider grid with infinite scroll (ScrollSentinel gains root/rootMargin for an
off-screen prefetch buffer) plus per-provider connect; picking resolves to events.

Triggers config list is grouped by provider (subscriptions first, schedules last),
with collapsible per-provider groups (persisted, counts), de-badged section title,
and count-badged nested subheaders.

"What the agent gets" is agent-aware: agent workflows get a two-column token composer
(raw-event field panel + inline pills) gated by isAgent; non-agent workflows keep the
raw-JSON mapping editor. The field panel + preview always source the raw event
(catalog schema / draft probe), never the mapped delivery output.

Parts-aware message extraction is shared across previews and playground replays, so a
triggered run injects the real message (not a JSON blob). Stored inputs_fields shape is
unchanged. Run-in-playground (drawer + list) uses the event picker (wait / recent
deliveries) to run a specific captured event; saved triggers poll their own deliveries
to avoid the provider trigger_id collision.

Also: SchemaForm flat mode, dark-mode/box-sizing fixes, and shared delivery helpers.
A trigger "Run in playground" test shouldn't append to the user's current chat. The
simulated-run request gains a `newSession` flag: the chat panel creates + activates a new
session, then clears the flag so the new session's conversation sends the turn (the
per-session consumer skips flagged runs until then). All trigger run paths (subscription
picker + run button, schedule run, deliveries drawer) set the flag.
…awer-redesign

# Conflicts:
#	web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 30, 2026 7:23pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ca2ac93d-e55f-4f1a-a9b9-57c5c4baaad0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds cron/builder and message-template helpers, introduces a visual schedule builder field, refactors schedule and trigger management drawers, updates replay runs to start fresh sessions, and adjusts several shared UI components and gateway-trigger hooks.

Changes

Gateway Trigger Scheduling & Management Overhaul

Layer / File(s) Summary
Schedule builder, message templates, and simulatedRun newSession flag
web/packages/agenta-shared/src/state/simulatedAgentRun.ts, web/packages/agenta-entities/src/gatewayTrigger/core/scheduleBuilder.ts, web/packages/agenta-entities/src/gatewayTrigger/core/messageInputs.ts, web/packages/agenta-entities/src/gatewayTrigger/core/eventMessageTemplate.ts, web/packages/agenta-entities/src/gatewayTrigger/index.ts
Adds schedule builder state and cron conversion helpers, message input parsing and preview helpers, event message template compilation/parsing helpers, the newSession flag on simulated agent runs, and gatewayTrigger re-exports.
Unit tests for core utilities
web/packages/agenta-entities/tests/unit/gatewayTriggerScheduleBuilder.test.ts, web/packages/agenta-entities/tests/unit/gatewayTriggerMessageInputs.test.ts, web/packages/agenta-entities/tests/unit/gatewayTriggerEventMessageTemplate.test.ts
Adds Vitest coverage for schedule builder conversion and description helpers, message input parsing and round-tripping, and message template split/compile/parse behavior.
Gateway trigger hook updates
web/packages/agenta-entities/src/gatewayTrigger/hooks/useTriggerSchedule.ts, web/packages/agenta-entities/src/gatewayTrigger/hooks/useTriggerSchedules.ts, web/packages/agenta-entities/src/gatewayTrigger/hooks/useTriggerCatalogIntegrations.ts
Updates the integrations pagination chunk size, seeds the schedule detail cache after successful create/edit, and sorts returned schedules newest-first.
Shared drawer components and draft state helpers
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/EventSourcePicker.tsx, web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/TriggerListRail.tsx, web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/TriggerDrawerFooter.tsx, web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/RunVersionField.tsx, web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/deliveries.ts, web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/useDraftMasterDetail.ts
Adds shared drawer primitives for sampled events, delivery sampling and polling, run-version binding, drawer footers, list rails, and draft master-detail state management.
ScheduleBuilderField visual cron editor
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/ScheduleBuilderField.tsx
Adds the visual cron editor with cadence selection, per-cadence details, raw cron editing, and UTC time chip management.
TriggerScheduleDrawer master-detail refactor and ScheduleForm overhaul
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerScheduleDrawer.tsx
Replaces the single-panel schedule drawer with enhanced master-detail behavior, adds schedule list and form flows, wires in the builder field, run-version selection, message composer, footer controls, and new submit-time parsing and reference building.
TriggerManagementSection provider-grouped subscriptions and inline run-in-playground
web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/TriggerManagementSection.tsx, web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
Groups subscriptions by provider, adds sampled-event replay UI, replaces toggle-based rows with run-focused rows, simulates schedule runs from configured inputs, removes trigger catalog mounting, opens the subscription drawer directly from the app-trigger menu, and removes the Triggers header badge.
TriggerDeliveriesDrawer + AgentChatPanel newSession handling
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerDeliveriesDrawer.tsx, web/oss/src/components/AgentChatSlice/AgentChatPanel.tsx
Uses schedule-message previews for delivery replay text, marks replay runs as new sessions, suppresses premature consumption in the chat panel, and creates a fresh session before resubmitting the pending turn.
Shared UI component tweaks
web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx, web/packages/agenta-ui/src/components/ScrollSentinel.tsx, web/packages/agenta-ui/src/components/presentational/section/ConfigAccordionSection.tsx
Updates schema form optional-field layout, adds scoped scroll sentinel observation props, and changes accordion header sizing, status tinting, and summary visibility behavior.

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

  • Agenta-AI/agenta#4883: Both PRs modify the AgentChatPanel.tsx pending-run consumption flow around simulated playground runs.
  • Agenta-AI/agenta#4923: Both PRs touch AgentTemplateControl.tsx in the same Triggers section UI.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.42% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title summarizes the main frontend redesign for the agent playground triggers section.
Description check ✅ Passed The description is clearly related to the PR’s triggers redesign, drawer rebuild, grouped list, and run-in-playground workflow.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fe-feat/cron-drawer-redesign

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…edule

The New Schedule / New Subscription drawers omitted `flags` from the create body, so the
backend default (is_active=true) always won and a schedule/trigger created with Active
turned off still started active. The create body now sends `flags: {is_active: enabled}`
(subscription is_valid still defaults true). Edit already set this correctly.

Fixes #4977
…ter create

In the playground create flow the master-detail switches its internal selectedId to the
saved subscription, but the root drawer title only read `state.subscriptionId` (which stays
unset), so it was stuck on "New trigger". The content now publishes whether the open form is
a saved subscription via an atom, and the root title reads it.
The trigger list's per-provider groups toggled with an instant `{open && …}` render. Wrap
the group body in HeightCollapse (the same primitive ConfigAccordionSection uses) for a
smooth height transition on expand/collapse.
@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Schedule creation ignored the requested active state: `TriggerScheduleCreate` had no `flags`
field (so the FE's `flags` was dropped) and `map_schedule_dto_to_dbe_create` hardcoded
`TriggerScheduleFlags()` (is_active=True). Add `flags` to the create DTO (mirroring Edit and
TriggerSubscriptionCreate) and persist `schedule.flags` in the create mapping. Completes the
frontend fix in #4977 (subscriptions already honored flags on create).
@ardaerzin

Copy link
Copy Markdown
Contributor Author

Scope update: this PR now includes a small backend fix so the schedule Active toggle is honored on creation (#4977). TriggerScheduleCreate was missing a flags field and map_schedule_dto_to_dbe_create hardcoded TriggerScheduleFlags() (is_active=True), so the FE flag was dropped. Added the field + persist schedule.flags (mirrors Edit and TriggerSubscriptionCreate, which already worked). The "No backend changes" line in the description is now superseded by this.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 7


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 62484b79-3309-4d28-8a19-0f83cd3aea09

📥 Commits

Reviewing files that changed from the base of the PR and between dce5e8b and 8f259b2.

📒 Files selected for processing (27)
  • web/oss/src/components/AgentChatSlice/AgentChatPanel.tsx
  • web/packages/agenta-entities/src/gatewayTrigger/core/eventMessageTemplate.ts
  • web/packages/agenta-entities/src/gatewayTrigger/core/messageInputs.ts
  • web/packages/agenta-entities/src/gatewayTrigger/core/scheduleBuilder.ts
  • web/packages/agenta-entities/src/gatewayTrigger/hooks/useTriggerCatalogIntegrations.ts
  • web/packages/agenta-entities/src/gatewayTrigger/hooks/useTriggerSchedule.ts
  • web/packages/agenta-entities/src/gatewayTrigger/hooks/useTriggerSchedules.ts
  • web/packages/agenta-entities/src/gatewayTrigger/index.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerEventMessageTemplate.test.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerMessageInputs.test.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerScheduleBuilder.test.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/AgentTemplateControl.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/TriggerManagementSection.tsx
  • web/packages/agenta-entity-ui/src/gatewayTool/components/SchemaForm.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/ScheduleBuilderField.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerDeliveriesDrawer.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerScheduleDrawer.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerSubscriptionDrawer.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/EventSourcePicker.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/RunVersionField.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/TriggerDrawerFooter.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/TriggerListRail.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/deliveries.ts
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/useDraftMasterDetail.ts
  • web/packages/agenta-shared/src/state/simulatedAgentRun.ts
  • web/packages/agenta-ui/src/components/ScrollSentinel.tsx
  • web/packages/agenta-ui/src/components/presentational/section/ConfigAccordionSection.tsx

Comment thread web/packages/agenta-entities/src/gatewayTrigger/core/eventMessageTemplate.ts Outdated
Comment thread web/packages/agenta-entities/src/gatewayTrigger/core/eventMessageTemplate.ts Outdated
Comment thread web/packages/agenta-entities/src/gatewayTrigger/core/messageInputs.ts Outdated
…and rail a11y

Address PR review on the triggers section:
- Strict message round-trip: parseMessageTemplate/getScheduleMessage are representable only
  when the stored payload is exactly what the composer emits (single user message, text-only
  content; subscription also rejects extra keys since compile drops them). contentToTemplate
  returns null for non-text parts. Both composers open in the raw-JSON editor in edit mode when
  a saved payload isn't representable, so it's never silently collapsed. (+9 unit tests)
- Shared parseInputsFields() enforces a non-array object for inputs_fields at both save
  boundaries (was JSON.parse accepting arrays/strings/numbers).
- SubscriptionRunPopover surfaces recents load/poll failures instead of a false empty state.
- RowRemoveButton is a real keyboard-operable sibling button, not a nested span.
- Block saving a Deployed (environment) trigger/schedule without an app slug rather than
  persisting an ambiguous environment-only reference.
@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/TriggerListRail.tsx (1)

13-27: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Generic aria-label="Remove" lacks row context.

Screen reader users navigating multiple rows will hear identical "Remove" announcements with no indication of which item is being removed. Consider accepting a label/name prop and interpolating it, e.g. aria-label={Remove ${name}}.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1ec22f88-38d8-480f-9128-981490fdbb69

📥 Commits

Reviewing files that changed from the base of the PR and between 8f259b2 and 441d8ff.

📒 Files selected for processing (11)
  • api/oss/src/core/triggers/dtos.py
  • api/oss/src/dbs/postgres/triggers/mappings.py
  • web/packages/agenta-entities/src/gatewayTrigger/core/eventMessageTemplate.ts
  • web/packages/agenta-entities/src/gatewayTrigger/core/messageInputs.ts
  • web/packages/agenta-entities/src/gatewayTrigger/index.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerEventMessageTemplate.test.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerMessageInputs.test.ts
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/TriggerManagementSection.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerScheduleDrawer.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerSubscriptionDrawer.tsx
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/shared/TriggerListRail.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • web/packages/agenta-entities/src/gatewayTrigger/index.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerEventMessageTemplate.test.ts
  • web/packages/agenta-entities/src/gatewayTrigger/core/eventMessageTemplate.ts
  • web/packages/agenta-entity-ui/src/gatewayTrigger/drawers/TriggerScheduleDrawer.tsx
  • web/packages/agenta-entity-ui/src/DrillInView/SchemaControls/TriggerManagementSection.tsx

@ardaerzin ardaerzin marked this pull request as ready for review June 30, 2026 19:22
@dosubot dosubot Bot added size:XXL This PR changes 1000+ lines, ignoring generated files. Feature Request New feature or request Frontend UI labels Jun 30, 2026
@dosubot dosubot Bot added the UX label Jun 30, 2026
@ardaerzin ardaerzin merged commit c382a73 into big-agents Jun 30, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Request New feature or request Frontend size:XXL This PR changes 1000+ lines, ignoring generated files. UI UX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant