in reviewhumanPR #331Transport
TermsMet: add MCP acceptance workflow and lost-reply recovery check
TermsMet is a shared acceptance and conditional-delivery service for buyer and provider agents. The two parties agree on one versioned CSV-to-JSON task.
Author
@sheilahf860316
github profile →- Status
- In review
- Opened on
- Nov 10
- Branch
- integration/termsmet-acceptance
Description
The pitch.
## Summary
TermsMet is a shared acceptance and conditional-delivery service for buyer and provider agents. The two parties agree on one versioned CSV-to-JSON task. The buyer confirms simulated funding, and the provider submits records that the server checks deterministically, with one repair allowed. The buyer can retrieve the delivery only after the server records a simulated release at the end of a review window.
This PR adds `examples/integrations/termsmet/`, a Town Lab integration with:
- scripted buyer and provider roles and an MCP adapter role
- two scenarios: a clean run, and a lost-reply run that drops the message carrying a real PASS
- validators for each stage, built only from Town events
- the recorded evidence bundles, a bounded runner, and tests
It does not change Town's core code.
## Integration
```
tm_buyer ── Town messages ── tm_provider
└── tm_tool_request / tm_tool_result ── tm_adapter ── MCP stdio ──> TermsMet (buyer process, provider process, one SQLite DB)
```
- `tm_buyer` and `tm_provider` change state only from Town messages they actually receive. `tm_adapter` is the only role that calls TermsMet. It maps the Town sender to a fixed server identity, sends each result back unchanged, and records a `tm_server_call` observer event for each call.
- The server under test is the real public runtime: https://github.com/wywyou56/termsmet-runtime at `7ee09295226d2a41555293f391e13a8c46020031`, Python 3.11.5, `mcp==2.3.0`. It is not a stub. All verdicts, deadlines and settlements come from it.
- Town base is `6f9a7c064486c4a0ae9242f1ff341b8a4aad0244`. The adapter uses only `TownAPI.send/reply/later/observe`, with no Track coordinator and no LLM, and needs no model key.
- In the lost-reply scenario, the `memory.v1` transport drops the first `tm_repair_result`, using the standard `faults: [{action: drop, kind: tm_repair_result, nth: 1}]`.
## Reproduce
Run from one parent directory so `termsmet-runtime/` and `nandatown/` are siblings. `python3.11 --version` must print `Python 3.11.5`.
```sh
git clone https://github.com/wywyou56/termsmet-runtime.git termsmet-runtime
git -C termsmet-runtime checkout 7ee09295226d2a41555293f391e13a8c46020031
python3.11 -m venv termsmet-runtime/.venv # or: uv venv --python 3.11.5 --seed termsmet-runtime/.venv
termsmet-runtime/.venv/bin/python -m pip install -r termsmet-runtime/requirements.txt
git clone https://github.com/wywyou56/nandatown.git nandatown
cd nandatown
git switch integration/termsmet-acceptance
python3.11 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'
.venv/bin/python -m pip install -r examples/integrations/termsmet/requirements.lock
# offline verification (needs no runtime, MCP SDK or key)
.venv/bin/python examples/integrations/termsmet/run.py --verify examples/integrations/termsmet/evidence
# live runs (fresh DB and empty output dir each time)
.venv/bin/python examples/integrations/termsmet/run.py --project ../termsmet-runtime --case clean --out /tmp/termsmet-hw8-clean
.venv/bin/python examples/integrations/termsmet/run.py --project ../termsmet-runtime --case lost-reply --out /tmp/termsmet-hw8-lost
# tests
.venv/bin/python -W error::ResourceWarning -m unittest discover -s tests -p 'test_termsmet_*.py' -v
.venv/bin/python -m pytest -q
git diff --check
```
Verification on macOS with Python 3.11.5:
- TermsMet suites: 38 tests passed.
- Full `pytest -q`: 1903 passed.
- `git diff --check`: clean.
- `python -m build` and `scripts/check_distributions.py`: passed.
- Offline `--verify` passed in a fresh clone whose environment had no MCP SDK and no runtime.
- Both live cases passed again in a separate directory, with a fresh runtime clone and fresh environments.
The bundles were recorded from integration commit `beee4a7`. An earlier passing pair recorded from `d50be99` was replaced after review. That version's buyer probed retrieval after seeing `IN_REVIEW`, and the real deadline can pass between those calls, so the probe was removed. The lost-
…Try it
Open PR on GitHubView diffCheckout locally
git fetch origin pull/331/head:pr-331
git checkout pr-331