Repository navigation
fix(runtime): no-trigger personas narrow to AgentEvent (v4.0.0 regression) - #221
Conversation
…Event
v4.0.0 regression: defineAgent's event narrowing collapsed personas that declare
no concrete trigger literals (e.g. team members launched by a dispatcher) to
`BaseAgentEvent<`${string}.${string}`>`, which is narrower than `AgentEvent` and
rejects an `(event: AgentEvent)`/`WorkforceEvent` handler:
Type '(ctx, event: WorkforceEvent) => ...' is not assignable to
'(ctx, event: ProviderEventFor<string, string>) => ...'
ProviderEventFor now falls back to the full `AgentEvent` when the trigger `on`
union is the wide `string` (nothing concrete declared), while still mapping
declared literals to `BaseAgentEvent<`${P}.${O}`>` (incl. 2-segment types like
slack.app_mention). Restores the pre-v4 behavior for trigger-less personas.
86 runtime tests pass; the agents repo's cloud-team member personas typecheck
clean against the rebuilt runtime.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
Warning Review limit reached
More reviews will be available in 39 minutes and 31 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
pr-reviewer could not complete review for #221 in AgentWorkforce/workforce. |
There was a problem hiding this comment.
Code Review
This pull request updates the ProviderEventFor type helper in packages/runtime/src/define-agent.ts to fall back to AgentEvent when the event type O is a wide string. This ensures that handlers typed with AgentEvent remain assignable when a persona declares no concrete trigger literals. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
pr-reviewer could not complete review for #221 in AgentWorkforce/workforce. |
4 similar comments
|
pr-reviewer could not complete review for #221 in AgentWorkforce/workforce. |
|
pr-reviewer could not complete review for #221 in AgentWorkforce/workforce. |
|
pr-reviewer could not complete review for #221 in AgentWorkforce/workforce. |
|
pr-reviewer could not complete review for #221 in AgentWorkforce/workforce. |
The bug
v4.0.0 broke any persona that declares no concrete triggers/schedules (e.g. cloud-team member personas launched by a dispatcher).
defineAgent's narrowing collapsed their handlereventtoBaseAgentEvent<${string}.${string}>— narrower thanAgentEvent— so an(event: WorkforceEvent)handler no longer typechecks:Surfaced when verifying the agents codemod (AgentWorkforce/agents#56) against the published v4.0.0 (my pre-merge verification used an earlier runtime build that predated the
BaseAgentEventchange).The fix
ProviderEventForfalls back to the fullAgentEventwhen the triggeronunion is the widestring(nothing concrete declared), while still mapping declared literals toBaseAgentEvent<${P}.${O}>(incl. 2-segment types likeslack.app_mention). Restores pre-v4 behavior for trigger-less personas.Verification
Release
Needs a 4.0.1 patch publish. The agents repo already pins
^4.0.0, so it picks up 4.0.1 on install.🤖 Generated with Claude Code