feat: Add deploy policy endpoint and deploy flows action - #406
Conversation
andypalmi
left a comment
There was a problem hiding this comment.
Looks good to me, I only have a question but otherwise we can merge it
| */ | ||
| async handleGetDeployPolicyRequest (req, res) { | ||
| if (!this.isInitialized || this.isLoading) { | ||
| return res.status(503).send('Expert is not ready') |
There was a problem hiding this comment.
Why expert? Should we say assistant?
|
One finding from testing: |
Addressed in bbe95d0 (with tests)) |
|
@andypalmi would appreciate a pull and retest please |
|
Pulled and re-reviewed bbe95d0. The wait-on-deploy approach is right and I verified it against deploy.js: One edge remains: |
|
@andypalmi should be covered now (see 483d614) |
|
@andypalmi reduced timeout to 8s as discussed |
|
Follow-up on the 15s wait: the transports dispatching these actions give up sooner, so the graceful timeout response cannot reach the agent.
|
|
sometime deploy (especially on large flows / full deploy and especially where nodes either misbehave or teardown/rebuild external connections) can easily take more than 4 sec :( Will need to think this over. |
|
We could increase browser timeout to 10 seconds in flowfuse and also increase it to 15 in gateway |
|
On second thought: instead of setting error the error message and the guidance for the agent, can we return a error code and handle the message returned in the MCP tool based on the error? This gives us deploy logic in nr-assistant with the flexibility of changing the error message regardless of the installed version if we ever change tool names or flag location in the UI |
Can you give me some detail of what you would expect here - same me time inventing something you were not intending? Ta son ;) |
Description
Summary
Adds a
deploy_flowsautomation action so an agent can deploy the flow changes it just made, instead of leaving them staged. It checks the team'sagentAutoDeploysetting live, at the moment of the deploy attempt, and no-ops safely (with a clear message) rather than deploying when the setting is off.Changes
lib/assistant.js: newGET /nr-assistant/deploy-policyroute andhandleGetDeployPolicyRequesthandler. Relays the live check to forge's/api/v1/assistant/deploy-policyusing the existinggot/token pattern, and fails safe toautoDeploy: falseon any error.resources/expertAutomations.js: newDEPLOY_FLOWS(automation/deploy-flows) action, following the same shape asSET_DEPLOY_MODE. Its dispatch case calls the new local proxy route, then either invokescore:deploy-flowsor returnsdeployed: falsewith a message that explicitly tells the model to callui_navigate(routeteam-settings-danger) rather than just describing the setting in prose.test/unit/resources/expertAutomations.test.js: addautomation/deploy-flowsto thesupportedActionskey-list test.Testing
Tested end to end against a live instance with the setting both on and off, and over both the embedded Expert chat and a third-party MCP client (Claude). Unit test updated for the new action's presence; the action's actual dispatch behavior isn't independently unit-tested here, matching the existing coverage level for
SET_DEPLOY_MODEand its siblings.Notes
The corresponding forge-side setting and policy endpoint, and the
deploy_flowsMCP tool that exposes this action to a model need to ship alongside this inflowfuseand a separate Flow Builder MCP tool surface respectively. This PR is the nr-assistant half: the local policy proxy and the actual deploy action.Can/should be merged (and released) before FlowFuse PR is merged
Related Issue(s)
closes #405
Checklist
flowforge.yml?FlowFuse/helmto update ConfigMap TemplateFlowFuse/CloudProjectto update values for Staging/ProductionLabels
area:migrationlabel