Skip to content

feat(frontend): One reader for a trigger's bound agent and honest cron names - #5766

Closed
ardaerzin wants to merge 1 commit into
mainfrom
entities/trigger-helpers
Closed

feat(frontend): One reader for a trigger's bound agent and honest cron names#5766
ardaerzin wants to merge 1 commit into
mainfrom
entities/trigger-helpers

Conversation

@ardaerzin

Copy link
Copy Markdown
Contributor

Context

Several surfaces need to answer two questions about a gateway trigger: which agent does it run, and when does it fire next. The settings schedules table derived both from raw trigger references inline, and the upcoming agent Home and overview surfaces were about to grow their own copies.

Changes

triggerBoundAgentId(references) reads the bound workflow id out of a trigger's references in one place, and the cron describer now names a schedule by what it does instead of repeating its cadence. GatewaySchedulesSection adopts both, so the settings table and the new agent surfaces resolve a trigger's agent the same way.

Tests / notes

  • gatewayTriggerCron unit tests cover the new naming.
  • These files are identical on main and feat/mobile-parity-and-consolidation, so this lands on main independently. The sessions/agents UX stack (based on feat/mobile-parity-and-consolidation) imports triggerBoundAgentId from its oss/home-overview lane up, so this PR should merge (and reach that base) first.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. frontend improvement labels Aug 6, 2026
@vercel

vercel Bot commented Aug 6, 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 Aug 6, 2026 9:53am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f69bb1b3-9b78-46a7-9896-ae1a434bb3e5

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

Summary by CodeRabbit

  • New Features
    • Added clearer descriptions for hourly schedules, stepped intervals, and multiple weekday ranges or lists.
    • Delivery records can now include the associated session identifier.
  • Bug Fixes
    • Improved workflow resolution for trigger schedules by consistently identifying the bound workflow across supported reference types.
  • Tests
    • Added coverage for the new schedule description formats and weekday handling.

Walkthrough

The changes add shared workflow binding resolution and nullable delivery session data. The schedule UI uses the shared resolver. Cron descriptions now cover additional hourly and weekday formats, with tests for the new descriptions.

Changes

Gateway trigger updates

Layer / File(s) Summary
Trigger data and binding contracts
web/packages/agenta-entities/src/gatewayTrigger/core/types.ts, web/packages/agenta-entities/src/gatewayTrigger/index.ts
Delivery data now includes nullable session_id. The module exports triggerBoundAgentId, which resolves IDs from application references in precedence order.
Schedule workflow binding integration
web/oss/src/components/pages/settings/Triggers/components/GatewaySchedulesSection.tsx
The schedules section uses triggerBoundAgentId to resolve the displayed workflow ID.
Cron description expansion and tests
web/packages/agenta-entities/src/gatewayTrigger/core/cron.ts, web/packages/agenta-entities/tests/unit/gatewayTriggerCron.test.ts
describeCron now handles fixed-minute hourly schedules, stepped hourly schedules, and weekday ranges or lists. Tests cover these formats.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the centralized bound-agent resolver and updated cron descriptions.
Description check ✅ Passed The description accurately explains the resolver, cron description changes, affected component, tests, and merge context.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch entities/trigger-helpers

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.

@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: 1

🧹 Nitpick comments (2)
web/packages/agenta-entities/src/gatewayTrigger/core/types.ts (1)

466-475: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add focused tests for binding precedence.

triggerBoundAgentId now defines the shared precedence used by the schedule table. Add tests for each reference type, precedence when multiple IDs exist, null IDs, and null or undefined references. This protects the contract when another trigger surface adopts the helper.

web/packages/agenta-entities/tests/unit/gatewayTriggerCron.test.ts (1)

119-127: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add regression coverage for weekday restrictions and lists.

The stepped-hour test uses an unrestricted weekday field, so it does not catch the missing dow guard in web/packages/agenta-entities/src/gatewayTrigger/core/cron.ts Line 104. The weekday test covers 1-5, but not comma-separated values. Add both cases.

Proposed tests
     it("describes an hour step", () => {
         expect(describeCron("30 */2 * * *")).toBe("Every 2 hours at :30 (UTC)")
+        expect(describeCron("30 */2 * * 1")).toBe("30 */2 * * 1 (UTC)")
     })

     it("describes a day range", () => {
         expect(describeCron("0 9 * * 1-5")).toBe(
             "Monday, Tuesday, Wednesday, Thursday, Friday at 09:00 UTC",
         )
+        expect(describeCron("0 9 * * 1,3")).toBe("Monday, Wednesday at 09:00 UTC")
     })

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f97fabe3-7b25-422a-8964-e4f2537f16a4

📥 Commits

Reviewing files that changed from the base of the PR and between ecacb20 and 5886859.

📒 Files selected for processing (5)
  • web/oss/src/components/pages/settings/Triggers/components/GatewaySchedulesSection.tsx
  • web/packages/agenta-entities/src/gatewayTrigger/core/cron.ts
  • web/packages/agenta-entities/src/gatewayTrigger/core/types.ts
  • web/packages/agenta-entities/src/gatewayTrigger/index.ts
  • web/packages/agenta-entities/tests/unit/gatewayTriggerCron.test.ts

Comment on lines +98 to +99
// "5 * * * *" — every hour, on the 5th minute. Left undescribed it fell through to the raw
// expression, which is what a schedule list shows as its own name.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Keep the explanatory comment to one short line.

Line 98 and Line 99 use two long comment lines for this branch. Replace them with one concise line, or remove the comment if the condition is clear.

As per coding guidelines: “Keep in-code comments to at most one short line; use longer comments only for genuinely surprising constraints such as bugs, races, or ordering requirements.”

Source: Coding guidelines

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Railway Preview Environment

Preview URL https://gateway-pr-5766.up.railway.app/w
Project agenta-oss-clone-spike
Image tag pr-5766-704ab99
Status Deployed
Railway logs Open logs
Workflow logs View workflow run
Updated at 2026-08-06T10:03:41.675Z

@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

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.

…t cron names

triggerBoundAgentId reads the bound workflow out of a trigger's references in one place, and the cron describer names a schedule by what it does. GatewaySchedulesSection adopts both.
@ardaerzin
ardaerzin force-pushed the entities/trigger-helpers branch from 5886859 to 167dc42 Compare August 6, 2026 09:51
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@ardaerzin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

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.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 9, 2026
@mmabrouk

mmabrouk commented Aug 9, 2026

Copy link
Copy Markdown
Member

Landed in release/v0.112.0 as part of the 0.112.0 release. The release branch now contains this work at commit ae71a92. Closing here since there is nothing left to merge.

@mmabrouk mmabrouk closed this Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend improvement lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants