Skip to content

feat: give each provider its real required headers (first-class, not host-templated)#2

Merged
FiscalMindset merged 1 commit into
mainfrom
feat/provider-extensibility
Jul 1, 2026
Merged

feat: give each provider its real required headers (first-class, not host-templated)#2
FiscalMindset merged 1 commit into
mainfrom
feat/provider-extensibility

Conversation

@FiscalMindset

@FiscalMindset FiscalMindset commented Jul 1, 2026

Copy link
Copy Markdown
Owner

What & why

Follow-up to the integration-stack work. Decision: keep the provider set closed and curated — no generic passthrough, and no generic-feeling entries.

Searching the codebase confirmed there was no generic passthrough to remove. The real weakness was that the Bearer providers were just {host + secret} — identical except for hostname, which reads generic even though it isn't. This PR makes each provider genuinely first-class: it now carries the provider's real required headers, so the integration knows the API's quirks and the agent doesn't have to.

Changes

  • providers.ts — add defaultHeaders per provider:
    • GitHub: User-Agent (GitHub 403s without it), Accept: application/vnd.github+json, X-GitHub-Api-Version
    • Anthropic: anthropic-version (required by the raw REST API)
    • Stripe: Stripe-Version (pins API behaviour)
    • Slack / SendGrid: correct Content-Type
  • proxy.ts — inject defaultHeaders only when the agent didn't set them (agent can still override).
  • integration-stack.md — document the closed/curated stance + the required-headers table.

Proof (live, real enclave)

GitHub with no User-Agent from the agent — the integration supplies GitHub's mandatory headers:

RESOLVE /github/user {"accept":"application/vnd.github+json","x-github-api-version":"2022-11-28","user-agent":"blindfold"}
GITHUB-no-UA 200 FiscalMindset

(Without the injected headers GitHub returns 403.) Stripe still 200 with the pinned version:

STRIPE 200 balance livemode=false

Notes

  • Backward compatible — headers are additive and only applied when absent.
  • No secrets committed.

Summary by cubic

Make each provider first-class by adding its required default headers and injecting them when missing, so the integration handles API quirks and agents don’t. Documents the closed, curated provider stance.

  • New Features
    • Added defaultHeaders per provider: GitHub (User-Agent, Accept, X-GitHub-Api-Version), Anthropic (anthropic-version), Stripe (Stripe-Version), Slack/SendGrid (Content-Type).
    • Updated proxy to inject these headers only if the agent didn’t set them (agent can override).
    • Expanded docs with the curated-provider stance and a required-headers table.

Written for commit 60f80be. Summary will update on new commits.

Review in cubic

…host-templated)

The Bearer providers differed only by hostname, which reads as generic even
though there's no passthrough. Make each a genuine integration: it now carries
the provider's real required headers, injected only when the agent didn't set
them, so the agent needn't know each API's quirks.

- providers.ts: add defaultHeaders per provider
  - GitHub: User-Agent (GitHub 403s without it) + Accept + X-GitHub-Api-Version
  - Anthropic: anthropic-version (required by the raw REST API)
  - Stripe: Stripe-Version (pins API behaviour)
  - Slack / SendGrid: correct Content-Type
- proxy.ts: inject defaultHeaders when absent (agent can still override)
- integration-stack.md: document the closed/curated stance + required headers

Proven live: GET /github/user through the proxy with NO User-Agent from the
agent returns 200 — the integration supplies GitHub's mandatory headers.
Stripe still 200 with the pinned version.
@FiscalMindset FiscalMindset merged commit af73603 into main Jul 1, 2026
3 checks passed
@FiscalMindset FiscalMindset deleted the feat/provider-extensibility branch July 1, 2026 15:19

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants