Skip to content

[Bug] ocx hub invite prints only "Minting a pairing code failed (rejected)" when corsAllowOrigins is missing or not yet loaded #8319

Closed

Description

@jayjay181818

Client or integration

Other

Area

CLI

Summary

On a fresh Hub, ocx hub invite --clients codex fails with only Minting a pairing code failed (rejected). It still fails after adding corsAllowOrigins, until the runtime is restarted. The message doesn't say which origin was rejected, which setting fixes it, or that a restart is needed.

Expected: the invite works from the Hub's own CLI, or the error names the rejected origin, the setting and the restart.

Reproduction

  1. On a fresh Hub (Windows, OpenCodex Desktop), run ocx hub invite --clients codex → Minting a pairing code failed (rejected).
  2. ocx config set corsAllowOrigins '["http://localhost:10100"]', invite again without restarting → same message.
  3. Restart OpenCodex Desktop, invite again → works.

Cause: the request is refused by the browser-origin check (isRemoteGuiBrowserOriginAllowed). corsAllowOrigins is only read at startup (and ocx config set reports success without saying a restart is needed), and the CLI prints only the reason code.

Suggested fix:

  • Have the local CLI use an origin the Hub always allows from loopback, or skip the browser-origin check for local CLI calls.
  • Print the rejected origin, the setting that fixes it, and whether a restart is needed.
  • More generally, have ocx config set print "saved; takes effect after restart" for keys that aren't live-reloaded.

Version

2.98.0

Operating system

Windows 11 Pro 10.0.26300

Provider and model

No response

Logs or error output

Minting a pairing code failed (rejected).

Screenshots and supporting files

No response

Redacted configuration

corsAllowOrigins = ["http://localhost:10100"] (only effective after restart)

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Nov 7, 2026
  2. coderabbitai commented on Nov 7, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #8079 - feat(client): relay the hub management plane for local callers [open]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  3. added
    cli
    on Nov 7, 2026
  4. Ingwannu commented on Nov 8, 2026

    @Ingwannu
    Owner

    Thanks, the mechanism is confirmed on origin/dev f8dfc2f:

    • ocx hub invite picks the bound browser origin from the config on disk (src/cli/hub.ts:107-115, used at :330).
    • The running runtime checks that origin against the config it loaded at startup. The pairing route passes that startup config to createGuiPairingGrant (src/server/index/serve-options.ts:734), which refuses any origin not in hub.managementPublicOrigin or corsAllowOrigins (src/server/gui-session.ts:110-116, :278-280). The 403 is mapped to rejected (src/cli/gui-pair-client.ts:161), and runInvite prints only the reason (src/cli/hub.ts:335).
    • ocx config set prints only Set <path>. (src/cli/config-command.ts:297). We found no runtime reload path for corsAllowOrigins, so the running runtime needs a restart to pick it up.

    Proposed small change (not implemented): on rejected, print the bound origin and a hint that a running runtime may predate corsAllowOrigins and must be restarted. Have config set print a restart note for keys that are read only at startup.

    Making the local invite bypass the origin check would be a design change. A hub admits no loopback origin by default (src/server/gui-session.ts:110-116), so we are not proposing it here.

  5. shu-chen-dot-ca commented on Nov 9, 2026

    @shu-chen-dot-ca
    Contributor

    I'll take this one and open a PR with the small change proposed above.

  6. added a commit that references this issue on Nov 10, 2026
    1d9bd73
  7. lidge-jun commented on Nov 10, 2026

    @lidge-jun
    Owner

    Fixed by #8495 (41536f6), merged into dev. A refused mint now names the bound origin, hub.managementPublicOrigin/corsAllowOrigins, and the restart command for this install. A 429 rate limit or any other refusal no longer points at the allow-list. ocx config set notes when corsAllowOrigins, hub, hub.managementPublicOrigin or hub.managementIngress need a restart. @shu-chen-dot-ca, thanks for offering to take this one. No PR had appeared after two days, so it was carried in an issue lane.

  8. added a commit that references this issue on Nov 10, 2026
    41536f6
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

    bugcli

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions