fix(workflows): guard ctx.input arrays for 0.32 UI discovery - #59
Merged
Conversation
Smithers 0.32's gateway renders each workflow's <UI> at startup to discover its views, calling the component with an empty `ctx.input` (schema defaults are NOT applied during discovery). rig-sync and rig-loop both call an array method on an input field at module top — `ctx.input.units.filter(...)` and `ctx.input.built.join(...)` — so discovery throws `TypeError: undefined is not an object`, the UI fails to register, and the run's custom UI never renders in the monitor. Guard both with `?? []`, which restores exactly the schema's own `.default([])` during discovery and is a no-op at run time. Verified against a 0.32 gateway: the two "workflow UI discovery render failed" warnings are gone and both UIs register. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TMUG7KT32tVitdDTjjyrgE
`<Unit key={u.id} …>` is rendered in `work.map(...)`, but Unit is a plain
function component whose props type didn't declare `key`. Under the smithers
JSX types, `key` isn't auto-injected for function components (built-ins like
<Task>/<Sequence> carry it), so it was rejected as an excess prop — TS2322 at
the call site. Declaring `key?: string` on Unit's props keeps the list-identity
key and makes `typecheck smithers/` pass. Pre-existing failure on
feature/smithers, surfaced independently of the UI-discovery guard.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TMUG7KT32tVitdDTjjyrgE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Smithers 0.32's gateway renders each workflow's
<UI>at startup to discover its views, calling the component with an emptyctx.input— schema defaults are not applied during discovery. Bothrig-syncandrig-loopcall an array method on an input field at module top level:rig-sync.tsx—ctx.input.units.filter(...)rig-loop.tsx—ctx.input.built.join(...)So discovery throws
TypeError: undefined is not an object, the UI fails to register, and the run's custom UI never renders in the monitor //workflows.Fix
Guard both with
?? []. Since each field's schema already declares.default([]), this restores exactly the intended default during discovery and is a no-op at run time.Verification
Reproduced on a live 0.32.0 gateway (
smithers gateway): the startup log showed twoworkflow UI discovery render failedwarnings (workflow=rig-sync,workflow=rig-loop) with thectx.input.units.filter/ctx.input.built.joinstack traces. After the guard, restarting the gateway shows zero such warnings and both UIs register cleanly. Otherctx.input.*uses in these files are string interpolations (safe asundefined) or lazy lambdas (not evaluated at discovery), so these two lines are the only discovery-time crash sites.🤖 Generated with Claude Code
https://claude.ai/code/session_01TMUG7KT32tVitdDTjjyrgE