Skip to content

fix(prompt): api.blockrun.ai is not an alias of the Base gateway - #168

Merged
VickyXAI merged 1 commit into
mainfrom
fix/gateway-host-per-pay-mode
Sep 5, 2026
Merged

fix(prompt): api.blockrun.ai is not an alias of the Base gateway#168
VickyXAI merged 1 commit into
mainfrom
fix/gateway-host-per-pay-mode

Conversation

@VickyXAI

@VickyXAI VickyXAI commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

The gateway section handed the model this:

- Base chain: `https://blockrun.ai/api` (alias: `https://api.blockrun.ai`)

Those are different services:

host auth on a paid call
api.blockrun.ai bearer key 401 without one
blockrun.ai/api x402 (Base wallet) 402 challenge, ignores a key
sol.blockrun.ai/api x402 (Solana wallet) 402 challenge, ignores a key

Told they are aliases, the model can send a wallet-signed request to a host that cannot settle it, or a key to a host that cannot read it — and the failure reads like a gateway bug rather than a routing mistake.

The section was also unconditional, so it never said which host this session is on. Now it names one:

[key]     Your host: https://api.blockrun.ai — the account API. SEPARATE service, not an alias of the Base gateway.
[solana]  Your host: https://sol.blockrun.ai/api — the Solana x402 wallet gateway.
[base]    Your host: https://blockrun.ai/api — the Base x402 wallet gateway.

…plus which hosts are not yours and why, and an instruction never to switch billing modes to work around an API error.

Found while auditing it: assembleInstructions' cache key carried the pay mode but not the chain. Both the gateway host and the wallet guidance name the active chain, so a basesolana switch inside one process was served the previous chain's instructions.

Request routing itself was already correct — no caller bypasses gatewayBase(), no hardcoded gateway hosts, and all five mode/chain combinations resolve to the right base. This was the agent's own map being wrong, not the plumbing.

Mutation-tested: restoring the alias line fails 3 tests; dropping the chain from the cache key fails 1. 756 local tests pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rm7cRGtC7wCofhYuHRo21h

The gateway section handed the model this:

  - Base chain: https://blockrun.ai/api (alias: https://api.blockrun.ai)

Those are different services. api.blockrun.ai authenticates a bearer key and
401s without one; blockrun.ai and sol.blockrun.ai answer a 402 challenge and
ignore a key entirely. Told they are aliases, the model can send a wallet-signed
request to a host that cannot settle it, or a key to a host that cannot read it,
and the failure looks like a gateway bug rather than a routing mistake.

The section was also unconditional, so it never said which host THIS session is
on. It now names one: api.blockrun.ai for a key, sol.blockrun.ai/api for Solana,
blockrun.ai/api for Base — plus which hosts are not yours and why, and an
instruction not to switch billing modes to work around an API error.

Found while auditing that: assembleInstructions' cache key carried the pay mode
but not the chain. Both the gateway host and the wallet guidance name the active
chain, so a base -> solana switch inside one process was served the previous
chain's instructions. The key now carries the full billing identity.

Request routing itself was already correct — no caller bypasses gatewayBase()
and there are no hardcoded gateway hosts. This was the agent's own map being
wrong, not the plumbing.

Mutation-tested: restoring the alias line fails 3 tests, dropping the chain from
the cache key fails 1. 756 local tests pass.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rm7cRGtC7wCofhYuHRo21h
@VickyXAI
VickyXAI merged commit 9e91dc7 into main Sep 5, 2026
6 checks passed
@VickyXAI
VickyXAI deleted the fix/gateway-host-per-pay-mode branch September 5, 2026 22:56
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.

1 participant