Skip to content

feat(agent): add workflow executor proxy routes#293

Merged
matthv merged 4 commits into
mainfrom
feature/prd-228-workflow-executor-proxy-ruby-v2
Jun 8, 2026
Merged

feat(agent): add workflow executor proxy routes#293
matthv merged 4 commits into
mainfrom
feature/prd-228-workflow-executor-proxy-ruby-v2

Conversation

@matthv

@matthv matthv commented Apr 29, 2026

Copy link
Copy Markdown
Member

Add workflow executor proxy routes to forward workflow execution requests

  • Adds a new WorkflowExecutorProxy route class that registers two endpoints (GET /_internal/workflow-executions/:run_id and POST /_internal/workflow-executions/:run_id/trigger) when workflow_executor_url is configured.
  • Requests are forwarded to the external workflow executor via Faraday, with selective propagation of Authorization and Cookie headers, filtered query params, and JSON:API-aware body extraction.
  • Adds workflow_executor_url as a new configuration option (default nil) in forest_admin_rails.rb.
  • Faraday ConnectionFailed and TimeoutError are translated to 503 ServiceUnavailableError instead of leaking raw exceptions.
  • Behavioral Change: endpoints are only registered when workflow_executor_url is set; if unset, no routes are exposed.

Changes since #293 opened

  • Added timeout configuration to ForestAdminAgent::Routes::Workflow::WorkflowExecutorProxy with method-specific timeouts [64b3bdc]
  • Added test coverage for timeout configurations in ForestAdminAgent::Routes::Workflow::WorkflowExecutorProxy [64b3bdc]
  • Excluded ForestAdminAgent::Routes::Workflow::WorkflowExecutorProxy from RuboCop Metrics/ClassLength enforcement [64b3bdc]
  • Changed JWT token expiration calculation in ForestAdminAgent::Auth::OAuth2::ForestResourceOwner.expiration_in_seconds to add one hour before converting to integer rather than after, and updated the corresponding spec to compare the 'exp' field as an integer [3704192]

Macroscope summarized 0be6d8d.

@linear

linear Bot commented Apr 29, 2026

Copy link
Copy Markdown

@qltysh

qltysh Bot commented Apr 29, 2026

Copy link
Copy Markdown

3 new issues

Tool Category Rule Count
qlty Structure Function with high complexity (count = 8): forwarded_query_params 2
qlty Structure Function with many parameters (count = 4): forward 1

"#{EXECUTOR_PREFIX}/#{run_id}#{suffix}"
end

def forward(method, base_url, path, args)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with many parameters (count = 4): forward [qlty:function-parameters]

next if value.is_a?(Hash) || value.is_a?(Array) # 'data' body, etc.

acc[key.to_s] = value
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with high complexity (count = 8): forwarded_query_params [qlty:function-complexity]

FORWARDED_HEADERS.each_with_object({}) do |name, acc|
value = headers[name] || headers[name.downcase] || headers["HTTP_#{name.upcase}"]
acc[name] = value if value && !value.to_s.empty?
end

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function with high complexity (count = 5): forwarded_request_headers [qlty:function-complexity]

Faraday.new do |f|
f.request :json
f.response :json, content_type: /\bjson$/
f.adapter Faraday.default_adapter

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No timeout and open_timeout in the Faraday client ? (See https://lostisland.github.io/faraday/#/customization/request-options)
That depends ont the network layer between agent and executor, so exception might not be triggered.

matthv and others added 2 commits May 28, 2026 18:01
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Time.now.to_i + 1.hour returned an ActiveSupport::Duration, which serialized
the JWT exp claim as a string. Use (Time.now + 1.hour).to_i so exp is a proper
integer NumericDate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@christophebrun-forest christophebrun-forest left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok for me .
To test with orchestrator, the following two PRs must be merged for the executor:

@matthv matthv merged commit 7adf991 into main Jun 8, 2026
44 checks passed
@matthv matthv deleted the feature/prd-228-workflow-executor-proxy-ruby-v2 branch June 8, 2026 10:04
forest-bot added a commit that referenced this pull request Jun 8, 2026
# [1.31.0](v1.30.7...v1.31.0) (2026-06-08)

### Features

* **agent:** add workflow executor proxy routes ([#293](#293)) ([7adf991](7adf991))
@forest-bot

Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.31.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants