Skip to content

fix(cli): remove calldata_id resolution — tx_ready delivers calldata directly#247

Draft
neavra wants to merge 3 commits intomainfrom
fix/remove-calldata-id-client
Draft

fix(cli): remove calldata_id resolution — tx_ready delivers calldata directly#247
neavra wants to merge 3 commits intomainfrom
fix/remove-calldata-id-client

Conversation

@neavra
Copy link
Copy Markdown
Contributor

@neavra neavra commented Apr 13, 2026

Summary

Removes all calldata_id client-side resolution from the SDK CLI. Calldata is now delivered via tx_ready SSE events with full hex — the client no longer needs to fetch calldata references from the agent-backend API.

What changed

executor.ts:

  • Removed backendClient field and setBackendClient() method
  • Removed calldata_id resolution in buildTx (the if (params.calldata_id && !params.data) block)
  • Removed raw calldata pass-through in buildTx (the if (params.data || params.calldata || params.hex_payload) block) — server-built calldata arrives via tx_ready, not via action params
  • Replaced silent fallback to buildSendTx with an explicit error throw
  • buildTx now only handles ABI-encoding from function_name + contract_address

client.ts:

  • Removed getCalldata() HTTP method (called GET /agent/calldata/:id)

session.ts:

  • Removed setBackendClient wiring after auth

Why

Both Sonnet and minimax were observed putting the literal string calldata_id: cd_xxx into the tx data field, causing on-chain reverts. The calldata_id mechanism required the LLM to correctly place a machine-generated reference into the right tool parameter — a fundamentally fragile design.

The companion agent-backend PR (#109) moves calldata stashing after tx_ready emission, so tx_ready always carries full calldata. Clients sign directly from tx_ready without needing calldata_id resolution.

Depends on

  • vultisig/agent-backend#109 must deploy first — it ensures tx_ready carries full calldata instead of calldata_id references

Test plan

  • yarn check passes
  • Swap ETH → USDC lands on-chain (tx_ready flow, no calldata_id)
  • Pendle buy/sell PT lands on-chain (calldata_id flows through build_evm_tx on agent-backend side, never reaches SDK CLI)
  • Simple send still works (no regression)

Calldata is now delivered to clients via tx_ready SSE events with full
hex — clients no longer need to resolve calldata_id references from
the agent-backend API.

Removed:
- backendClient field and setBackendClient() from executor
- calldata_id resolution block in buildTx (mode 1)
- Raw calldata pass-through in buildTx (mode 3) — server-built
  calldata arrives via tx_ready, not via action params
- Fallback to buildSendTx (mode 5) — replaced with explicit error
- getCalldata() HTTP method from client
- setBackendClient wiring from session

buildTx now only handles ABI-encoding from function_name + contract_address.
All other calldata delivery goes through tx_ready.

Companion to vultisig/agent-backend#109 which moves stashing after
tx_ready emission so clients always receive real hex.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 13, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a051fdb2-395c-49f9-bdd2-9fa6ec723a96

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remove-calldata-id-client

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

neavra and others added 2 commits April 13, 2026 16:31
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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