evolver icon indicating copy to clipboard operation
evolver copied to clipboard

buildHubHeaders() sends OAuth token instead of node_secret, causing 403 auth_scope_mismatch on Hub endpoints

Open syltharion opened this issue 5 months ago • 2 comments

Description

buildHubHeaders() in src/gep/a2aProtocol.js sends the OAuth access_token (stored in ~/.evomap/oauth_token.json, prefix evm_at_...) as the Authorization: Bearer header. However, Hub endpoints that require node-scoped authentication (validator stake, ATP-Merchant, events stream) expect the node_secret (64-char hex, returned by POST /a2a/hello and stored in ~/.evomap/mailbox/state.json).

This causes 403 errors with auth_scope_mismatch / not_node_owner on all node-scoped endpoints.

Affected Components

Component Auth source Result
Lifecycle heartbeat (_buildHeaders() in manager.js) node_secret from MailboxStore ✅ Works
Validator stake (stakeBootstrap.js → buildHubHeaders()) OAuth token ❌ 403
ATP-Merchant (merchantAgent.js → sendHelloToHub()) OAuth token ❌ 403
Events stream OAuth token ❌ 403

Root Cause

In src/proxy/lifecycle/manager.js line 683, _buildHeaders() correctly uses this.nodeSecret:

_buildHeaders() {
  const headers = { 'Content-Type': 'application/json' };
  const secret = this.nodeSecret;
  if (secret) headers['Authorization'] = 'Bearer ' + secret;
  ...
}

But buildHubHeaders() exported from src/gep/a2aProtocol.js reads the OAuth token instead. Internal code in the obfuscated module calls buildHubHeaders through closure references, so patching the export doesn't help.

Steps to Reproduce

  1. Fresh install: npm install -g @evomap/evolver (v1.89.17)
  2. evolver login → authorize via device code
  3. A2A_HUB_URL=https://evomap.ai EVOMAP_PROXY=1 evolver --loop
  4. Observe logs:
    • [lifecycle] hello OK ✅
    • [ATP-Merchant] Failed to register with Hub: secret_diverged_cleared ❌
    • [evomap-validator-stake] phase: "failed_permanent", status: 403 ❌
    • [Events] Poll error: hub_events_poll_http_403 ❌

Environment

  • evolver: 1.89.17
  • Node.js: v25.9.0
  • OS: Ubuntu 24.04.4 LTS (Linux 6.17.0-35-generic x64)
  • Fresh install, no prior evolver data

Expected Behavior

buildHubHeaders() should use node_secret (from MailboxStore ~/.evomap/mailbox/state.json) for node-scoped Hub endpoints, matching the behavior of the lifecycle manager's _buildHeaders().

Workaround

Disable affected components:

EVOLVER_VALIDATOR_ENABLED=false EVOLVER_ATP_AUTOBUY=off evolver --loop

Core evolution (local cycle, heartbeat, sync) still works.

syltharion avatar Jun 28 '26 00:06 syltharion

🤖 @bjw9808 这条 issue 在你负责的仓库,麻烦认领或跟进一下。(agent-control 自动提醒;未自动接入)

owenshen0907 avatar Jun 28 '26 00:06 owenshen0907

I will handle this

bjw9808 avatar Jun 28 '26 04:06 bjw9808