feat: add agent self-provisioning with deployer demo#29
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2f64ac362a
ℹ️ 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".
agents/deployer/main.go
Outdated
| igor.Logf("[deployer] Payment FAILED: %s", err.Error()) | ||
| _ = d.Effects.Compensate(intent.ID) | ||
| d.Effects.Prune() | ||
| d.Phase = phaseDiscovery |
There was a problem hiding this comment.
Handle failed wallet_pay without invalid state transition
When igor.WalletPay returns an error (for example, insufficient budget or blocked recipient), this branch calls Effects.Compensate immediately after Effects.Begin. Compensate only succeeds from the Unresolved state, so this call fails and is ignored, leaving the intent in InFlight; Prune then does nothing and the stale intent persists. That breaks the effect lifecycle guarantees on payment errors and can leave non-terminal intents accumulating without being properly resolved.
Useful? React with 👍 / 👎.
agents/deployer/main.go
Outdated
| igor.Logf("[deployer] Deployment FAILED: %s", err.Error()) | ||
| _ = d.Effects.Compensate(intent.ID) | ||
| d.Effects.Prune() | ||
| d.Phase = phaseDiscovery |
There was a problem hiding this comment.
Handle failed deploy requests without invalid compensation
The deployment error path has the same transition bug: after Begin, an HTTP failure compensates immediately even though the intent is still InFlight. Because that compensate call is invalid and its error is ignored, failed deployment intents remain non-terminal and are never pruned, which can pollute effect state across retries/resumes and undermine crash-recovery behavior.
Useful? React with 👍 / 👎.
Compensate previously only accepted Unresolved state, but agents that observe an action fail during InFlight (e.g., HTTP error, payment rejected) need to mark the intent as terminal immediately. Without this, failed intents remain InFlight, Compensate silently fails, and Prune cannot remove them — leading to stale non-terminal intents accumulating in effect state. Widen Compensate to accept both InFlight and Unresolved: - InFlight → Compensated: agent observed the failure directly - Unresolved → Compensated: agent investigated after crash Fixes the deployer and x402buyer error paths which already called Compensate after Begin but got silent errInvalidTransition errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2f64ac3 to
412e502
Compare
Overview
Completes Product Phase 2 (Agent Self-Provisioning): agents can now discover compute providers, compare prices, pay for infrastructure autonomously, and deploy themselves — all crash-safe via the effect lifecycle.
Changes
New Agent: Deployer (
agents/deployer/)node_pricehostcall)wallet_payhostcallMock Marketplace Server (
cmd/marketplace/)GET /providers— returns list of compute providers with pricesPOST /deploy— accepts checkpoint deployment; requires payment header; returns deployment IDGET /deploy/{id}/status— tracks deployment progress (provisioning → running)main_test.go)Demo Script (
scripts/demo-deployer.sh)Documentation Updates
CLAUDE.md: Mark Phase 2 complete; document deployer agent and marketplaceROADMAP.md: Mark Phase 2 complete; detail delivered capabilitiesBuild System
make agent-deployerto build deployer WASMmake demo-deployerto run full demoKey Capabilities
✅ HTTP hostcall (price discovery)
✅ Effect lifecycle model (crash-safe intents)
✅ Wallet payment (autonomous spending)
✅ Self-deployment (agents provision themselves)
✅ Reconciliation (resume rule: InFlight → Unresolved)
✅ Price comparison (agents decide where to run)
Testing
Run the demo:
Run marketplace tests:
go test ./cmd/marketplace -v