Skip to content

Managed egress sends no User-Agent, so GitHub API returns 403 for all connection requests #636

Description

@UtpalJayNadiger

Versions: @opencomputer/cli 0.5.1, @opencomputer/agent 0.4.1.

A connection declared per the secrets docs:

const github = defineConnection({
  id: "github-api",
  origin: "https://api.github.com",
  methods: ["GET"],
  pathPrefix: "/repos/",
  headers: {
    Authorization: bearer(useSecret("GITHUB_TOKEN")),
    Accept: "application/vnd.github+json",
  },
});

Every github.fetch("/repos/...") from a tool returns 403 even with a valid token (the same token + path returns 200 via curl locally). GitHub rejects any request without a User-Agent header with 403, and the managed egress apparently forwards none.

Workaround

Adding a static header to the connection fixes it:

"User-Agent": "opencomputer-sdk-watcher",

Suggestion

Have the egress send a default User-Agent (e.g. opencomputer-egress/<version>) when the connection doesn't declare one — a missing UA yields confusing 403s that look like auth/permission failures, and GitHub is about as common a first target as it gets. Worth a note in the secrets/connections docs either way.

🤖 Filed with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions