Skip to content

feat(release): consolidate reviewed Instructor 1.18 changes - #2708

Merged
jxnl merged 15 commits into
mainfrom
codex/1.18-integration
Oct 10, 2026
Merged

jxnl merged 15 commits into
mainfrom
codex/1.18-integration

Conversation

@jxnl

@jxnl jxnl commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator

Current Candidate: Jev and OpenAI Decisions

Exact head: 9e7a61a9d85aacd812ec8e77a68b9d2adaecef66. OpenAI Decisions support and the same sync/async provider/configuration contract family as OpenRouter and TypeSafe are included. Shared suite: 294 passed, 1 existing skip. Decision source has 373/373 statements covered; source unchanged since coverage measurement. Full source typing, test typing, and normal commit hooks passed. Six opt-in live provider cases were skipped without explicit opt-in; no billed API calls. Native OpenAI image input and live OpenAI compatibility remain unverified.

Documentation: complete MkDocs build passed (13.17s; existing navigation/docstring warnings), primary example model definitions executed without API calls, guide linked in navigation, and OpenAI entry included in 1.18 release notes. Guide documents all three routes, raw wire differences, text-only support and shared/live test configuration.

Fresh exact-head CI and required independent approval remain mandatory. Old-head auto-merge was disabled before updates. Previous-head checks below are historical evidence, not current proof. No merge or publication in this continuation.

Implementation and earlier validation details.

Prior Integration Evidence

Summary

Curated Instructor 1.18 integration from main e12f8b49203b0c1f253d27c1e709d0a09b9fc5a8, current candidate b76939ea652202842ae26aec4663ef52d13356d7. Ready for independent review; this is not approval to merge or publish.

The selected patches were revised where needed, not merged blindly. New transport contracts use real SDKs and loopback HTTP/gRPC, not new mocked provider clients. Existing legacy mocks are not claimed as live provider evidence.

Validation

Current candidate: b76939ea652202842ae26aec4663ef52d13356d7. Earlier local results below are for head a3137a76159611c080ebcc0c36ccf0383901e2f2 unless a different head is named.

  • Normal commit hooks: Ruff lint/format and source typing passed.
  • Whole-test-tree typing passed with the SDK-complete environment.
  • Read-only final runtime review identified a Python 3.9 nested-generic class-check defect; fixed and independently reverified locally. This is not GitHub approval.
  • Minimum-version OpenAI loopback retry/cache/parallel contracts: 36 passed. Other SDKs are absent from this temporary core-only environment; their contracts passed in the full SDK-complete Python 3.13 suite, not in the minimum environment.
  • Focused Python 3.9/Pydantic 2.8.2 compatibility: 174 passed, 6 version skips.
  • Isolated wheel built from sdist: Python 3.9.25/OpenAI 2.0.0/Pydantic 2.8.0 contracts and credential-free CLI help passed.
  • Isolated wheel built from sdist: Python 3.13.11/OpenAI 3.3.0/Pydantic 2.13.5 contracts and credential-free CLI help passed.
  • Release metadata/changelog extraction validates 1.18.0.
  • All 29 runnable remote checks passed at a3137a76159611c080ebcc0c36ccf0383901e2f2; publication was intentionally skipped. Required independent review remains unsatisfied.
  • Cursor Bugbot found that parallel parsing of an empty/prose response could escape the retry boundary as an unhandled exception. Head 9bcef9849fa609040c65fec30f1d3869e64d415e adds ResponseParsingError guards and a missing-tool-calls regression test. Its full offline suite passed 3,963 tests, but the zero-missing-statements gate failed on the untested empty-choices branch. Head ba0db64bad4d9112fdcaef082bfd9a382a25e57c adds that SDK-validated regression test; the complete focused parallel suite passed 54 tests, plus Ruff lint/format and focused test typing.
  • At ba0db64bad4d9112fdcaef082bfd9a382a25e57c, all 29 runnable CI checks passed and publication was intentionally skipped. Full offline coverage ran 3,964 passed, 200 skipped, 859 deselected, with zero missing statements and 4 missing branches. No threshold was reduced.
  • The current head changes only the decisions example and changelog accuracy: its primary example constructs under Python 3.9, and a full mkdocs build --clean passed. At b76939ea652202842ae26aec4663ef52d13356d7, all 29 runnable CI checks passed, publication was intentionally skipped, and full offline coverage reported 3,964 passed, 200 skipped, 859 deselected, zero missing statements, and 4 missing branches. Independent maintainer approval remains outstanding.
  • Full credential-free offline suite: 3,962 passed, 200 skipped, 859 deselected, with runtime/unraisable/thread warnings treated as errors.
  • Combined statement/branch coverage: 99.9700%, 0 missing statements, 4 missing branches; unchanged >=99% and zero-missing-statement gates passed. Existing version/optional/runtime exceptions remain disclosed; no threshold reductions.
  • Focused decision-mode contracts at the same head: 240 passed, 1 skipped with credentials removed and localhost transport enabled. The initial sandbox-only run could not bind loopback sockets; the unchanged suite passed when loopback binding was permitted.
  • Opt-in live OpenRouter Jev model (typesafe/jev-1.13): sync and async contracts passed using the configured local key. No credential or response payload was added to this PR. Direct TypeSafe/Jev live calls remain unverified because TYPESAFE_API_KEY is unavailable.
  • Full mkdocs build --clean passed at the same head, writing only to a temporary site directory. It reported existing nav omissions and two griffe annotation warnings; no documentation build errors.

No other live provider calls were made in this integration validation. Exhaustive repository security certification is not claimed. The Bugbot finding was addressed and its review thread resolved. Current-head CI passed; required independent maintainer approval remains the merge gate. No publication, tag, deployment, main merge or issue closure.

Security and Compatibility

  • Reject the entire local-use NAT64 64:ff9b:1::/48 prefix. Its translation layout is network-specific; assuming a fixed embedded destination is unsafe for this fetcher's public-network-only policy (RFC 8215, section 5). Known well-known NAT64/mapped/compatible/6to4/Teredo destinations are checked as well as their IPv6 wrapper.
  • Streaming input limits are 1,048,576 characters and 128 nested containers, sync/async. Errors remain ValueError; complete objects can still emit before EOF.
  • Unknown parallel calls now raise ResponseParsingError inside retry rather than silently losing results. Nonstream validation is eager while the returned public generator type is preserved.
  • Incomplete Responses raise IncompleteOutputException before defaults or caches can turn partial output into an accepted answer. SDK metadata/reason remain attached.
  • Citation context accepts strings or lists/tuples of strings; malformed supplied sources fail closed. Missing context preserves existing behavior.
  • Decision mode is opt-in and currently does not support retries, caching, streaming or completion hooks. OpenRouter Jev sync/async compatibility passed live; direct TypeSafe/Jev compatibility is still supported by shared offline contracts only.

Overlaps and Deferrals

Reviewed the current 78-PR/28-issue queue. Compact selected changes received detailed source review; large providers/features/architecture received scope triage, not blanket approval. Absent CI is not passing. The table below records every source head inspected; these heads are not independently certified merge-ready.

Every Open PR

PR / Inspected Head Decision
#2707 a2f0b309464b70b8936054466e6a365d16c9cb39 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2704 5061c6866f2c94f46eedd4336753e9db8215fd9b Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2703 248effa5c97e5c046685d7c6b144c4cbc7863702 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2701 82a083207fe45993e339d74a96c5d2b0cba634fc Blocked: recursive described $ref causes infinite recursion; mappings change meaning.
#2700 79aa81e1dec364422dcac7401e67c150a547250c Deferred: buffers valid streaming output until EOF, breaking incremental behavior.
#2699 27dd66315794394a9c471c6a75c2ad4b538abae6 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2698 59316edcbe5c1f3cc094d70f042a9d43a26a8db5 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2697 692433fa8e04c21274232d83d042a27f37113924 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2693 bfd56e7dda4d3444fd4d866f1c7399a5bee58b55 Deferred: reconcile strict-schema required/defaulted fields and mapping policy together.
#2692 89f9db983865175e92a7096615ce2bcc454bfb07 Separate dependency maintenance: compatibility and supply-chain review required.
#2691 81f28eb416c206c1b8ae702705e66007ac5e107d Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2690 7c829eb06297d07bcd1ff957c481d8c042ef64da Deferred editorial: patch still leaves incorrect provider spelling/capitalization.
#2689 9688857ccba01dbebc4d3f5db0c1d158780c6c73 Deferred docs/examples: maintenance/product choice; no correctness-release necessity.
#2688 f47161c87b872e13e54aecb9aed24e1a131a938b Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2686 545232b6ff01f78fb938e84daeec4e876dfb45da Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2685 7782155fc19e435173fa32ab7d5f78815bf99111 Blocked: rejects native Converse tool histories and loses multiple system blocks.
#2683 3b09a98e768bfd2955164fe320cf0994a6f4b2a5 Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2680 7f70d2099a4b598f67a1b09e00ad7bed15cb832b Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2678 0bed63816628aec034f5fc965b8d719d48bb0b8e Deferred: broader mapping-field response model construction.
#2677 2c0276aea1b25f061b3949b9883bd482ddd183cc Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2675 e69a43d3cd7b8a3a8df758c946af510ef036e917 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2673 06d34c3039faf530296960d24d50e8df8f9d9a6b Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2672 4df16706ab588da537f76edec57b33ae9ff6141b Deferred: Mistral batch needs failure/error-file retrieval and provider evidence.
#2671 c3d95dccd28e803fa08cd89c87f5692ea044701a Deferred: global StrictUndefined is a deliberate compatibility change.
#2670 9763946ad1795ad6428daf277df06a07ee3c5dda Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2668 2b028330d359994d3cd6c7ee6f2274bb950b2310 Blocked: AliasChoices/AliasPath are unhashable in proposed alias set.
#2667 137b253c9e8b50602c39466c135b2e3c7400e3e0 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2666 f2a1c390cd605c9928029d937c860b22456d26f2 Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2664 77f427ad196bed5c3bd6d61b3bd0855285d8e8e1 Split first: useful Mistral usage-only fix, but Google empty candidates can erase safety refusal.
#2662 4c6e06613fc30a3ef6d29374e8df92bfb2a4122d Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2660 1207effdd29b1aa1da9e0a283eda5551835f1a01 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2657 8f619b3ab20d5cc6914b42c38bba80f6aa8c4585 Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2656 01c7bee784497eb87c7edab13ff1c64095f2c93c Deferred docs/examples: maintenance/product choice; no correctness-release necessity.
#2655 f4ce1943f2d666c465728062bc342d8934c55e66 Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2652 4bd39745d0ba809e293973697aa7a0be8ab64c81 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2651 68786153500ce306f5bd65bb051aedd080e48a73 Next compact batch: promising fixes, require exact-head runtime and combined validation.
#2649 f704f3530caef4891214a00dac7abd8496e92e96 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2647 9bfaa3b75f83568063fa38dbd84d28a0a0848c0d Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2646 a6dce755f054b1b2088faf8fffaea7dbfac05db7 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2644 eda57883460ed8329775e9de4ede4a87b2786c67 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2643 0fd74545d374afb249d01667a280115fa75b1156 Deferred: main rejects async validators; set traversal is not a release necessity.
#2642 f208aec71909a7b27358bbdbfc2638a574585776 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2641 2506e18dd4ed4e12bcc25069a4ce449138cf03b1 Deferred: reconcile strict-schema required/defaulted fields and mapping policy together.
#2640 ca1fe9e902abdb5a1aea9eab04afdb133ae39c83 Separate maintainer metadata hygiene.
#2639 e91095777cf4d031e7414bcaa427ab989c42f96e Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2638 54ee418cad55aa93d9b6d1623a2e1b5ba066796e Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2637 8b580fe0f2503dfa758a2d5be5957db81794c6ef Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2636 3152a697f423b32bbe25af8021a948c35d8af41c Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2634 aab02eaba1215a0f1e6ccf2139e88b1cc5539a8d Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2633 2f337b3148717a76209616b72052ff1d4fb95709 Deferred: timeout contract needs regression proof; current CI red.
#2632 ad3e32283f0ae51b3f06f5e06dc0415be282c5f5 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2630 e5515c629eb4a94fab9953a1647de0ee66797132 Overlap: selected broader alternatives; older variants regress Python 3.9 or metadata.
#2629 438debe231c3a49c9168b478ec82a82055983f47 Integrate/revise: reviewed compact fixes; preserve compatibility and repair tests.
#2605 7e7d33a821b1b1593257a820ab52e656317405a8 Blocked: cache values inherit and retain weak keys; GC test does not prove collection.
#2604 ce322502e3f4ba1f0ff62d5524965fec5233806a Deferred: markdown sanitization needs adversarial regression oracle.
#2602 a1229322d2b865d0224a2a94d222375eae4396bc Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2598 6b153c8ba75e25461c43cd05c9b52f67ae3cb830 Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2574 0df33ba1111a6dc9da6788429bab9d4106bef2ae Separate dependency maintenance: compatibility and supply-chain review required.
#2573 2485aa6f4b9d7b7cb445214547968e1a7e61b564 Separate dependency maintenance: compatibility and supply-chain review required.
#2572 c152a36b244b5e2618bd5e06e13ee1ce1876fa65 Separate dependency maintenance: compatibility and supply-chain review required.
#2571 db4abe9654e386acbe9e64585b56bda419b0daa7 Separate dependency maintenance: compatibility and supply-chain review required.
#2570 47caa02a3a924ee4f889e6cba9572da58ff40398 Separate dependency maintenance: compatibility and supply-chain review required.
#2531 4f0a66465f96f08e256cdc3f0608e7578cf2ad9d Deferred docs/examples: maintenance/product choice; no correctness-release necessity.
#2468 6e68201124bca8957d4fe5ca42bd4ef5203e77c6 Deferred docs/examples: maintenance/product choice; no correctness-release necessity.
#2435 bb31451d31df1220509538fbf4e4a01c0d7a79ca Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2423 3b4389f70fdefd30f0be65219d27e981ff4cd98a Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2409 87a9bf8a3a1579b0d394e92226cb315440c79427 Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2405 82e90e9bea0da26e20d2d37add94b9cc29b42af7 Deferred docs/examples: maintenance/product choice; no correctness-release necessity.
#2394 bc55f4f639ad352fd9314b9f6f477971b6ee4e83 Deferred product/security design: routing and injection-defense guarantees need evaluation/threat model.
#2384 b7371363d705acb8c1cd344efc293cd42369ea69 Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2357 182609c2e4789ebb40430ecba3407c27b50ebd52 Deferred architecture stack: separate migration and release; tests/docs target parent branch.
#2356 913a6053a0047b2c97c07768f9374c8a5243c9a9 Deferred architecture stack: separate migration and release; tests/docs target parent branch.
#2355 b3c44096ecd5f92619743bf3182ce21a3aef6e1d Deferred architecture stack: separate migration and release; tests/docs target parent branch.
#2322 222c4f12430eea028f5895a68c96f15cbcd7513e Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2321 b70f25defed4c8e0927b836fdb9ea01a9b5c1d9f Deferred product/security design: routing and injection-defense guarantees need evaluation/threat model.
#2311 d5df24eb3a973a0462c04988a69e05baddd3ad79 Deferred docs/examples: maintenance/product choice; no correctness-release necessity.
#2306 a960f6462a22a559f05ae14e9159c84e71bae19f Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.
#2283 5bbaa6217e83b5d69d862fd12470aef57a77c5ca Deferred providers/auth: scope-triaged, need ownership, SDK/wire contracts and live evidence.

All Open Issues

No superseded item is closed yet: consolidation must receive review first. Use this PR rather than merging overlapping patches separately. Strict-schema #2701 is blocked by recursive $ref overflow and mapping semantics; #2700's EOF buffering is excluded because it breaks streaming. The deferred dependency/provider/architecture groups require separate validation and ownership.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 27, 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 9e7a61a Commit Preview URL

Branch Preview URL
Oct 08 2026, 05:06 AM

@jxnl

jxnl commented Sep 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

Final local review found an additional Python 3.9 nested-generic class-check failure. Fixed at a3137a7 with four real preparation/schema/value regressions; the minimum-version focused suite passes. The prior 01469b6 local full suite/coverage passed; its last observed CI snapshot had 28 successful checks and OpenAI Tests still pending, not a completed all-green proof. Full offline and installed-wheel validation are rerunning for the updated head, which remains draft with required independent review. No merge or publication.

@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 prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Parallel parse crashes on missing tools
    • Updated ParallelBase.from_response to raise ResponseParsingError when OpenAI responses have no choices or tool_calls (and added a regression test), so the retry loop can catch it.

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit a3137a7. Configure here.

Comment thread instructor/v2/dsl/parallel.py Resolved
@jxnl
jxnl disabled auto-merge October 8, 2026 05:00
@jxnl

jxnl commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

OpenAI Decisions support is now included in this same Jev/consolidation PR at 131832a7ea671fe6f1715cb45c7087dde39fbe4b, superseding b76939ea as the candidate head. Previous-head CI is not evidence for this head.

  • Uses openai/gpt-6-luna with Mode.DECISIONS and POST /v1/decisions. Shares typed models and Pydantic validation with Jev; explicitly translates OpenAI input, ordered questions/answers, predicate probabilities, choice descriptions, score levels and refusals. Preserves the original response, probability arrays, confidence and usage.
  • OpenAI joins the same sync/async provider contract family as OpenRouter and TypeSafe: authentication, borrowed-client timeouts and ownership, context/template validation, alternating-client isolation, raw metadata, malformed JSON/envelopes, HTTP failures and recovery. Added predicate/score/choice invalid-answer and structured-metadata cases.
  • Shared decisions suite: 288 passed, 1 existing skip, using real localhost HTTP, no new mocks or paid API calls. Decision-module statement coverage: 373 statements, zero missing. Full source type check and normal commit lint/format/type hooks passed. Test-file typing passed.
  • Added matching opt-in live OpenAI sync/async tests alongside OpenRouter/TypeSafe. All 6 live cases skipped without --run-decisions-live. OpenAI output-token accounting is explicitly zero; Jev's existing positive-token expectations remain intact. Live OpenAI compatibility is not claimed.
  • Current scope is JSON-serialized text context; OpenAI inline-image input is not supported. Structured Jev criteria/examples become descriptions or predicate instructions. Original Jev wire shapes stay unchanged. Official contract: https://developers.openai.com/api/docs/guides/decisions and https://developers.openai.com/api/reference/python/resources/decisions/methods/create.
  • Reviewed and simplified the addition: one explicit provider wire adapter, common validation and shared transport; no generic framework. Only maintained docs/changelog and runnable tests in the final addition; no audit reports committed.

Old-head auto-merge was disabled before updating the branch. Fresh exact-head CI and required independent approval remain mandatory before a normal merge; no old waivers apply. GitHub/PyPI publication is user-authorized only after merge and actual merged-commit/artifact validation. Nothing has been merged or published in this continuation.

@jxnl

jxnl commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Live OpenAI Decisions validation on exact head 9e7a61a: both sync and async real OpenAI contracts passed (2 passed, 4 non-OpenAI cases deselected). Verified choice, predicate, scaled score, probabilities, confidence, and untouched raw usage metadata. Command: pytest tests/llm/test_decisions/test_live_decisions.py --run-decisions-live -k openai -q -rA. Fresh credential-free Decisions suite also passed: 294 passed, 1 existing skip. This supersedes earlier live-OpenAI-unverified evidence for these two cases only; native image input and broader live coverage remain unverified. No merge or publication performed; exact-head CI and required independent approval remain separate gates.

@jxnl

jxnl commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator Author

@vm Jason requested that we complete the independent review so this can merge and release 1.18. Please review the current exact head 9e7a61a and submit an APPROVE or REQUEST_CHANGES review. All 29 runnable exact-head checks pass (publication skipped); both real OpenAI Decisions sync/async tests pass, and the focused Decisions suite passes 294 tests with one existing skip. The full docs build passed. Earlier reviews are on older heads. Particular attention requested for native OpenAI wire translation/raw metadata, Jev compatibility, Python 3.9, and the consolidated core changes. Current evidence and limitations are in the PR body and comments. Main requires one independent approval; no bypass or publication before normal merge and merged-commit validation.

@jxnl
jxnl enabled auto-merge October 10, 2026 21:47
@jxnl
jxnl merged commit 035c77b into main Oct 10, 2026
30 checks passed
@jxnl
jxnl deleted the codex/1.18-integration branch October 10, 2026 21:48
jxnl added a commit that referenced this pull request Oct 20, 2026
## Scope

Current candidate: **68f4e4e1211e7672463ae76495bade22f8c41c17**. All 29
runnable current-head checks passed; publication skipped. Independent
review found a recursive-schema crash in f4d7424; it was fixed and
independently re-reviewed at 93a913e. The external autofix then added
one more regression test in two commits; the runtime tree is unchanged.
That test-only delta has also been independently reviewed with no
actionable findings. Required approving GitHub review requested from
`vm` remains the sole merge blocker. Publication remains explicitly on
hold.

The user additionally selected batch strict-schema and failed-result
retrieval fixes. OpenAI schemas now require defaulted/nested fields,
normalize references/compositions, preserve aliases and metadata, and do
not mutate caller-owned schemas. Arbitrary-key mappings raise an
explicit error instead of silently losing their value schema; Anthropic
mappings are unchanged. Boolean-schema preservation is compatibility
behavior, not proof that OpenAI accepts every custom schema.

Completed OpenAI retrieval includes both output and error files, waits
for files indicated by request counts, and supports error-only batches.
With unknown counts it reads announced files without claiming their
completeness. Ended Anthropic batches return failed request records even
when none succeeded. Provider error type/message, request IDs and
original records are preserved. Running jobs remain unavailable. Added
native SDK/localhost retrieve-download contracts without new mocks or
paid requests.

## Current Validation

- Entire 25-file independent review found one P2: recursive described
references could create a cyclic dictionary and raise RecursionError.
Self-recursive and mutually recursive tests reproduced the failure
before the fix. Copied reference nodes and path-local active references
now preserve recursive back-references, metadata and strictness without
cycles. The generated schemas validate nested instances with Draft
2020-12 validation.
- Independent re-review verified the immutable 93a913e patch and found
no remaining actionable issue. 457 tests passed during the whole-diff
review at f4d7424; 78 focused tests passed after the repair. This
engineering review cannot substitute for the required independent GitHub
approval.
- The final test-only delta was independently reviewed at immutable
68f4e4e; all 19 schema cases passed. All **43 batch regressions pass
against the runtime-identical 93a913e installed wheel** on Python
3.9/OpenAI 2.0/Pydantic 2.8 and Python 3.13/OpenAI 3.3/Pydantic 2.14.
That wheel was built from sdist and passed Twine checks without
uploading.
- [Final exact-head full coverage
CI](https://github.com/567-labs/instructor/actions/runs/38118982055)
passed **4,140 tests, 200 skipped, 862 deselected**, 106 existing
warnings. It independently reports zero missing of 9,906 statements and
four missing of 3,514 branches; the unchanged 99% gate and zero-missing
assertion passed. Local runtime-identical 93a913e validation separately
passed 4,139 tests with **99.9702% coverage**. No old-head CI is reused.
- All 29 runnable final-head checks passed, including source/test
typing, lint, Python 3.9-3.13 offline coverage, wheel matrix and
provider jobs. [Current-head release-readiness
CI](https://github.com/567-labs/instructor/actions/runs/38118982058)
passed artifact preparation and Python 3.9/3.13 wheel smoke; publication
was skipped. Provider success badges do not certify skipped live
scenarios.
- Checkout and final diff are clean; all 25 files are maintained code,
tests, docs or changelog. No ad hoc reports or task plans are included.
- The matching old-head Bugbot finding is addressed in [this review
thread](#2767 (comment))
and resolved after test-backed independent verification. Requested
maintainer approval must cover the current head, not f4d7424. No admin
waiver applies to this PR.

## Prior Validation At f4d7424

- Final frozen-file combined offline suite: **4,137 passed, 200 skipped,
862 deselected**, 106 existing warnings, with CI mode, dotenv disabled
and API_KEY environment variables removed (374.22 seconds).
- **9,906 statements, zero missing; 3,514 branches, four missing;
99.9702% combined coverage.** The unchanged 99% gate and
zero-missing-statement assertion passed. The initial run overlapped
final schema edits and is not used as coverage proof; a fresh
separate-database run produced these final totals.
- Full source and test typing, Ruff lint/format checks, normal commit
hooks and clean diff passed.
- Final MkDocs build passed with existing nav/docstring warnings; wheel
built from sdist, and both Twine checks passed.
- **40 new batch regressions passed against the installed final wheel in
each environment:** Python 3.9/OpenAI 2.0/Pydantic 2.8 and Python
3.13/OpenAI 3.3/Pydantic 2.14. Site-packages imports verified, not
source-checkout imports. Prior 95-case installed-wheel proof belongs to
7ca0073.
- Common provider finalization/regression suite: 215 passed; falsey
adapter matrix rerun passed all 28 cases after test typing refinement.
- Independent read-only re-review of the new batch fixes, generated
TypedDict serializer and inherited finalizer found no actionable
finding. Review did not itself run tests and does not constitute GitHub
approval. Nested TypedDict-with-optional-key and direct
provider-entry-point matrix extensions remain additional coverage
opportunities; existing broad provider suites are separately validated.
- Independent final read-only batch review found no remaining actionable
issue after reference normalization and readiness/JSONL test gaps were
addressed. This does not constitute GitHub approval.
- All **29 runnable exact-head CI checks passed**; publication skipped.
[Full coverage
CI](https://github.com/567-labs/instructor/actions/runs/38092004959)
independently confirms 4,137 passed, 200 skipped, 862 deselected and
zero missing statements. [Release-readiness
CI](https://github.com/567-labs/instructor/actions/runs/38092004970)
passed preparation and wheel smoke tests without publishing. Provider
job success is not a claim that every live provider scenario ran; for
example, Google core-provider tests were skipped for missing settings.
- Initial independent GitHub review request sent to `vm` with
[exact-head
evidence](#2767 (comment)),
then updated to corrected head 93a913e in the addressed review thread
above. Do not treat approval of the old head as approval of the fix.

## Production-Wide Simplicity Review

Inspected all 205 production Python files across provider
implementations, core/DSL/validation, public/legacy/batch/CLI,
Decisions, and root integration. This is an
implementation/maintainability review with targeted regression
validation, not exhaustive security certification or universal
live-provider proof.

- Consolidated four identical OpenAI/Anthropic/Mistral/xAI result
finalizers into the existing ModeHandler base. Preserve SDK-specific
parsing, iterator laziness, falsey adapters, and exact raw-response
identity; old imported module names remain explicit compatibility
exports. Added a common four-provider behavioral matrix.
- Reproduced and repaired missing Anthropic tool input being accepted as
a defaulted empty result. Explicit returned empty objects still work.
- Reproduced and repaired request-ID/metadata loss on invalid non-object
batch payloads.
- Reproduced and repaired underscore TypedDict cache misses and
optional-key omission loss. Generated TypedDict models use narrowly
scoped round-trip serialization; arbitrary user-model alias behavior is
untouched.
- Kept compatibility facades, provider wire/SDK exceptions, security
limits, and streaming transport paths intact. Strict-schema and
failed-batch retrieval findings are now fixed with user authorization.
Streaming validation, native xAI context, CLI and registry-capability
issues remain focused follow-ups, not silently folded into this patch.

Integrate the five user-selected compact fixes onto main after #2708,
retaining version 1.18.0. Publication is explicitly on hold.

- [#2743](#2743) at
5c03dfd: validate complete batch
payloads with Pydantic, including RootModel and empty objects with
defaults.
- [#2758](#2758) at
13a11f4: retain Anthropic errored
result type/message, custom ID and raw record; preserve legacy error
handling.
- [#2757](#2757) at
3156d55: preserve underscore-prefixed
TypedDict keys with collision-safe internal fields and original aliases.
- [#2764](#2764) at
ab9b0c2: replace nonfunctional logging
environment instructions and unsupported correlation-ID claims.
- [#2765](#2765) at
faae38e: use the public Maybe model
factory instead of nonexistent field APIs.

The batch processor overlap is reconciled against merged main
035c77b. Release notes are consolidated
under 1.18 rather than separate Unreleased sections. Dynamic TypedDict
test construction and prepared-model narrowing were repaired for the
full test typing gate, without weakening assertions.

## Prior Validation

Candidate head: 128cf44.

- Focused combined regressions and Decisions contracts: 341 passed, 1
existing skip.
- Full source and test typing passed; repository Ruff lint/format checks
and normal commit hooks passed.
- Full MkDocs build passed with existing navigation/docstring warnings.
- Wheel built from sdist; Twine checks passed for both distributions.
- All 47 new batch/TypedDict regression cases passed against the
installed wheel on Python 3.9 with OpenAI 2.0.0/Pydantic 2.8.0 and
Python 3.13 with current core dependencies. Imports were verified to use
site-packages, not the checkout.
- Release metadata/notes validation passed for 1.18.0.
- Exact-head remote full offline suite: 4,057 passed, 200 skipped, 862
deselected; zero missing statements and four missing branches. The
unchanged 99% coverage gate passed.
- All 29 runnable exact-head CI checks passed, including Python 3.9-3.13
coverage, lint/type checks, wheel matrix, and release readiness/smoke
tests. Publication was skipped. Independent approval remains required;
this PR stays draft while the user-requested production-wide simplicity
review is ongoing.

The initial local full-suite invocation inherited provider keys and
lacked INSTRUCTOR_ENV=CI; it unexpectedly selected unmarked provider
tests and was stopped after 1,286 passes/15 skips. It is not complete
offline validation and is not used as a release gate. The corrected full
coverage run uses the repository's CI mode with API keys removed. No
intentional paid-provider experiments were added.

No new mocks, threshold changes, tags, issue closures or publication.
All 25 final files are maintained code, tests, docs or changelog; no ad
hoc reports/task plans are included. Source PRs are credited without
automatic issue-closing keywords.
jxnl-oai added a commit that referenced this pull request Nov 5, 2026
Consolidates OpenAI batch request error handling. Current main already
retrieves both output and error files for completed jobs, preserves the
raw record and uses provider type before code. Keep that public
contract, preserve string errors at either location, and report
unsuccessful HTTP status codes when the provider omits the error body.
The full provider code is available in raw_data when both type and code
are present.

Validation: 90 offline tests passed across parsing, retrieval, file
downloads and malformed records.

The OpenAI and Anthropic download tests from #2804 verify that non-ASCII
results are written as UTF-8 on platforms with an ASCII default. The
production encoding fix shipped in #2708.

Consolidates #2820, #2822, #2825, #2657 and #2804.
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.

3 participants