Skip to content

fix(agent-service, v1.3): send the delegate user's token on compile requests - #9268

Merged
mengw15 merged 1 commit into
release/v1.3from
backport/9079-send-the-delegate-user-s-token-on-compil-v1.3
Nov 2, 2026
Merged

mengw15 merged 1 commit into
release/v1.3from
backport/9079-send-the-delegate-user-s-token-on-compil-v1.3

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

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.

#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]>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Clean cherry-pick — nothing here was edited by hand. It applied to release/v1.3 without conflicts, and the backported tree built green before #9079 merged.

Close this PR and reopen it to start its required checks. This pull request was opened by github-actions[bot], and GitHub starts no workflow run for anything the Actions token does, so it has no checks yet. Reopening it (or pushing any commit to the branch) emits the event they subscribe to. Marking it ready for review will not — none of the three required workflows listen for that.

After that: approve, and enable auto-merge if you would rather not come back when the checks finish.

@mengw15 mengw15 closed this Nov 2, 2026
@mengw15 mengw15 reopened this Nov 2, 2026
@mengw15
mengw15 enabled auto-merge November 2, 2026 23:17
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @anthonychengit, @mengw15, @bobbai00
    You can notify them by mentioning @anthonychengit, @mengw15, @bobbai00 in a comment.

@codecov-commenter

codecov-commenter commented Nov 2, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.11%. Comparing base (eff3b05) to head (0fb2831).
✅ All tests successful. No failed tests found.

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           
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from eff3b05
agent-service 99.32% <100.00%> (+<0.01%) ⬆️
amber 90.12% <ø> (ø) Carriedforward from eff3b05
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from eff3b05
config-service 87.00% <ø> (ø) Carriedforward from eff3b05
file-service 87.75% <ø> (ø) Carriedforward from eff3b05
frontend 96.89% <ø> (ø) Carriedforward from eff3b05
notebook-migration-service 79.31% <ø> (ø) Carriedforward from eff3b05
pyamber 98.18% <ø> (ø) Carriedforward from eff3b05
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from eff3b05

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15
mengw15 added this pull request to the merge queue Nov 2, 2026
Merged via the queue into release/v1.3 with commit 29e6db3 Nov 2, 2026
24 checks passed
@mengw15
mengw15 deleted the backport/9079-send-the-delegate-user-s-token-on-compil-v1.3 branch November 2, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants