fix: AUTH_HEADER abstraction so create-artist + short-video work for both BYOA and sandbox personas (1/3)#29
fix: AUTH_HEADER abstraction so create-artist + short-video work for both BYOA and sandbox personas (1/3)#29sidneyswift wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughBoth ChangesUnified authentication pattern across skill workflows
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@skills/chart-metric/README.md`:
- Line 18: The header "Vercel skills CLI (works in 18+ agents)" is ambiguous;
update the parenthetical after the header text to a clear phrase that matches
the intent: if you mean compatibility with multiple platforms change it to
"compatible with 18+ AI agent platforms", or if you mean a minimum version
requirement change it to "requires agents v18+"; edit the README header line
that currently contains "works in 18+ agents" to one of those clearer
alternatives (or an equivalent explicit phrase) so readers know whether this is
a platform count or a version requirement.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ba49aa11-689f-41a2-8c9e-1129ca895e59
📒 Files selected for processing (4)
skills/chart-metric/README.mdskills/create-artist/SKILL.mdskills/getting-started/SKILL.mdskills/short-video/SKILL.md
a58fd50 to
d7d5975
Compare
d7d5975 to
98c6646
Compare
…both BYOA and sandbox personas
Two skills on main hardcode a single auth header, breaking one customer persona each:
- create-artist hardcoded `Authorization: Bearer $RECOUP_ACCESS_TOKEN` (sandbox-only).
BYOA users (with $RECOUP_API_KEY only) hit 401 on every step of the 8-call chain.
- short-video hardcoded `x-api-key: $RECOUP_API_KEY` (BYOA-only). Sandbox users
(with $RECOUP_ACCESS_TOKEN only) hit 401 on every step.
Each skill works for half the customers.
Recoup's API supports both auth headers on the same endpoints. Docs (the developers.recoupable.com llms.txt index) explicitly say "x-api-key or Authorization Bearer token" for nearly every endpoint, including the ones these skills hit. The fix is a small AUTH_HEADER block at the top of each skill that picks the right header based on whichever env var is set:
if [ -n "$RECOUP_ACCESS_TOKEN" ]; then
AUTH_HEADER="Authorization: Bearer $RECOUP_ACCESS_TOKEN"
elif [ -n "$RECOUP_API_KEY" ]; then
AUTH_HEADER="x-api-key: $RECOUP_API_KEY"
else
echo "No Recoup auth found. Run /getting-started first."; exit 1
fi
Then every curl uses `-H "$AUTH_HEADER"` instead of hardcoding one or the other.
Verified end-to-end against the production API:
- BYOA (x-api-key) on POST /api/artists (create-artist): HTTP 201, artist created and deleted
- BYOA (x-api-key) on GET /api/organizations, /api/content/templates, /api/tasks/runs (short-video): all HTTP 200 / non-401
- AUTH_HEADER block resolves correctly in both directions (Bearer when only RECOUP_ACCESS_TOKEN set, x-api-key when only RECOUP_API_KEY set)
Sandbox (Bearer) path on these specific endpoints not live-tested (would need a real Privy access token from a sandbox session). However: the API endpoints already accept Bearer auth in other skills on main, and the AUTH_HEADER block is symmetric.
Co-authored-by: Cursor <cursoragent@cursor.com>
98c6646 to
10fccbd
Compare
The problem
Two skills on main hardcode a single auth header, breaking one customer persona each.
Recoup customers run agents two ways:
Authorization: Bearer $RECOUP_ACCESS_TOKENx-api-key: $RECOUP_API_KEYBoth authenticate to the same endpoints (verified — the docs explicitly say "x-api-key or Authorization Bearer token" for nearly every endpoint).
create-artistAuthorization: Bearer $RECOUP_ACCESS_TOKENAuthorization: Bearer(empty token) → HTTP 401 on every step of the 8-call chainshort-videox-api-key: $RECOUP_API_KEYx-api-key:(empty value) → HTTP 401 on every stepEach skill works for half the customers.
The fix
Set
AUTH_HEADERonce at the top of each skill from whichever env var is set:Then every curl uses
-H "$AUTH_HEADER"instead of hardcoding one or the other.The error message is self-contained — no assumption about another skill being installed, no agent-runtime-specific slash-command syntax. Tells the user exactly what to set + where to get a key.
Files (2)
skills/create-artist/SKILL.md— single AUTH_HEADER block at top + 14 curl headers swapped to-H "$AUTH_HEADER"skills/short-video/SKILL.md— single AUTH_HEADER block in## Setup(top of file) + 11 curl headers swapped + Prerequisites section references the Setup block via anchor link (no duplication)2 files, +53 / -32. Same 8-line AUTH_HEADER block in each file.
Verification (live, against prod API)
POST /api/artists(create-artist's first call)GET /api/organizations(used in short-video)GET /api/content/templates(short-video manual recipe)GET /api/tasks/runs(short-video async polling)Not foundfor a fake runId — not 401, so auth was accepted) ✓Sandbox (Bearer) path on these specific endpoints not live-tested — would need a Privy access token from a real chat.recoupable.com session (no programmatic way to get one — checked the CLI, the docs, and open-agents). The AUTH_HEADER block is symmetric and Bearer auth is already in production via main's
create-artist, so the failure surface is just the bash conditional (verified working).What this PR is not
feat/orchestratorpreserved.recoup research "Drake"example ingetting-startedand thechart-metricinstall command fix are deferred (the chart-metric fix waits for feat(marketplace): add unified marketplace machinery (2/3) #25 to land anyway).This PR does one thing: makes
create-artistandshort-videowork for both customer personas.Merge order
PR 1 of 3. Smallest. Independent of #25 and #27 — can merge anytime.
Merge preference
Please merge yourself when satisfied — I'd rather you push the button than approve.
🤖 Made with Cursor