The GitHub Actions job "Backport Checks" on 
texera.git/backport/9079-send-the-delegate-user-s-token-on-compil-v1.3 has 
failed.
Run started by GitHub user github-actions[bot] (triggered by 
github-actions[bot]).

Head commit for run:
0fb283125c610d0230c6f2e7758aa441eac50c73 / Suryaa Charan 
<[email protected]>
fix(agent-service): send the delegate user's token on compile requests (#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 07fffb3d5cc1a114052484019b068d2e73a4c587)

Co-authored-by: Claude Opus 5.5 <[email protected]>

Report URL: https://github.com/apache/texera/actions/runs/41543898321

With regards,
GitHub Actions via GitBox

Reply via email to