Skip to content

fix(v2): consolidate release-readiness correctness fixes - #2502

Merged
jxnl merged 8 commits into
mainfrom
codex/release-readiness-1.15.5
Aug 3, 2026
Merged

fix(v2): consolidate release-readiness correctness fixes#2502
jxnl merged 8 commits into
mainfrom
codex/release-readiness-1.15.5

Conversation

@jxnl

@jxnl jxnl commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • accumulate declared, nested, and unknown numeric OpenAI/Anthropic usage fields across retries while preserving non-numeric metadata
  • add corrective feedback when a Responses API retry receives no tool call
  • preserve raw iterable type hints through sync and async v2 parallel-tool wrappers
  • strengthen API-key-free coverage for current and future SDK usage counters

Consolidated and superseded items

Validation

  • focused changed-surface suite: 110 passed
  • broad offline v2/coverage suite: 2368 passed, 91 skipped, 73 deselected
  • Ruff check and format check: passed
  • scoped ty check: passed
  • uv lock --check: passed
  • pre-commit hooks and git diff --check: passed

The 73 deselected tests require live provider credentials. An unfiltered local run confirmed its 22 failures were provider network connections in the restricted environment; GitHub provider jobs remain the authoritative validation for those paths.

Intentionally skipped

These remain open because they need dedicated product, architecture, provider, security, dependency, or editorial review and are not required for the 1.15.5 patch release.


Note

Medium Risk
Changes retry usage totals and reask message content on failure paths; scope is limited and heavily covered by tests, with no auth or data-store changes.

Overview
Bundles three v2 retry and wrapper fixes for a patch release.

Retry usage accounting replaces hand-maintained token field sums with generic _accumulate_models on Pydantic usage objects. Numeric fields (including nested models and model_extra counters) add across retries; booleans and other non-numeric metadata are not treated as billable. OpenAI and Anthropic paths share this logic.

OpenAI Responses reask appends a user correction when RESPONSES_TOOLS validation fails but the output has no tool calls (e.g. reasoning-only), so retries include feedback instead of repeating the same request.

Parallel tools in patch_v2 skips prepare_response_model and does not replace response_model with the handler’s prepared wrapper for parallel modes, keeping raw Iterable[...] hints so schemas and parsed results include every member type.

Reviewed by Cursor Bugbot for commit bbddca1. Configure here.

Kropiunig and others added 7 commits August 2, 2026 17:31
…ol calls

When a Responses API completion fails validation but contains no
function_call items (e.g. a reasoning-only or plain message output),
reask_responses_tools returned the kwargs unchanged, so every retry
resent the identical request with no corrective feedback and burned
the full retry budget.

Append a plain user correction message in that case, mirroring the
no-tool-call fallbacks already present in reask_tools (#2448) and the
Anthropic reask handler (#2485).
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 3, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
instructor bbddca1 Commit Preview URL

Branch Preview URL
Aug 03 2026, 12:43 AM

@jxnl
jxnl marked this pull request as ready for review August 3, 2026 00:53

@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 using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.

Reviewed by Cursor Bugbot for commit bbddca1. Configure here.

response_model=response_model, kwargs=kwargs
)
if mode not in Mode.parallel_modes():
response_model = prepared_model

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Vertex parallel parse loses ParallelBase

Medium Severity

For Vertex parallel tool modes, the v2 patch wrapper keeps the caller’s raw Iterable[...] type and drops the handler’s prepared VertexAIParallelModel, while Vertex parse_response only runs parallel parsing when response_model is a ParallelBase instance, so wrapped from_vertexai parallel calls mis-parse multi-tool responses.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bbddca1. Configure here.

@jxnl
jxnl merged commit c9f832e into main Aug 3, 2026
35 of 36 checks passed
@jxnl
jxnl deleted the codex/release-readiness-1.15.5 branch August 3, 2026 00:56
jxnl added a commit that referenced this pull request Aug 3, 2026
## Summary

- reconcile all pending changelog entries into one unpublished `1.15.5`
section
- validate that `pyproject.toml`, `uv.lock`, the changelog section, and
comparison link agree
- replace the mutating scheduled release with a read-only weekly and PR
readiness workflow
- build once, validate and smoke-test the exact wheel on Python 3.9 and
3.13, then require an explicit version plus `publish=true` before
creating a release
- make PyPI publication consume the exact wheel and sdist attached to
the release instead of rebuilding from a moving branch

## Release safety

The default and scheduled paths cannot create a tag, GitHub release, or
PyPI publication. Publication is available only through a manual
dispatch on `main` with the exact declared version and `publish=true`,
after release checks and both wheel smokes pass. This PR does not
dispatch that path.

## Validation

- `uv run --frozen pytest tests/test_prepare_release.py -q`: 5 passed
- Ruff check and format: passed
- full source and test `ty`: passed
- `uv lock --check`: passed
- both workflow files parse as YAML
- `scripts/prepare_release.py --expected-version 1.15.5`: passed
- `uv build`: built `instructor-1.15.5.tar.gz` and
`instructor-1.15.5-py3-none-any.whl`
- `twine==6.2.0 check`: passed for wheel and sdist
- clean installed-wheel smoke: passed on Python 3.9 and 3.13
- `git diff --check`: passed

## Included / superseded

This follows merged consolidation PR #2502 and makes its release
boundary coherent. It supersedes the previous automatic version-bump,
changelog-overwrite, and branch-rebuild release paths in these
workflows.

## Skipped

- no tag or GitHub release creation
- no PyPI publication
- no dependency/provider additions
- no broad feature or architecture changes
- no social post

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> Changes how packages reach PyPI and when releases are created;
mistakes in workflow gates could block or mis-publish, but publication
requires explicit manual dispatch and uses pre-tested artifacts rather
than live branch builds.
> 
> **Overview**
> Replaces **automatic version bumps and branch rebuilds** with a
**read-only release pipeline** that builds once, validates metadata,
smoke-tests the exact wheel, and only publishes when someone explicitly
opts in.
> 
> **Release Readiness** (formerly scheduled release) now runs weekly and
on PRs touching release files: it checks `pyproject.toml`, `uv.lock`,
changelog, and tags via new `scripts/prepare_release.py`, runs
lint/type/offline tests, builds distributions, uploads artifacts, and
smoke-installs the wheel on Python 3.9 and 3.13. **GitHub release
creation** is limited to manual `workflow_dispatch` on `main` with the
declared version and `publish=true`, after smoke tests pass.
> 
> **PyPI upload** no longer rebuilds at publish time; it downloads the
**wheel and sdist attached to the GitHub release**, re-validates
tag/metadata with `prepare_release.py`, runs `twine check`, then
publishes those files.
> 
> **CHANGELOG** consolidates pending work into a single dated **1.15.5**
section and documents the new release-safety checks under Tests / CI.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
47107a9. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

Retry usage accumulation drops newer billable token fields (Anthropic stale, OpenAI overwritten with None)

4 participants