Remote execution + transparency safeguards for MCP tools#71
Merged
Conversation
- get_capabilities: support use_remote/endpoint (remote grid facts via worker) so discovery works on HPC-only paths - remap_variable/regrid_dataset/remap_to_rectilinear: full remote execution on the HPC worker, returning compact summaries (and the small rectilinear array) instead of shipping large meshes - curl/divergence: soft vector-component guardrail — warn when u==v or when neither input has velocity/flux-like units; surfaced in _provenance.warnings - remote provenance: record the worker's true uxarray version (remote_uxarray_version) and warn on local/remote version drift - docs: README transparency section, tools.md remote-remap + guardrail notes, provenance.md new fields - tests: 7 new (guardrail, remote remap dispatch, get_capabilities remote); full suite 334 passing
Unused across the codebase — not imported, tested, documented, or dynamically dispatched. Verified with ruff (F401/F811/F841) and vulture; all other flagged symbols are exercised by tests or scripts.
This was referenced Jul 13, 2026
rajeeja
added a commit
that referenced
this pull request
Jul 13, 2026
…#74) Extends the remote-provenance transparency from #71 so every compute and analysis remote function reports the worker's true UXarray version via _worker_uxarray_version. _run_on_hpc surfaces it as remote_uxarray_version and emits a drift warning when it differs from the local version. Newly covered: inspect_variable, azimuthal_mean, grid_facts (the compute paths that previously omitted it). Verified live on Chrysalis (inspect_variable + get_capabilities report remote_uxarray_version and the drift warning; internal key does not leak into results). Adds a regression test asserting every compute remote function reports the version, plus a _run_on_hpc drift-warning unit test.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a set of correctness/transparency gaps found while exercising the MCP
server end-to-end (locally and against an HPC endpoint), plus completes remote
execution coverage for discovery and remapping.
What changed
Remote execution coverage
get_capabilitiesnow acceptsuse_remote/endpoint. Grid topology andvariable locations are fetched from the worker (a small "grid facts" payload),
so capability discovery works on datasets that live only on an HPC filesystem.
Previously the tool advertised
use_remotein its own output but could notactually run remotely.
remap_variable,regrid_dataset,remap_to_rectilinearnow supportuse_remote/endpoint. The remap runs on the HPC worker and returns compactsummary statistics (and, for
remap_to_rectilinear, the small rectilineararray, which is persisted locally) — large source meshes never cross the
network. Falls back to local execution when the endpoint is unavailable and the
paths are locally reachable, and raises a clear error (not a misleading
FileNotFoundError) for remote-only paths when the endpoint is down.Transparency / scientific-correctness safeguards
curlanddivergencenow emit soft warnings(without blocking) when the two inputs are the same field, or when neither
carries a velocity/flux-like
unitsattribute. This flags the classic"vorticity from two arbitrary scalars" mistake. Warnings surface in
_provenance.warnings. Implemented for both local and remote paths.worker's actual UXarray version as
remote_uxarray_version, and a warning isadded when it differs from the local version — so silent numerical differences
between local and remote runs are surfaced.
Docs
note updated.
docs/tools.md: documents remote remap, thescale_by_radiusecho, and thevector-component guardrail; removes the now-stale "local-only" note for
remap_to_rectilinear.docs/provenance.md: documentsremote_uxarray_versionand the drift/vectorwarnings.
Testing
uv run pre-commit run --all-files— all hooks pass (ruff, isort, format, mypy).uv run pytest tests/ --ignore=tests/test_remote_agent.py— 334 passed(7 new tests: vector-component guardrail incl. provenance surfacing, remote
remap dispatch + clear-error fallback,
get_capabilitiesremote).locally against real MPAS meshes (identical results to the local tools).
Note on live HPC validation
The remote remap paths were validated via mocked-agent tests and by running
the worker compute functions directly; a full live round-trip on the Chrysalis
endpoint was not captured because the endpoint was offline at the time of this PR
(the manager reported
registeredbut task submission returnedENDPOINT_NOT_ONLINE, which requires an endpoint restart on the cluster). Theget_capabilitiesandinspect_meshremote paths were confirmed live earlier,including the version-drift warning firing against the Chrysalis worker.