Repository navigation
fix(agent-service): send the delegate user's token on compile requests - #9079
Conversation
|
/request-review @bobbai00 |
The workflow-compiling-service /api/compile endpoint is JWT-protected (@RolesAllowed REGULAR/ADMIN behind JwtAuthFilter), but compileWorkflowAsync sent only Content-Type, so every compile returned 401 and the agent silently ran without operator schemas or compile errors. Thread delegateConfig.userToken into compileWorkflowAsync and send createAuthHeaders(token) when present. Closes apache#9078 Co-Authored-By: Claude Opus 5.5 <[email protected]>
a1c8aa9 to
3fbc9ec
Compare
Backport auto-label reportThis
|
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9079 +/- ##
============================================
+ Coverage 92.17% 92.27% +0.10%
Complexity 5043 5043
============================================
Files 1287 1287
Lines 55799 56423 +624
Branches 7144 7144
============================================
+ Hits 51434 52066 +632
+ Misses 2598 2593 -5
+ Partials 1767 1764 -3
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
The agent calls /api/compile without the user's login token, so every compile request gets a 401 and the agent quietly works without output schemas or compile errors. This PR sends the delegate user's token on that call, and v1.2 has the same unauthenticated call, so the agent there is just as blind to compile errors. @xuang7 and @mengw15, please review! |
The agent builds a plan for its per-step compile (WorkflowState.toLogicalPlan) and for its runs (executeOperatorAndFormat), and both send a link into the control-variable port, which is none of an operator's input ports, to data port 0. Main's apache#9079 made the agent's compile succeed, so the agent now gets compile errors and schemas for links the user never drew. These cases expect port -1, as the frontend sends it, and fail until both builders map it.
What changes were proposed in this PR?
compileWorkflowAsynccalled the JWT-protected/api/compile(@RolesAllowed(REGULAR, ADMIN)behindJwtAuthFilter, since #5199 / #5404) with onlyContent-Type, so every agent compile returned 401. The agent silently proceeded without operator output schemas or compile errors.api/compile-api.tstokenparam; sendscreateAuthHeaders(token)when present (no-token behavior unchanged)agent/texera-agent.tsprepareSteppassesthis.delegateConfig?.userTokenAudited the other agent-service HTTP calls: workflow persist/retrieve and execution already send the Bearer token;
/api/resources/operator-metadatais public. Compile was the only gap.Any related issues, documentation, discussions?
Closes #9078
How was this PR tested?
Regression tests written first (failed before the fix, pass after):
compile-api.spec.ts: sendsAuthorization: Bearer <token>when given; omits it for an empty token; against a mock that mirrorsJwtAuthFilter(401 without Bearer, 200 with), returnsnullwithout a token and the schemas with one.texera-agent.spec.ts: in delegate mode, every compile request carriesBearer <delegate token>.Verified end-to-end against a running cluster.
Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 5.5)
🤖 Generated with Claude Code