Repository navigation
Conversation
… an observed input (Cygnux-Labs#667) Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
LoopGlitch26
left a comment
There was a problem hiding this comment.
Thanks. Two things:
-
A resource that can't be recorded should be withheld, not returned. The MCP gateway fails closed here (
_observeintracekit/mcp_gateway.py, L238-249), and #685 just made the same change for the list methods: onSignerUnavailable, return the result only whenfail_open(self.fail_modes, self.CLASS)says so, and otherwise raise, asHeldCalls._gatedoes (tracekit/integrations/held.pyL47-48); anRPCErrorraises either way. The test that expects a warning and the result then becomes two: fail-closed raises, fail-open returns with the warning. -
#685 changes the same autowire code. It replaces
_Unpatched's per-method wrappers with one table of the methodsinstrument()patches. Whichever merges first, the other rebases. If #685 lands first,read_resourcebecomes one more name in its tuple in_mcp.
|
#692 is merged, so main's lock file now names the 1.6.0 signer packages. Please merge main into this branch (or rebase); the two red checks, release-dry-run and the offline evals, should then pass. I'll approve the CI runs after your push if they need it. |
Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
|
Thanks for the review, @LoopGlitch26. Addressed in
|
LoopGlitch26
left a comment
There was a problem hiding this comment.
Thanks, both points are in at cb55d55: closed raises, open returns the resource with a warning, a refusal raises either way, and read_resource is one more name in _mcp's tuple. CI is green.
One thing before it goes to the owner: read_resource repeats _list's body line for line (tracekit/integrations/mcp.py L70-84 on main): fetch, the unnamed-server warning, observe, the fail-mode branch. Let one helper take the method and the source suffix, so read_resource and the three lists are one line each and the fail-closed path lives in one place. The tests you added stay as they are.
|
I made the helper change myself and carried this in #776, since a push to your branch was refused. Your four commits are in it unchanged, with your authorship and sign-offs. On top of them:
Your tests are unchanged. This PR closes when #776 merges. |
…ies #689, closes #667) (#776) * MCP client: record what read_resource returns on a wrapped session as an observed input (#667) Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com> * MCP client: withhold an unrecorded resource unless the run fails open Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com> * MCP client: read_resource and the lists share one recording helper read_resource repeated _list's body (fetch, unnamed-server warning, observe, fail-mode branch). One helper, _observed, now takes the session method and the source suffix, so the fail-closed path lives in one place. A resource over half a signer frame is now recorded as its digest, as a list's page is, rather than sent whole and refused by the signer. Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com> --------- Signed-off-by: Mr45401 <185895283+Mr45401@users.noreply.github.com> Signed-off-by: LoopGlitch26 <53336715+LoopGlitch26@users.noreply.github.com> Co-authored-by: Mr45401 <185895283+Mr45401@users.noreply.github.com>
|
Merged in #776 with your commits. The MCP client now records what If you'd like another one: #724 is a real bug. Browser Use 1.0 removed the seam the integration hooked in 0.13, so on 1.0 Tracekit gates none of its tool calls. And a follow-up to the request on #675: if you've been running Tracekit on your coding agent, |
Closes #667
Summary
async def read_resource(self, uri, *a, **kw)toTracekitSessionintracekit/integrations/mcp.pyso resource reads on a wrappedClientSessionare recorded via theobserveRPC (source="mcp:<server>/resource",trust="untrusted",value=result.model_dump(mode="json", by_alias=True, exclude_none=True)) before returning.SignerUnavailable, return the resource with a warning only whenfail_open(self.fail_modes, self.CLASS)is true, and otherwise raise;RPCErroralways propagates."read_resource"inautowire._mcp's patched method tuple intracekit/autowire.pysotracekit.instrument()coversread_resourcealongsidecall_tool,get_prompt, andlist_*.tests/test_contract_mcp.pycoveringobservepayload recording,autowire._mcppatching, fail-closed withholding (SignerUnavailableby default andRPCErroreven underfail_modes={"mcp": "open"}), and fail-open warning + return (SignerUnavailableunderfail_modes={"mcp": "open"}), plusClientSession.read_resourcecleanup intests/test_instrument.py,tests/test_agent_framework.py, andtests/test_pydantic_ai.py.read_resourcerecording and fail-closed/fail-open semantics indocs/integrations/mcp.md.Verification
pytest tests/test_contract_mcp.py tests/test_instrument.py tests/test_docs.py tests/test_readme.py tests/test_agent_framework.py tests/test_pydantic_ai.py tests/test_mcp_gateway.py -v:93 passed, 89 skipped, 13 subtests passedpython -m pyflakes tracekit tracekit_sdk.py tests eval examples contrib integrations: 0 warnings/errorsNote: AI assistance was used for code navigation and test verification.