Skip to content

fix: Gateway Mode clientId and executePlan endpoint issues (v2.1.2)#43

Merged
saurabhjain1592 merged 1 commit into
mainfrom
fix/gateway-mode-client-id-and-execute-plan
Jan 7, 2026
Merged

fix: Gateway Mode clientId and executePlan endpoint issues (v2.1.2)#43
saurabhjain1592 merged 1 commit into
mainfrom
fix/gateway-mode-client-id-and-execute-plan

Conversation

@saurabhjain1592

Copy link
Copy Markdown
Member

Summary

  • Fixed getPolicyApprovedContext() to auto-populate client_id in request body from config
  • Fixed executePlan() to use correct /api/request endpoint instead of non-existent orchestrator endpoint

Issues Fixed

1. Gateway Mode clientId not sent in request body

  • Server requires client_id in JSON body for /api/policy/pre-check endpoint
  • SDK was only sending it as header (X-Client-ID, X-Tenant-ID)
  • This caused "client_id field is required" errors for all Gateway Mode pre-check calls
  • Fix: Auto-populate clientId in request body from config when not explicitly provided (matches Go SDK behavior)

2. executePlan() using non-existent endpoint

  • SDK was calling /api/v1/orchestrator/plan/{planId}/execute which returns 404
  • Fix: Changed to use /api/request with request_type: "execute-plan" (matches Go SDK)
  • This fixes MAP (Multi-Agent Planning) two-step execution flow

Test plan

  • All 80 unit tests pass
  • Added 2 new tests for clientId auto-populate behavior
  • Updated executePlan test to verify new endpoint format
  • Verified with live examples (PII, SQLi, MAP, Execution Replay) - all pass

## Issues Fixed

1. **Gateway Mode clientId not sent in request body**
   - `getPolicyApprovedContext()` now auto-populates `client_id` in request body from config
   - Server requires `client_id` in JSON body for `/api/policy/pre-check` endpoint
   - Previously only sent as header (X-Client-ID), causing "client_id field is required" errors
   - Now matches Go SDK behavior

2. **executePlan() using non-existent endpoint**
   - Changed from `/api/v1/orchestrator/plan/{planId}/execute` (404)
   - Now uses `/api/request` with `request_type: "execute-plan"`
   - Matches Go SDK pattern for plan execution
   - Fixes MAP (Multi-Agent Planning) two-step execution

## Testing
- All 80 unit tests pass
- Fixed potential NPE in context null check
- Verified with live examples (PII, SQLi, MAP, Execution Replay)
@saurabhjain1592 saurabhjain1592 force-pushed the fix/gateway-mode-client-id-and-execute-plan branch from b02059c to bbec0a8 Compare January 7, 2026 17:36
@saurabhjain1592 saurabhjain1592 merged commit 8003c9e into main Jan 7, 2026
9 checks passed
@saurabhjain1592 saurabhjain1592 deleted the fix/gateway-mode-client-id-and-execute-plan branch January 11, 2026 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant