buildHubHeaders() sends OAuth token instead of node_secret, causing 403 auth_scope_mismatch on Hub endpoints
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
- Fresh install:
npm install -g @evomap/evolver(v1.89.17) evolver login→ authorize via device codeA2A_HUB_URL=https://evomap.ai EVOMAP_PROXY=1 evolver --loop- 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.
🤖 @bjw9808 这条 issue 在你负责的仓库,麻烦认领或跟进一下。(agent-control 自动提醒;未自动接入)
I will handle this