Repository navigation
feat(mech): report whose mech a session is about to pay - #85
Conversation
mech_tools and mech_request now carry mech-client's mech_report next to the terms keys they already had: the operator the manifest claims and whether its domain is verified, the benchmark links as a claim, the on-chain delivery record and age, and the payment method. The record is read once from the marketplace indexer and handed to mech-client. When it cannot be read the report falls back to the terms and says so in report_note: the terms decide what a request agrees to, the record only informs the choice, so an indexer outage neither hides the terms nor blocks the request. Every check and label stays upstream; connect recomputes none of the domain check, the id resolution or the labels. The helper lives in connect/mech_report.py so mech.py stays under pylint's module length. The pin guard test now runs the real mech_report past a faked resolver, agent-id lookup and proof fetch. mech-client is pinned at 0.24.0 through a uv git source on the head of valory-xyz/mech-client#263 until that release is on PyPI. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
OjusWiZard
left a comment
There was a problem hiding this comment.
The report runs before the digest is registered or any deposit is armed, an indexer failure falls back to the terms with report_note, and domain_verified / verification_note pass through unchanged. The call matches mech-client#263's mech_report, and the test against the real pinned client guards the shape. Tests pass (1214). Merge after mech-client 0.24.0 is released and the git source is dropped.
bennyjo
left a comment
There was a problem hiding this comment.
One question on how the skill tells the agent to name the operator, raised after the approval because an unchecked name next to a verified domain can lead an agent to pay a lookalike mech.
OjusWiZard
left a comment
There was a problem hiding this comment.
Could connect/mech_report.py move into mech-client, same as mech_terms.py did in #73? Reading the mech's record from the indexer, falling back to the terms when it can't be read, and setting report_note is mech logic, and for separation of concerns mech stuff belongs in its own library. With it in mech-client (e.g. ToolManager.mech_report doing the record lookup itself and degrading to the terms), connect calls one function, the fallback rule lives in one place for every client, and its tests go with it. valory-xyz/mech-client#263 is still open, so it can land there before the release.
Also, the pinned rev (d002711) is behind #263, and the bump to its current head (33d99a7) breaks a couple of things here:
test_tools_use_mech_client_s_real_mech_reportassertsoperator["name"], which is nowclaimed_nameplusname_note.- The same test's fake
requests.getreturns a plain object; the proof fetch now useswith requests.get(..., stream=True)anditer_content, so the fake needs__enter__/__exit__/iter_content. As it stands theAttributeErroris caught upstream, the domain comes back unverified, and the assertion fails. - SKILL.md, README.md and the CLAUDE.md operator key list describe
operatoras the name and domain the manifest claims; upstream now treats the domain as the identity andclaimed_nameas unchecked, and a redirecting domain gets its ownverification_note.
- `mech_tools` and `mech_request` call mech-client's `ToolManager.mech_report_or_terms` directly, and connect/mech_report.py is gone. The record lookup, the fallback to the terms and `report_note` are mech logic and now live in one place upstream. - mech-client is pinned to valory-xyz/mech-client#263 at da08f07, where the operator's domain is its identity and the name is `claimed_name`, unchecked, and benchmarks are one link per tool. - The real-client guard checks that shape with a streaming proof fake, and two more guards run the real fallback for an unreadable record and an unreadable manifest. The other tests cover only what connect does: which mech and document it passes, the merge, the order before any allowance, and that a request still goes out after a fallback. - The skill tells the agent to name the operator's domain and whether it is verified, and to treat the name as the operator's own claim. README, CLAUDE.md and the MCP tool descriptions say the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Done. |
0.24.0 is released, so the git source on valory-xyz/mech-client#263 goes and the lock resolves the published package. The release carries no library change since the pinned commit, only its CI tooling bump. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bennyjo
left a comment
There was a problem hiding this comment.
No blockers from me, just four questions inline about a stall before payment, a false RPC warning, the missing operator case and the stale description.
- `connect/mech_report.py` runs mech-client's `mech_report_or_terms` on a capped pool and waits at most 10 s. The proof fetch goes to a host the mech's operator controls and times out only per read, so past the deadline the session gets mech-client's terms check with `report_note`, the same shape as an unreadable record. - The report runs inside `listing_mechs()`, entered in the worker since it is per thread, so its indexer reads do not log false RPC mismatch warnings after a request on another chain. - `terms_note` is gone: mech-client's `report_note` already says when the manifest could not be read. - The pearl-connect skill and the tool descriptions go back to their earlier text plus what the report cannot say for itself: name the operator's domain and whether it is verified, treat the name as a claim, and a missing `operator` means the operator is unknown unless `valory_operated`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…of connect's The bound on the report moves out of connect. A slow proof host stalls only the report on the mech being paid, and the request's timeout does not bound the other steps before payment either, so a wrapper with its own pool cost more than it covered. `connect/mech_report.py` goes, and both calls in `mech.py` run `mech_report_or_terms` inside `listing_mechs()`, which keeps the indexer reads from logging false RPC mismatch warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
OjusWiZard
left a comment
There was a problem hiding this comment.
Thanks. Re-checked at c6f1b62: both flows call mech-client 0.24.0's mech_report_or_terms directly inside listing_mechs(), the docs are short, and tests pass (1258).
bennyjo
left a comment
There was a problem hiding this comment.
All four points are addressed and CI is green, so this is good to merge with the pre-payment check as your follow-up.
Proposed changes
A session driving
mech_toolsormech_requestnow sees whose mech it is about to pay. Both reports carry mech-client 0.24.0'sToolManager.mech_report_or_termsnext to thevalory_operated,termsandterms_urlthey already had:operator: the domain the manifest claims, as the operator's identity, withdomain_verifiedand averification_notewhen the domain does not back it. The name isclaimed_name, which mech-client never checks.benchmarksandbenchmark_note: the operator's link per tool, as a claim, never a figure.delivery: requests received, self-delivered and delivered by others, the creation time andage_days, with the note that the counters cover on-chain requests and off-chain requests settled on-chain.payment: the method, no price.mech_requestreports these before anything is paid or any allowance is armed, so a session that skipsmech_toolsstill learns whose mech it pays and whose terms apply. The on-chain flow keeps reporting the terms only, as it never reads the manifest.The record lookup and the fallback to the terms are mech-client's: when the manifest or the record cannot be read,
mech_report_or_termsreturns the terms withreport_note. Connect calls it directly, insidelisting_mechs(), so its indexer reads do not log false RPC mismatch warnings after a request on another chain. There is no extra deadline: a slow proof host stalls only the report on the mech being paid, and the request'stimeoutdoes not bound the other steps before payment either.The pearl-connect skill tells the agent to name the operator's domain and whether it is verified, to treat the name as the operator's claim, and that a missing
operatormeans the operator is unknown unlessvalory_operatedis true. The skill and tool descriptions stay short, since each report field carries its own note. The oldterms_noteis gone:report_notealready says when the manifest could not be read.Depends on
mech-client 0.24.0, released and pinned from PyPI.
Not reported, by upstream design: the mech owner. The indexer's
Mech.owneris the creation-tx sender and is never updated on transfer.Fixes
None.
Types of changes
Checklist
mainbranch (left side). Also you should start your branch off ourmain.packages/, I have re-locked the Olas package hashes (autonomy packages lock)Further comments
Run locally from
common_checks.yml: the full lint set,safety,unit-tests-coverageandintegration-tests. Launch tests were not run (they need a real terminal).The guard tests run mech-client's real report past a faked resolver, indexer, agent-id lookup and proof fetch: the full report and the two fallbacks.
🤖 Generated with Claude Code