fix(argo-workflows): fix bug with apiTokens#1100
Conversation
* if there's an api token we need a Bearer with the token
📝 WalkthroughWalkthroughA helper function ChangesBearer Token Authentication Formatting
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_submitter.go (1)
21-26: ⚡ Quick win
argoBearerIfTokenis correct —AuthSupplierexpects the fullBearer <token>header value.The Argo Workflows v4 Go client passes the
AuthSupplier()return value directly into request authentication logic, which expects the complete Authorization header value. The old behavior (returning the raw token) was the bug; this fix is correct.Optional: If the input token could carry surrounding whitespace (e.g., from a config file or environment variable), apply
strings.TrimSpace()to prevent malformed header values:Optional hardening: guard against whitespace in the incoming token
func argoBearerIfToken(token string) string { + token = strings.TrimSpace(token) if token == "" { return "" } return "Bearer " + token }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_submitter.go` around lines 21 - 26, The current argoBearerIfToken function should return the full "Bearer <token>" string (AuthSupplier expects the complete header) and is correct; to harden it against tokens with surrounding whitespace, update argoBearerIfToken to trim the incoming token using strings.TrimSpace before checking emptiness and before concatenating so the returned value is "Bearer <trimmed-token>" when non-empty.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_submitter.go`:
- Around line 21-26: The current argoBearerIfToken function should return the
full "Bearer <token>" string (AuthSupplier expects the complete header) and is
correct; to harden it against tokens with surrounding whitespace, update
argoBearerIfToken to trim the incoming token using strings.TrimSpace before
checking emptiness and before concatenating so the returned value is "Bearer
<trimmed-token>" when non-empty.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 49332164-2b7a-424f-a117-ca50d873177d
📒 Files selected for processing (1)
apps/workspace-engine/pkg/jobagents/argoworkflows/workflow_submitter.go
Summary by CodeRabbit