in reviewhumanPR #352Identity

Attest: add Know-Your-Agent gated seller, signing buyer and duplicate-delivery test

Attest is a Know-Your-Agent gate: before an agent acts on another agent's request it checks who deployed the sender, what the sender may do, and whether that is still valid, and returns allow, refuse, escalate or unknown with a signed…

Author

Status
In review
Opened on
Nov 11
Branch
integration/attest-gate-seller

Description

The pitch.

## Summary
Attest is a Know-Your-Agent gate: before an agent acts on another agent's request it checks who deployed the sender, what the sender may do, and whether that is still valid, and returns allow, refuse, escalate or unknown with a signed receipt. Operators stake money behind their agents, and a proven breach slashes it. This PR adds a Track seller that asks a real Attest gate before quoting, a buyer that signs its request, a world builder, and 22 tests that exercise every gate capability through real Town runs. No Attest code is included.

## Integration
Attest runs as a separate HTTP service ([smghaas/attest](https://github.com/smghaas/attest), commit `b3d5a5c`). `examples/attest/attest_seller.py` posts the buyer's `attest` envelope to `/verify/<receiver>` and quotes only on `allow` (or `unknown`/`pow_ok` for a read-only quote). `attest_buyer.py` signs with Attest's helpers, solves the gate's puzzle when asked, and verifies the gate's receipt. Both attach with `--agent role=cmd:...`. The tests also act on the gate over HTTP as an operator (revoke) and as the receiver (slashing claim).

## Reproduce
Town commit `6f9a7c0`, Attest `b3d5a5c`, Python 3.11.

```bash
git clone https://github.com/smghaas/attest && git -C attest checkout b3d5a5c
python3 -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]' && export ATTEST_HOME=$PWD/attest
python -m pytest -q tests/test_attest_integration.py
```

22 passed in about 3 minutes (a gate is started per test); the tests skip without `ATTEST_HOME`. Full suite on the earlier revision of this branch: 1863 passed, 8 skipped, 2 failed. The 2 failures (`tests/test_bundle_encoding.py`, non-UTF-8 locale) fail identically on unmodified `main` on macOS.

## Results and limitations
Expected versus observed for every case is in `examples/attest/README.md`. Covered through Town runs: identity and stake (staked buyer served, receipt verifies, bundle verifies), delegation chains, attenuation, scope, mandate limit, receiver policy (`escalate`), order splitting across runs, revocation with cascade (and a non-signer's revoke rejected), expiry, signature tampering and stolen keys, forged operator names, slashing (served before the breach claim, refused after), proof of work for an unstaked sender (quote after solving; orders refused), and the issuer stake cap across four roots. Town-side: a stock Town buyer with no envelope is refused and Town reports `correct` as not_enough_evidence. Duplicate delivery: Town redelivers quote requests at least once; the gate now answers an unchanged request checked again with its original answer marked `repeat`, so even a seller without a journal applies it once and `quote-duplicate-delivery` passes either way. Discovery: every refusal carries `how_to_get_served` (gate URL and key, receiver name, what to attach), and a buyer told nothing (`ATTEST_DISCOVER=1`) finds the gate from it and gets a public quote. Self sign-up: on a sandbox gate an outside team gets test stake, registers its own seller and agent with Attest's SDK, and is served in Town (an $1,800 order escalated by the seller's own rule); the seller signs its checks (`ATTEST_RECEIVER_KEY`), which a sandbox gate requires.

Not tested: Town's crash, amnesia and lost-ack faults on `cmd:` harnesses (Town applies them only to its own scripted participants), the dispute and arbiter path of slashing, stake on chain (Attest keeps it in a JSON file), several gates or concurrent senders, scale. The buyer and seller are written by the Attest team, so this is a compatibility check, not an independent-agent result.

## Course context
MIT AI Studio Fall 2026, HW8 submission.

Try it

Open PR on GitHubView diff

Checkout locally

git fetch origin pull/352/head:pr-352
git checkout pr-352