Skip to content

feat(mech): report whose mech a session is about to pay - #85

Merged
DIvyaNautiyal07 merged 7 commits into
mainfrom
feat/mech-operator-report
Oct 12, 2026
Merged

DIvyaNautiyal07 merged 7 commits into
mainfrom
feat/mech-operator-report

Conversation

@DIvyaNautiyal07

@DIvyaNautiyal07 DIvyaNautiyal07 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Proposed changes

A session driving mech_tools or mech_request now sees whose mech it is about to pay. Both reports carry mech-client 0.24.0's ToolManager.mech_report_or_terms next to the valory_operated, terms and terms_url they already had:

  • operator: the domain the manifest claims, as the operator's identity, with domain_verified and a verification_note when the domain does not back it. The name is claimed_name, which mech-client never checks.
  • benchmarks and benchmark_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 and age_days, with the note that the counters cover on-chain requests and off-chain requests settled on-chain.
  • payment: the method, no price.

mech_request reports these before anything is paid or any allowance is armed, so a session that skips mech_tools still 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_terms returns the terms with report_note. Connect calls it directly, inside listing_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's timeout does 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 operator means the operator is unknown unless valory_operated is true. The skill and tool descriptions stay short, since each report field carries its own note. The old terms_note is gone: report_note already 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.owner is the creation-tx sender and is never updated on transfer.

Fixes

None.

Types of changes

  • Non-breaking feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING doc
  • I am making a pull request against the main branch (left side). Also you should start your branch off our main.
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • The suite enforces 100% coverage; my changes do not reduce it
  • Public-facing documentation has been updated with the changes affected by this PR. Even if the provided contents are not in their final form, all significant information must be included.
  • If I changed a package under 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-coverage and integration-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

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>
@bennyjo
bennyjo self-requested a review October 9, 2026 07:50
OjusWiZard
OjusWiZard previously approved these changes Oct 9, 2026

@OjusWiZard OjusWiZard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bennyjo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread connect/assets/skills/pearl-connect/SKILL.md Outdated
@bennyjo
bennyjo requested review from OjusWiZard and bennyjo October 9, 2026 11:20

@OjusWiZard OjusWiZard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_report asserts operator["name"], which is now claimed_name plus name_note.
  • The same test's fake requests.get returns a plain object; the proof fetch now uses with requests.get(..., stream=True) and iter_content, so the fake needs __enter__/__exit__/iter_content. As it stands the AttributeError is caught upstream, the domain comes back unverified, and the assertion fails.
  • SKILL.md, README.md and the CLAUDE.md operator key list describe operator as the name and domain the manifest claims; upstream now treats the domain as the identity and claimed_name as unchecked, and a redirecting domain gets its own verification_note.

DIvyaNautiyal07 and others added 2 commits October 9, 2026 23:33
- `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>
@DIvyaNautiyal07

Copy link
Copy Markdown
Contributor Author

Done. connect/mech_report.py is gone and both flows call mech-client's mech_report_or_terms, so the record lookup, the fallback to the terms and report_note live upstream (mech-client#263, da08f07). The pin is on that commit. The real-client guard now checks claimed_name/name_note and link-only benchmarks, uses a streaming proof fake, and has two more cases that run the real fallback for an unreadable record and an unreadable manifest. Docs describe the domain as the identity and the redirect note.

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>
@DIvyaNautiyal07
DIvyaNautiyal07 marked this pull request as ready for review October 12, 2026 08:34

@bennyjo bennyjo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread connect/mech.py Outdated
Comment thread connect/mech.py Outdated
Comment thread connect/assets/skills/pearl-connect/SKILL.md Outdated
Comment thread pyproject.toml
Comment thread connect/mech.py Outdated
Comment thread connect/assets/skills/pearl-connect/SKILL.md Outdated
- `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>
Comment thread connect/mech_report.py Outdated
…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 OjusWiZard left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bennyjo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All four points are addressed and CI is green, so this is good to merge with the pre-payment check as your follow-up.

Comment thread connect/mech.py Outdated
Comment thread connect/mech.py Outdated
Comment thread connect/assets/skills/pearl-connect/SKILL.md Outdated
Comment thread pyproject.toml
@DIvyaNautiyal07
DIvyaNautiyal07 merged commit 1e7aeb2 into main Oct 12, 2026
19 checks passed
@DIvyaNautiyal07
DIvyaNautiyal07 deleted the feat/mech-operator-report branch October 12, 2026 12:21
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.

3 participants