fix(agent-client): only fire change hook for fields that declare one#1762
Merged
nbouliol merged 3 commits intoJul 16, 2026
Merged
Conversation
Action form fields can declare a change hook; expose it on ForestSchemaAction.fields so clients can tell which fields trigger a change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
setFieldValue posted to /hooks/change for any field whenever the action had at least one change hook, without checking the changed field itself declared a hook. Filling a hookless field via the workflow executor thus sent changed_field for it, and forest_liana crashed evaluating hooks[:change][nil].call (NoMethodError, HTTP 500). The Ember UI only fires a change for fields declaring a hook. Gate loadChanges on the changed field's own hook, and thread the hook attribute through PlainField and the load fallback so it is reliably available. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Coverage Impact This PR will not change total coverage. Modified Files with Diff Coverage (1)
🛟 Help
|
matthv
approved these changes
Jul 16, 2026
forest-bot
added a commit
that referenced
this pull request
Jul 16, 2026
## @forestadmin/forestadmin-client [1.40.5](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/forestadmin-client@1.40.4...@forestadmin/forestadmin-client@1.40.5) (2026-07-16) ### Bug Fixes * **agent-client:** only fire change hook for fields that declare one ([#1762](#1762)) ([157a6f8](157a6f8))
forest-bot
added a commit
that referenced
this pull request
Jul 16, 2026
## @forestadmin/agent-client [1.10.2](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/agent-client@1.10.1...@forestadmin/agent-client@1.10.2) (2026-07-16) ### Bug Fixes * **agent-client:** only fire change hook for fields that declare one ([#1762](#1762)) ([157a6f8](157a6f8)) ### Dependencies * **@forestadmin/forestadmin-client:** upgraded to 1.40.5
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.

Problem
Running a smart action through the workflow executor (trigger-record-action, AI-assisted or Full AI) crashes against Ruby (
forest_liana) agents:getActionForm failed: Agent responded with HTTP 500, the agent raisingNoMethodError: undefined method 'call' for nil:NilClass. Manual form fill in the Ember UI works; Node agents tolerate it.Root cause
FieldFormStates.setFieldValueposted to/hooks/changefor any field as soon as the action declared at least one change hook, without checking the changed field had its ownhook.tryToSetFieldsiterates every AI-filled field, so setting a hookless field (e.g.code) sentchanged_fieldfor it; forest_liana then evaluatedaction.hooks[:change][nil].calland raised. The Ember UI only fires a change for fields that declare ahook.Fix
loadChangeson the changed field's ownhook, matching the admin UI.hookthroughPlainField,ForestSchemaAction.fields, and theloadInitialStatefallback mapping so it is reliably available (Node setschangeHookonly on watched fields; Ruby sets the hook name).Tests
field-form-statessuite green (20/20), incl. a new regression test: a hookless field does not trigger a change even when the action has change hooks.Fixes PRD-778
🤖 Generated with Claude Code
Note
Fix
setFieldValueto only fire change hook for fields that declare onePreviously,
FieldFormStates.setFieldValuetriggered a POST to/hooks/changebased on whetherhooks.changehad entries, regardless of whether the specific changed field declared a hook. Now it checksfield.getPlainField().hookand skips the request for fields without a hook.hook?: stringproperty toPlainFieldin types.ts andForestSchemaActionfields in forestadmin-client types.ts.loadInitialStateto forward thehookproperty when mapping fallback fields, so hook-based change behavior works correctly for those fields too.hookno longer trigger change hook requests even if the action hashooks.changedefined.Macroscope summarized a243be3.