Skip to content

Remove lat_spec schema workaround after ToolRegistry releases union fix #165

Closed

Description

@rajeeja

Summary

PR #164 added a downstream workaround in registry._trim_wire_schema because ToolRegistry 0.18.1 drops branches from heterogeneous union schemas. Keep that workaround until the upstream defect is fixed and released, then adopt the fixed ToolRegistry release and remove our compatibility code.

Upstream tracking issue: Oaklight/ToolRegistry#269

Current workaround

Commit 14ed993 adds _UNTYPED_UNION_SCHEMAS / _type_untyped_unions() so the served lat_spec schema advertises both accepted wire types:

  • number
  • array<number>

The workaround is deliberately a no-op if ToolRegistry begins emitting type or anyOf itself.

When upstream releases a fix

  • Upgrade the minimum toolregistry version to the first release containing Preserve scalar and sequence branches in generated union schemas Oaklight/ToolRegistry#269.
  • Refresh uv.lock and package metadata as needed.
  • Confirm run_analysis and plot_dataset serve lat_spec as number | array<number> without local schema repair.
  • Confirm a JSON array such as [-60, 60] passes through execute_tool_calls validation.
  • Remove _UNTYPED_UNION_SCHEMAS, _type_untyped_unions(), and its call from _trim_wire_schema.
  • Retain or adapt the regression tests so the wire contract remains pinned to real registry execution.
  • Re-measure and lower the schema payload budgets if removing the workaround changes their size.

Blocking condition

Do not remove the workaround merely because the upstream issue or PR is merged. Wait until a ToolRegistry release containing the fix is available and the end-to-end tests pass against that released version.

Activity

  1. rajeeja commented on Oct 23, 2026

    @rajeeja
    CollaboratorAuthor

    toolregistry 0.19.0 is out (2026-10-23) and does contain Oaklight/ToolRegistry#269. #193 takes it. Walking the checklist:

    • Upgrade the minimum toolregistry version — floor is now >=0.19.0, with toolregistry-server>=0.7.0 beside it.
    • Refresh uv.lock and package metadata.
    • Confirm run_analysis and plot_dataset serve lat_spec as number | array<number> — they do.
    • Confirm a JSON array such as [-60, 60] passes validation — the existing wire tests cover this and pass.
    • Remove _UNTYPED_UNION_SCHEMAS / _type_untyped_unions — not done, see below.
    • Retain the regression tests against real registry execution.
    • Re-measure the payload budgets.

    Why the workaround stays

    The fix works, but it is not sufficient for this parameter. lat_spec is annotated tuple | float | list[Any] | None, and tuple and list both render as array, so 0.19 emits:

    anyOf: [ {"type":"array","items":{}}, {"type":"number"}, {"type":"array","items":{}} ]
    

    The array branch twice, with untyped items. Valid JSON Schema, and a client would work from it, but it is a duplicated branch in a payload we budget and it drops the item type we know.

    So the helper changed role rather than going away: it used to fill an absent type, and now replaces a poor rendering with the canonical one. Net effect on the served spec is negative — 36271 → 36143 bytes — because the duplicate goes away.

    Two ways to actually close this:

    1. Narrow the annotation to float | list[float] | None and drop tuple. JSON has no tuple, so no MCP client could ever send one; the only caller who can is Python. That would likely make upstream's rendering correct and the helper genuinely dead.
    2. Ask upstream to de-duplicate identical anyOf branches.

    (1) is ours to do and is probably the right follow-up. Leaving this open and re-scoped to that.

    Separately, worth knowing: toolregistry-server 0.7.0 began inferring tool annotations, and marked manage_session and resume_workflow readOnlyHint=True — both change state. #193 makes our ratings authoritative and clears inferred hints on tools we left unrated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions