Skip to content

Remote execution + transparency safeguards for MCP tools#71

Merged
rajeeja merged 2 commits into
mainfrom
rajeeja/mcp-fixes-transparency
Jul 11, 2026
Merged

Remote execution + transparency safeguards for MCP tools#71
rajeeja merged 2 commits into
mainfrom
rajeeja/mcp-fixes-transparency

Conversation

@rajeeja

@rajeeja rajeeja commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

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_capabilities now accepts use_remote / endpoint. Grid topology and
    variable 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_remote in its own output but could not
    actually run remotely.
  • remap_variable, regrid_dataset, remap_to_rectilinear now support
    use_remote / endpoint. The remap runs on the HPC worker and returns compact
    summary statistics (and, for remap_to_rectilinear, the small rectilinear
    array, 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

  • Vector-calculus guardrail: curl and divergence now emit soft warnings
    (without blocking) when the two inputs are the same field, or when neither
    carries a velocity/flux-like units attribute. This flags the classic
    "vorticity from two arbitrary scalars" mistake. Warnings surface in
    _provenance.warnings. Implemented for both local and remote paths.
  • Remote version provenance + drift warning: remote results now record the
    worker's actual UXarray version as remote_uxarray_version, and a warning is
    added when it differs from the local version — so silent numerical differences
    between local and remote runs are surfaced.

Docs

  • README: new "Transparency & correctness safeguards" section; remote coverage
    note updated.
  • docs/tools.md: documents remote remap, the scale_by_radius echo, and the
    vector-component guardrail; removes the now-stale "local-only" note for
    remap_to_rectilinear.
  • docs/provenance.md: documents remote_uxarray_version and the drift/vector
    warnings.

Testing

  • uv run pre-commit run --all-files — all hooks pass (ruff, isort, format, mypy).
  • uv run pytest tests/ --ignore=tests/test_remote_agent.py334 passed
    (7 new tests: vector-component guardrail incl. provenance surfacing, remote
    remap dispatch + clear-error fallback, get_capabilities remote).
  • Remote compute functions validated by executing the exact worker functions
    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 registered but task submission returned
ENDPOINT_NOT_ONLINE, which requires an endpoint restart on the cluster). The
get_capabilities and inspect_mesh remote paths were confirmed live earlier,
including the version-drift warning firing against the Chrysalis worker.

rajeeja added 2 commits July 10, 2026 22:52
- 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.
@rajeeja
rajeeja merged commit ad3ccc3 into main Jul 11, 2026
7 checks passed
@rajeeja
rajeeja deleted the rajeeja/mcp-fixes-transparency branch July 11, 2026 04:17
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.
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.

1 participant