fix(frontend): seed parameter defaults for custom URL workflows#4440
Conversation
Custom URL workflows (those with a service URL but no agenta URI) had
two issues that made the playground config form render empty even when
their /openapi.json defined parameter defaults.
First, the openapi fallback in workflowEntityAtomFamily resolved the
parameter SCHEMA from appSchemas.parameters but never seeded initial
parameter VALUES. The form iterates parameter values, not schema
properties, so an empty values dict produces an empty form regardless
of how complete the schema is. The fix extracts defaults from the
schema via extractDefaultsFromSchema (hoisted out of createFromTemplate
and re-exported from the workflow api barrel) and assigns them to
resolvedParams. This mirrors the catalog template path, which already
fills parameters from schema defaults at create time. The merge guard
is hardened to also treat an empty object as 'no stored params', so
the seeding still applies if any future code path stores {} instead of
leaving parameters undefined.
Second, configurationSelectorAtomFamily and configurationAtomFamily
read from workflowBaseEntityAtomFamily, which deliberately skips the
inspect/openapi schema-resolution layer. That meant the form's values
selector never saw the seeded defaults even after the fix above. Both
selectors now read from workflowEntityAtomFamily (the merged atom).
All 17 callers are in playground or execution contexts where the
merged atom is already in the dependency graph, so the swap adds no
new schema-fetch subscriptions in practice. isDirty intentionally
still reads from the base atom and is unaffected.
The seeded defaults live only in the merged atom in memory and are
not persisted. On every playground open before the first save, the
form re-renders with the openapi defaults. The first save commits
them as a real revision; from then on the merge guard sees stored
parameters and the seeding is a no-op.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR extends workflow configuration to populate parameter defaults from JSON Schema definitions. A utility function is exported, integrated into the workflow entity store to lazily seed missing parameters from OpenAPI schemas, and exposed through Jotai atoms so configuration forms receive the merged defaults. ChangesSchema defaults integration
🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Railway Preview Environment
Updated at 2026-05-27T08:04:21.277Z |
584ff4b
into
feat/trace-observability-batch
Summary
Custom URL workflows (those with a service URL but no agenta URI) had two issues that made the playground config form render empty even when their
/openapi.jsondefined parameter defaults.workflowEntityAtomFamilyresolved the parameter schema but never seeded initial parameter values. The form iterates values, not schema properties, so the form rendered empty. The fix extracts defaults from the schema viaextractDefaultsFromSchema(hoisted out ofcreateFromTemplate.tsand re-exported from the workflow api barrel) and assigns them toresolvedParams. This mirrors the catalog template path, which already fillsparametersfrom schema defaults at create time.configurationSelectorAtomFamilyandconfigurationAtomFamilyread fromworkflowBaseEntityAtomFamily, which deliberately skips the inspect/openapi schema-resolution layer. That meant the form's values selector never saw the seeded defaults. Both selectors now read from the mergedworkflowEntityAtomFamily. All 17 callers are in playground or execution contexts where the merged atom is already in the dependency graph, so the swap adds no new schema-fetch subscriptions in practice.isDirtyintentionally still reads from the base atom and is unaffected.The merge guard is hardened to treat an empty object the same as "no stored params", so the seeding still applies if any future code path stores
{}instead of leavingparametersundefined.Lifecycle (documented in the seeding block)
The seeded defaults live only in the merged atom in memory. They are not persisted. On every playground open before the first save, the form re-renders with the openapi defaults. The first save commits them as a real revision; from then on the merge guard sees stored parameters and the seeding becomes a no-op, so subsequent opens read the saved values directly. This mirrors the catalog template behavior except that for custom URL apps we do it lazily on first open instead of eagerly at create time.
Files
web/packages/agenta-entities/src/workflow/api/createFromTemplate.ts— exportextractDefaultsFromSchema; update docstringweb/packages/agenta-entities/src/workflow/api/index.ts— re-exportextractDefaultsFromSchemafrom the workflow api barrelweb/packages/agenta-entities/src/workflow/state/store.ts— seedresolvedParamsfrom openapi defaults; harden the merge guard; document lifecycleweb/packages/agenta-entities/src/workflow/state/molecule.ts— switchconfigurationSelectorAtomFamilyto read from the merged entity atomweb/packages/agenta-entities/src/workflow/state/runnableSetup.ts— same switch forconfigurationAtomFamilyTest plan
pnpm lint-fixinweb/(passes on this branch)/openapi.jsondefinesag_config.properties.<key>.defaultdata.parameters