Skip to content

Plan next steps for production demo#27

Merged
simonovic86 merged 3 commits intomainfrom
claude/youthful-brown
Mar 14, 2026
Merged

Plan next steps for production demo#27
simonovic86 merged 3 commits intomainfrom
claude/youthful-brown

Conversation

@simonovic86
Copy link
Owner

No description provided.

simonovic86 and others added 2 commits March 14, 2026 23:47
Add wallet_pay hostcall enabling agents to pay for services from their
budget. This completes the self-provisioning story: agents can now
observe prices (HTTP), decide to pay (wallet_pay), and survive crashes
mid-payment (effect lifecycle).

Runtime:
- wallet_pay ABI: amount, recipient, memo → signed payment receipt
- Manifest-driven validation: allowed_recipients, max_payment_microcents
- Budget deduction with Ed25519-signed receipt generation
- Event log recording for deterministic replay (CM-4)

SDK:
- igor.WalletPay(amount, recipient, memo) wrapper with auto-retry
- MockBackend.WalletPay + PaymentHandler for native testing

Demo (agents/x402buyer):
- Encounters HTTP 402 paywall, parses payment terms
- Effect lifecycle: Record → checkpoint → Begin → Pay → Confirm
- Crash recovery: unresolved payments reconciled, no duplicates
- Mock paywall server (agents/x402buyer/cmd/paywall)
- End-to-end demo script (scripts/demo-x402.sh)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add go.mod for x402buyer agent (same pattern as other agents)
- Move paywall server from agents/x402buyer/cmd/ to cmd/paywall/
  so it's part of the main module (not the agent's TinyGo module)
- Update Makefile build path
- Fix errcheck lint warning

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10d608201d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +113 to +116
if m.Has("x402") && r.walletPayState != nil {
capCfg := m.Capabilities["x402"]
r.registerPayment(builder, r.walletPayState, capCfg)
registered++

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Add replay support before registering x402 hostcalls

This registers x402/wallet_pay in the live host module, but the replay host module paths still only register clock, rand, log, wallet, and pricing (checked internal/replay/engine.go in both registerReplayHostModule and registerChainReplayHostModule). In environments using replay verification (default ReplayMode=full), migrated agents that import igor.wallet_pay will fail replay module instantiation, causing migration verification to fail even when the checkpoint is valid.

Useful? React with 👍 / 👎.

Comment on lines +119 to +123
// Deduct budget.
if err := state.DeductBudget(amount); err != nil {
r.logger.Error("Budget deduction failed", "error", err)
return payErrProcessing
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move budget deduction after receipt buffer validation

wallet_pay deducts budget before verifying that the caller’s receipt buffer is large enough to return the receipt. When the buffer is too small, the function returns -5 and expects a retry, but the first attempt has already charged the agent, so retries can double-charge the same payment. This affects callers that start with smaller buffers (or future larger receipts) and violates retry safety for this hostcall ABI.

Useful? React with 👍 / 👎.

…ering

- Register wallet_pay in both registerReplayHostModule and
  registerChainReplayHostModule so agents using x402 capability can
  pass replay verification (CM-4)
- Move receipt buffer capacity check before budget deduction in
  payment.go to prevent double-charge when caller retries with a
  larger buffer after receiving -5 (payErrBufferTooSmall)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@simonovic86 simonovic86 merged commit ced4234 into main Mar 14, 2026
1 check passed
@simonovic86 simonovic86 deleted the claude/youthful-brown branch March 14, 2026 23:07
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