Repository navigation
refactor(lm): define minimal engine protocols - #10709
Open
isaacbmiller wants to merge 2 commits into
Open
isaacbmiller wants to merge 2 commits into
isaacbmiller wants to merge 2 commits into
Conversation
Contributor
[Low impact] No merge-blocking issues identified in the reviewed changes. SummaryMakes Since the previous review, only the custom-proposer test changed: it now uses one thread so the shared scripted LM receives lookup and submit calls consecutively for each example. The current head builds on the previously reviewed commit, and both share the same merge base with the target branch. No actionable issues found. No behavioral tests were run for this review.
Reviews (5) · Last reviewed commit: "Stabilize scripted GEPA context fixture ..." · Reviewed by Greptile |
This was referenced Oct 22, 2026
isaacbmiller
force-pushed
the
isaac/lm15-engine-contract-prep
branch
2 times, most recently
from
October 26, 2026 21:01
74f4b7b to
0224a3a
Compare
This was referenced Oct 27, 2026
Require only complete(Request) on completion engines. Streaming and cleanup are optional capabilities. Annotate public constructor parameters without moving or changing existing validation. Amp-Thread-ID: https://ampcode.com/threads/T-01a135b1-7d59-73cc-a17c-57b7b3454c03 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
isaacbmiller
force-pushed
the
isaac/lm15-engine-contract-prep
branch
from
October 28, 2026 00:52
0224a3a to
bf18778
Compare
Keep the shared lookup/submit script on one evaluation thread. A legal interleaving reproduced the CI failure on both main and this stack; all existing context assertions remain unchanged. Amp-Thread-ID: https://ampcode.com/threads/T-01a135b1-7d59-73cc-a17c-57b7b3454c03 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1/6 — Make completion the minimum engine contract
Stack: #10709 → #10712 → #10713 → #10652 → #10708 → #10719.
Review this diff against
main; later PRs are reviewed against their immediate parent. Nothing is merged.What changes
Enginerequires only synchronouscomplete(Request) -> Response;AsyncEnginerequires asynchronouscomplete. Streaming and cleanup remain optional capabilities, documented beside the protocols.LM'sengineandasync_engineconstructor parameters with these protocols.mainand this PR by controlling worker scheduling; no assertion or production behavior changes.What does not change
No request construction, adapter behavior, candidate execution, caching, provider routing, dependencies, or inference changes.
messages=,forward/aforward, legacy engines and historical cache readers remain. Custom engines remain borrowed; DSPy does not acquire an obligation to close them.The protocols are not
runtime_checkable: runtime construction still checks callability and coroutine kind, which a structuralisinstancecheck cannot establish. PR4 adds separate runtime-checkable streaming protocols and the missing-stream guard; neither is backported here. Async-only custom LMs also arrive in PR4.How to review
dspy/clients/engines/base.py: onlycompleteis required.dspy/clients/lm.py._check_enginesand_is_coroutine_functionare unchanged from the parent.The contract simplification reduced 85 to 16 changed lines (18.82%), without changing its tests or using code golf. The independent CI fixture correction adds three changed lines: the current whole PR is 19 lines (22.35%), not under 20%. The earlier speculative
validate_enginesextraction was removed. Shared validation moves only in PR4, whereBaseLMandLMactually both consume it; this reduction does not claim that the entire stack shrank by 81%.Exact-head verification
On bf18778d6: 306 focused engine/compatibility/execution/error/lifecycle tests passed; Ruff,
ty check --python /home/user/workspace/repo/.venv/bin/python, andgit diff --checkpassed. Tests ran with a fresh HOME,env -i, local model metadata andPYTHON_DOTENV_DISABLED=1. The simplification also matched 1,875 original constructor/copy/validator outcomes in adversarial probes.On 33df97cee: 117 GEPA/engine/execution tests passed, plus Ruff and
git diff --check. The controlled scheduling probe reproduced the original 416-character failing Context on both main and PR1; serializing just the custom-proposer fixture passed without weakening assertions. Exact-head GitHub CI passes and Greptile reports 5/5.GitHub checks and the latest reviewed commit identify current CI and Greptile coverage. Older 5/5 reviews do not cover this new head automatically. The entire stack remains gated on source fixes and compatibility acceptance tracked in CMP-1607.
Maintainer-directed, Amp-assisted preparation for Maxime Rivest's #10401 migration. This is our minimal contract-preparation layer, not a claim that Max's original PR used this split.