fix(hermes-bots): stop New Cronjob dialog crash when the owner is a roster object - #93572
Conversation
Overall: the right instinct — stop the crash at the New Cronjob dialog's
Minor: a small vitest case around |
…oster object
CreateRoutineDialog receives routineCreateTarget() output, which is an
owner OBJECT for roster-scoped bots; wrapping it in {name: bot} rendered
'[object Object]' and broke the meta lookup keyed by object. Resolve the
label through the object-aware botRosterMeta() path instead.
(Salvaged from #93572; the defensive coercion inside displayName was
dropped in favor of fixing the call site only.)
…oster object
CreateRoutineDialog receives routineCreateTarget() output, which is an
owner OBJECT for roster-scoped bots; wrapping it in {name: bot} rendered
'[object Object]' and broke the meta lookup keyed by object. Resolve the
label through the object-aware botRosterMeta() path instead.
(Salvaged from #93572; the defensive coercion inside displayName was
dropped in favor of fixing the call site only.)
|
Merged via #95018 (rebase-merge) — your call-site fix is on main as-authored: 9033545. Thanks @zhangfei1231231-sketch! Note on scope: we took the CreateRoutineDialog call-site half and dropped the defensive coercion inside |
…oster object
CreateRoutineDialog receives routineCreateTarget() output, which is an
owner OBJECT for roster-scoped bots; wrapping it in {name: bot} rendered
'[object Object]' and broke the meta lookup keyed by object. Resolve the
label through the object-aware botRosterMeta() path instead.
(Salvaged from NousResearch#93572; the defensive coercion inside displayName was
dropped in favor of fixing the call site only.)
Summary
Clicking "+ New Cronjob" in the Cronjobs pane crashes the whole routines pane into its error boundary:
The
botprop handed toCreateRoutineDialogis a roster-owner object:RoutinesPane.openCreate()stores the resolved owner fromresolveRoutineOwner(), which always returns an object. The "Send results to" option label then wraps it unconditionally:producing
{ name: <object> }, sodisplayName()calls(bot.name || '').trim()on an object and throws mid-render. The dialog header two lines above already normalizes correctly (typeof bot === 'string' ? { name: bot } : bot); this call site does not.Deterministic: any user opening the dialog with a valid roster owner repros it.
Fix
botRosterMeta(bot, ...)so meta lookup works for object owners too).displayName(): a non-stringbot.namedegrades to''instead of a render-time TypeError.Related
This line came in with the same #90006 merge wave that produced the
activeBotRoute()regression (#92830 / #92878 / fixes #92842, #92811); it is a residual from that refactor that survived the cleanup in #93125.Testing
routine-prompt.test.mjsare identical on an unmodified checkout (verified viagit stash) and untouched by this patch.