Skip to content

Update Ruff and ty tooling - #2148

Merged
xeophon merged 5 commits into
mainfrom
agent/update-ruff-ty
Jul 27, 2026
Merged

Update Ruff and ty tooling#2148
xeophon merged 5 commits into
mainfrom
agent/update-ruff-ty

Conversation

@xeophon

@xeophon xeophon commented Jul 27, 2026

Copy link
Copy Markdown
Member

Overview

Updates the repository tooling to Ruff 0.16.0 and ty 0.0.63, with hooks using the locked project environment.

Details

  • Pins both tools in the development dependency group and refreshes the lockfile.
  • Adds bounded package-specific freshness cutoffs for the explicitly selected releases.
  • Runs the Ruff and ty hooks with uv run --locked so local hooks use the committed versions.
  • Adds rule-scoped ty suppressions for pre-existing diagnostics in the legacy code checked by the newer ty release.

This PR is stacked on #2147 to keep the tooling upgrade separate from the Ruff cleanup.


Note

Low Risk
Tooling and type-check suppressions only; no production logic changes. Main risk is CI/pre-commit failing if Ruff 0.16 or ty 0.0.63 report new issues beyond the added ignores.

Overview
Upgrades Ruff to 0.16.0 and ty to 0.0.63, with dev dependency floors, a refreshed uv.lock, and tool.uv.exclude-newer-package cutoffs for those two tools.

CI pins Ruff 0.16.0 in the style workflow. Pre-commit runs Ruff and ty via uv run --locked so hooks match the lockfile.

Across verifiers/, adds ty:ignore[...] (alongside existing type ignores) for diagnostics surfaced by the newer ty release—clients, envs, rubrics, utils, and related paths—without changing runtime behavior.

Reviewed by Cursor Bugbot for commit c8b2354. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Update Ruff and ty tooling to fix mutable default and type annotation issues across the codebase

  • Bumps ruff to >=0.16.0 and ty to >=0.0.63 in pyproject.toml and updates CI in style.yml to match.
  • Adds # ruff: noqa file-level directives to ~100 files where existing code patterns cannot cleanly satisfy the stricter rules.
  • Fixes shared mutable default bugs in multiple Pydantic models (TaskConfig, RetryConfig, NetworkPolicyConfig, RubricJudgeConfig, EnvServerConfig, etc.) by replacing bare list/dict literals with Field(default_factory=...).
  • Changes several ValueError raises to TypeError in type-guard and validation contexts (agent.py, harness.py, egress.py, agentic_judge/env.py, etc.) to align with Python conventions.
  • Replaces typing.Callable/typing.Iterator imports with collections.abc equivalents and updates asyncio.TimeoutError catches to TimeoutError in EnvClient.
  • Risk: EnvClient._request and EnvClient.ping_server now catch TimeoutError instead of asyncio.TimeoutError; since asyncio.wait_for raises asyncio.TimeoutError (a subclass of TimeoutError), this is functionally equivalent, but callers relying on asyncio.TimeoutError type specifically may be affected.

Macroscope summarized c8b2354.

@macroscopeapp

macroscopeapp Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Mechanical tooling upgrade updating Ruff linter and ty type checker versions. Changes are formatting adjustments, import reordering, lint/type ignore comments, and minor Pydantic mutable default fixes. No significant runtime behavior changes.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3e2e784a41

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4dd4882. Configure here.

Comment thread pyproject.toml
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 27, 2026
@xeophon
xeophon force-pushed the agent/update-ruff-ty branch from 12bbe71 to c8b2354 Compare July 27, 2026 13:03
stack merge was automatically disabled July 27, 2026 13:03

Pull Request is not mergeable

stack merge was automatically disabled July 27, 2026 13:04

Pull Request is not mergeable

Base automatically changed from agent/ruff-0.16-cleanup to main July 27, 2026 13:04
@macroscopeapp
macroscopeapp Bot dismissed their stale review July 27, 2026 13:04

Dismissing prior approval to re-evaluate c8b2354

@xeophon
xeophon merged commit 0080475 into main Jul 27, 2026
10 of 12 checks passed
rasdani added a commit that referenced this pull request Jul 27, 2026
Four conflicts, all from tooling churn rather than overlapping design — nobody
else has been in artifacts.py, the Harbor artifact wiring, or the topology logic.

- verifiers/v1/__init__.py, task.py, tasksets/harbor/taskset.py: import ordering.
  #2146 relocated `configs.task`/`configs.taskset` and #2148's isort re-sorted the
  package; my artifacts imports had landed on the same lines. Kept both sides.
- envs/agentic_judge/env.py: #2147 changed the solver-runtime guard from
  `ValueError` to `TypeError` for Ruff 0.16, on the same line where I had rewritten
  the message (the check no longer means "the judge plays in the solver's box").
  Took their exception type with my message.

Also converted three pydantic mutable defaults to `Field(default_factory=...)` —
`Artifact.exclude`, `TaskData.artifacts`, `HarborData.collect`. Not conflicts, but
Ruff 0.16 flags them and CI would have failed on the merged result.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
eligotts added a commit that referenced this pull request Jul 31, 2026
…fload

Picks up 35 main commits: the v1 structure cleanup (#2146) that retires
StrictBaseModel and renames _NODE_DUMP_EXCLUDE -> EXCLUDE_FIELDS, the
ruff 0.16 / ty tooling bump (#2147, #2148), runtime-on-agent + agent
config stamped on the trace (#2106), Reward score/weight records (#2119),
MCP tools for Codex (#2140), and assorted v1 fixes.

Resolutions:
- trace.py: main's restructure subsumes this branch's block wholesale —
  EXCLUDE_FIELDS already carries multi_modal_data, and TRACE_VERSION=1 is
  main's deliberate reset (this branch never touched it). Took main.
- graph.py: kept the raw-mm sidecar validators and
  previous_multi_modal_data; adopted main's plain BaseModel now that
  StrictBaseModel is gone.
- clients/train.py: kept the is_multimodal import — still used by the
  bridge path that threads previous_multi_modal_data.

Ruff 0.16 flagged two spots this branch added that main's cleanup pass
never saw: a constant getattr in the ingress offload walker, and the
blind except at the prepare_request_body boundary (annotated noqa, per
main's own convention at rollout boundaries).
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.

2 participants