fix(agent-client): attach role_ids_allowed_to_approve to approval requests [PRD-688]#1722
Closed
Scra3 wants to merge 1 commit into
Closed
Conversation
…approval request Forest's POST /api/action-approvals expects `role_ids_allowed_to_approve` (the browser engine always sends it). Without it the created approval is malformed and shows no attached resource/record. agent-client already extracts `roleIdsAllowedToApprove` from the 403 CustomActionRequiresApprovalError but threw it away — forward it to createApprovalRequest and include it in the payload. Fixes approvals filed by the MCP server and the workflow executor (both go through this agent-client path). Refs PRD-688 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Member
Author
|
Closing: verified in the Forest server that it computes |
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
Approvals filed programmatically (MCP server
executeAction, and the workflow executor) show up in Forest without an attached resource — the created approval is malformed.Root cause
The Forest server's
POST /api/action-approvalsexpectsrole_ids_allowed_to_approvein the payload — the browser engine always sends it (store.createRecord('action-approval', { …, roleIdsAllowedToApprove })). The agent-client already extractsroleIdsAllowedToApprovefrom the403 CustomActionRequiresApprovalError(domains/action.tstoActionError) but discarded it instead of forwarding it tocreateApprovalRequest. The resulting payload was missing that field.Fix
ApprovalRequestPayloadgainsroleIdsAllowedToApprove?.makeCreateApprovalRequestsendsrole_ids_allowed_to_approvein the JSON:API attributes (alongsiderecord_ids/collection_name/inputs), matching the browser-engine payload.Action.execute()forwards the value it already has from the mappedActionRequiresApprovalError.This is the only field that differed from the working browser-engine payload (verified against
forestadminaction-approvalmodel +custom-actionservice).record_idswas already correct (Collection.actionserializes ids viaserializeRecordId).Notes
mainonce feat(workflow-executor): approval requests on Full AI / Automatic trigger actions [PRD-688] #1720 merges.Tests: agent-client (340) + mcp-server (547) pass; build + lint clean.
Refs PRD-688
🤖 Generated with Claude Code
Note
Attach
role_ids_allowed_to_approveto approval request payloads in agent-clientAdds the optional
roleIdsAllowedToApprovefield toApprovalRequestPayloadin approval-request-creator.ts and maps it torole_ids_allowed_to_approvein the POST body sent to/api/action-approvals. TheAction.executemethod in action.ts now forwards this field when constructing the approval request.Macroscope summarized afa0ce1.