Skip to content

Send the gateway port token (fixes 404 'The request could not be routed') - #169

Open
lamazzing wants to merge 1 commit into
ScriptedAlchemy:mainfrom
lamazzing:fix/gateway-port-token
Open

lamazzing wants to merge 1 commit into
ScriptedAlchemy:mainfrom
lamazzing:fix/gateway-port-token

Conversation

@lamazzing

Copy link
Copy Markdown

Since mid-November 2026, every gateway call (bots list, thread, ...) fails with listAgents failed: 404 The request could not be routed. The load balancer in front of the box now requires the x-anyrun-port-token header.

EnsureSandBox already returns that token as gatewayPortToken, and the Grok Bot app (1.1.0) sends it on every gateway request. This PR adds it to the headers derived from EnsureSandBox (headersFromEnsureSandbox), next to the network token.

  • The token is only sent to the allowlisted gateway URL, and it is never logged or stored.
  • Tests: new cases in test/gateway.test.js. npm test passes (510).
  • Verified live against Grok Bot 1.1.0: gbot bots list works again without any local patch.

🤖 Generated with Claude Code

Since mid-November 2026 the box's load balancer answers every gateway call
with 404 "The request could not be routed" unless it carries
x-anyrun-port-token. EnsureSandBox returns the token as gatewayPortToken and
the Grok Bot app (1.1) sends it on every gateway request; the CLI now adds it
to the EnsureSandBox-derived gateway headers. The token only goes to the
allowlisted gateway URL and is never logged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@changeset-bot

changeset-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 86046d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
grok-bot-cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@clement006

Copy link
Copy Markdown

Independently verified this fix against Grok Bot 1.3.0 on macOS, using Node.js 24.22.1. This also reproduces and resolves #171 in that environment.

The stock npm 0.12.5 CLI fails on gbot bots list with 404 The request could not be routed; this PR's exact commit (86046d296149f3fad7290d49c2e71f5fbc949595) lists the roster successfully using the same signed-in desktop session, both via the committed executable and after a fresh local build.

npm run check passes: validation, build, artifact validation, typecheck, 510 unit tests and 97 route tests. Live verification was read-only; no send/create/update commands were used.

The original commit and authorship are preserved unchanged on https://github.com/clement006/grok-bot-cli/tree/fix/gateway-port-token while awaiting an upstream release. Thanks for the fix.

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