Skip to content

Resolve Ruff 0.16 findings - #2147

Merged
xeophon merged 2 commits into
mainfrom
agent/ruff-0.16-cleanup
Jul 27, 2026
Merged

Resolve Ruff 0.16 findings#2147
xeophon merged 2 commits into
mainfrom
agent/ruff-0.16-cleanup

Conversation

@xeophon

@xeophon xeophon commented Jul 27, 2026

Copy link
Copy Markdown
Member

Overview

Updates the repository for Ruff 0.16's expanded default rule set across v1 code, legacy surfaces, tests, environments, and documentation examples.

Details

  • Applies minimal code changes for v1 findings, including isolated mutable defaults, corrected exception types, import cleanup, and explicit subprocess behavior.
  • Preserves intentional framework exception boundaries with narrow rule-specific suppressions.
  • Adds file-level Ruff exemptions to legacy v0 code and tests while keeping v1 code fully checked.
  • Formats Python examples embedded in Markdown using the Ruff 0.16 formatter.
  • Leaves project dependencies, lockfiles, and uv policy unchanged.

Note

Low Risk
Changes are overwhelmingly lint, formatting, and defensive defaults; the few behavior tweaks (mutable defaults, closure capture, subprocess/async exec) are localized and low blast radius.

Overview
Brings the tree in line with Ruff 0.16’s expanded defaults: most legacy v0 packages, tests, and CLI shim modules get a file-level # ruff: noqa so CI can pass without rewriting those surfaces, while v1 and example environments are updated in place.

In v1 and tasksets, the substantive fixes are mutable Pydantic defaults switched to Field(default_factory=...) (judges, retries, env server legacy args, echo phrases, wiki judges, etc.), import / API hygiene (sorted __all__, Self, pairwise, ClassVar on class-level spec lists), and narrow lint-driven behavior tweaks such as TypeError for wrong-type validation, explicit subprocess check=False, and asyncio.to_thread for blocking shell in Terminus2’s local exec. Framework boundaries that intentionally catch broad exceptions are kept but annotated with targeted # noqa: BLE001 (and similar) instead of being refactored away.

Docs and README Python snippets are reformatted to match the new formatter; example envs get small correctness fixes (e.g. alphabet sort sort_key closure over by_first, proposer–solver JSON answer type errors). Tests pick up the same patterns (Field for list defaults, subprocess.run(..., check=False)).

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

Note

Fix mutable default arguments and resolve Ruff 0.11 linting findings across the codebase

  • Fixes shared mutable defaults in Pydantic models and dataclasses across many files by replacing list/dict literals with Field(default_factory=...), preventing cross-instance state mutation in models like NetworkPolicyConfig, RetryConfig, TaskConfig, Criterion, and others.
  • Suppresses Ruff lint warnings using # ruff: noqa file-level directives on ~100 files where wholesale suppression is preferred over inline fixes.
  • Adds targeted # noqa: BLE001 inline comments to intentional broad except Exception handlers rather than removing them.
  • Changes several ValueError raises to TypeError in validation paths (e.g. _check_borrowed_placement, Harness.resolve_prompt, EgressProxy._handle, CodexHarness.resume, AgenticJudgeEnv).
  • Fixes EnvClient to catch built-in TimeoutError instead of asyncio.TimeoutError, and wraps a blocking subprocess.run in asyncio.to_thread in LocalEnvironment.exec.

Macroscope summarized a3467d6.

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

macroscopeapp Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Purely mechanical linting and formatting changes to resolve Ruff 0.16 findings. All modifications are non-behavioral: import reordering, whitespace fixes, noqa annotations, and Pydantic best-practice patterns for mutable defaults.

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

@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: b47c50e0a0

ℹ️ 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 docs/v0/development.md
@xeophon
xeophon merged commit fd495e5 into main Jul 27, 2026
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