Skip to content

stackflow-agent: add setup/send/receive workflow coverage + quickstart#8

Open
warmidris wants to merge 8 commits intoobycode:mainfrom
warmidris:chore/agent-workflow-test-polish
Open

stackflow-agent: add setup/send/receive workflow coverage + quickstart#8
warmidris wants to merge 8 commits intoobycode:mainfrom
warmidris:chore/agent-workflow-test-polish

Conversation

@warmidris
Copy link

Summary

  • Add practical workflow coverage for stackflow agent operations used by autonomous agents.
  • Improve onboarding docs so a new agent can set up a pipe, open/fund it, build outgoing state, and accept incoming signed updates.

What changed

  • tests/stackflow-agent.test.ts
    • Added test for openPipe(...) to verify expected fund-pipe contract call payload.
    • Added test for end-to-end local workflow:
      • tracked pipe with baseline state
      • buildOutgoingTransfer(...)
      • acceptIncomingTransfer(...)
      • persisted latest nonce/balances assertions.
  • packages/stackflow-agent/README.md
    • Added "Quick workflow (setup pipe + send + receive)" with copy/paste snippets.

Validation

  • npm run test:node-utils
    • tests/x402-client.test.ts
    • tests/stackflow-agent.test.ts

This is a polish/testability PR to make agent usage easier and safer before broader integration into aibtcdev/skills.

@obycode
Copy link
Owner

obycode commented Mar 5, 2026

Findings

  1. High: validateIncomingTransfer now rejects valid states where the local principal is the actor.
    • PR change in agent-service.js adds actor !== tracked.counterpartyPrincipal rejection (actor-mismatch).
    • But Stackflow contract logic allows actor to be either side of the pipe for relevant actions (principal-1 or principal-
      2): stackflow.clar:1528, stackflow.clar:1539.
    • This can break normal “I initiated update, counterparty co-signed and sent it back” flows, because actor remains the initiator, not always the counterparty.
    • The new examples/tests appear to work around this by mutating actor in returned payload, e.g. README.md quick workflow and stackflow-agent.test.ts, which is a red flag for semantic mismatch.

Open Question

  1. Is this endpoint intended to accept only counterparty-initiated updates?
    If yes, it should be explicitly scoped/named that way; otherwise the actor check should allow either tracked participant (or be action-aware).

Summary

  • Main concern is the new actor restriction; it looks protocol-incompatible and likely to reject valid signed state
    exchanges.

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.

2 participants