Repository navigation
fix(cli): explain a rejected hub invite and startup-only config keys #8495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1d9bd73
b37acb3
4787e94
6499411
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,7 @@ import { | |
| type GuiPairRequestResult, | ||
| } from "./gui-pair-client"; | ||
| import type { RuntimeApiDeps } from "./runtime-api"; | ||
| import { HUB_DISABLE_USAGE, runHubDisable, type HubDisableDeps } from "./hub-disable"; | ||
| import { HUB_DISABLE_USAGE, hubDisableRestartHint, runHubDisable, type HubDisableDeps } from "./hub-disable"; | ||
|
|
||
| export const HUB_USAGE = | ||
| "ocx hub invite [--json] [--data-url <origin>] [--management-url <origin>] [--clients codex,claude]\n " + HUB_DISABLE_USAGE; | ||
|
|
@@ -32,6 +32,8 @@ export interface HubCommandDeps extends RuntimeApiDeps, HubDisableDeps { | |
| browserOrigin: string, | ||
| deps?: GuiPairClientDeps, | ||
| ) => Promise<GuiPairRequestResult>; | ||
| /** Supervisor-aware "Restart to apply: …" line; injected so tests do not probe the machine. */ | ||
| restartHint?: () => string; | ||
| } | ||
|
|
||
| export interface HubInviteOptions { | ||
|
|
@@ -333,6 +335,21 @@ async function runInvite(args: string[], deps: HubCommandDeps): Promise<number> | |
| }); | ||
| if (result.kind !== "created") { | ||
| console.error(`Minting a pairing code failed (${result.reason}).`); | ||
| if (result.reason === "origin-refused") { | ||
| // #8319: the CLI picks the origin from the config on disk, but the running hub checks it | ||
| // against the config it is running with, so an allow-list edited since then can be refused | ||
| // until a restart. The reason code alone did not say which origin, setting, or step. | ||
| console.error( | ||
| `The running hub refused to mint a code bound to browser origin ${browserOrigin}. It admits only ` | ||
| + "hub.managementPublicOrigin and the corsAllowOrigins entries it is running with, which can predate " | ||
| + "a recent 'ocx config set'. If you changed either, restart the hub and invite again.", | ||
| ); | ||
| console.error((deps.restartHint ?? hubDisableRestartHint)()); | ||
|
Comment on lines
+343
to
+347
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| } else if (result.reason === "rate-limited") { | ||
| // The 429 covers both the per-minute grant limit and the cap on unused codes, which only | ||
| // clears as earlier codes are used or expire (five minutes), so the advice fits both. | ||
| console.error("The hub is limiting new pairing codes (a per-minute limit and a cap on unused codes). Wait for earlier codes to be used or expire, then invite again."); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include the one-minute wait in the rate-limit guidance. If eight codes are created and used within one minute, the next invite is still rate-limited. Tell users to wait at least one minute before retrying and, if the unused-code cap applies, to also wait for earlier codes to be used or expire. Add an assertion for both instructions in
|
||
| } | ||
|
Comment on lines
+348
to
+352
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The rate-limit message is inaccurate when the 128-outstanding-grant cap triggers the 429.
Use wording that fits both causes. For example: "The hub is limiting new pairing codes (a per-minute limit and a cap on unused codes). Wait for earlier codes to expire, then invite again." Update the docs line in Proposed fix
|
||
| return 1; | ||
| } | ||
| const payload: HubInvitePayload = { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.