Repository navigation
fix(agent-service, v1.3): send the delegate user's token on compile requests - #9268
Conversation
#9079) ### What changes were proposed in this PR? `compileWorkflowAsync` called the JWT-protected `/api/compile` (`@RolesAllowed(REGULAR, ADMIN)` behind `JwtAuthFilter`, since #5199 / #5404) with only `Content-Type`, so every agent compile returned 401. The agent silently proceeded without operator output schemas or compile errors. ``` Before: prepareStep -> POST /api/compile (no Authorization) -> 401 -> null After: prepareStep -> POST /api/compile (Bearer <delegate token>) -> 200 -> schemas + operatorErrors ``` | File | Change | | --- | --- | | `api/compile-api.ts` | optional `token` param; sends `createAuthHeaders(token)` when present (no-token behavior unchanged) | | `agent/texera-agent.ts` | `prepareStep` passes `this.delegateConfig?.userToken` | Audited the other agent-service HTTP calls: workflow persist/retrieve and execution already send the Bearer token; `/api/resources/operator-metadata` is 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`: sends `Authorization: Bearer <token>` when given; omits it for an empty token; against a mock that mirrors `JwtAuthFilter` (401 without Bearer, 200 with), returns `null` without a token and the schemas with one. - `texera-agent.spec.ts`: in delegate mode, every compile request carries `Bearer <delegate token>`. ``` cd agent-service bun test # 314 pass, 0 fail (19 files) bun run typecheck # tsc --noEmit, exit 0 bun run format:check # All matched files use Prettier code style! ``` 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](https://claude.com/claude-code) (backported from commit 07fffb3) Co-authored-by: Claude Opus 5.5 <[email protected]>
|
Clean cherry-pick — nothing here was edited by hand. It applied to Close this PR and reopen it to start its required checks. This pull request was opened by After that: approve, and enable auto-merge if you would rather not come back when the checks finish. |
Automated Reviewer SuggestionsBased on the
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release/v1.3 #9268 +/- ##
===============================================
Coverage 94.11% 94.11%
Complexity 4811 4811
===============================================
Files 1194 1194
Lines 48657 48661 +4
Branches 5868 5868
===============================================
+ Hits 45792 45796 +4
Misses 1410 1410
Partials 1455 1455
*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:
|
What changes were proposed in this PR?
Automated backport of #9079 to
release/v1.3.Source: 07fffb3 · automation run
Any related issues, documentation, discussions?
Backport of #9079. Originally linked #9078.
How was this PR tested?
The backported tree built green before #9079 merged. Release-branch CI runs on this PR once it is reopened — see the comment below.
Was this PR authored or co-authored using generative AI tooling?
No.