You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Treat a config constraint equal to the threshold as violating strict "<" - #1668
BlendSearch._violate_config_constriants() flags sign == "<" only when value > threshold; equality also violates a strict <. The docs (website/docs/Use-Cases/Tune-User-Defined-Function.md, "More constraints on the tuning") list "<=", ">=", "<" and ">" separately; ">" was already strict. With config_constraints=[(lambda c: c["n"], "<", 5)] on tune.randint(0, 11), n == 5 was still evaluated. The existing test uses threshold 0.5 on a 0/1 value, so equality never occurs.
Change: > to >= for the < case. Test: a CFO run with points_to_evaluate=[{"n": 5}] must never evaluate n >= 5; fails on main (assert 5 < 5), passes now.
Related issue number
None.
Checks
I've used pre-commit to lint the changes in this PR (note the same in integrated in our CI checks).
BlendSearch._violate_config_constriants() flagged '<' constraints only when
value > threshold, so a config whose constraint value equals the threshold was
evaluated although value < threshold is false (the other three signs were
already strict in the right direction).
The reason will be displayed to describe this comment to others. Learn more.
The corrected predicate rejects equality in the covered sequential CFO path, but BlendSearch's fallback can still return the forbidden threshold. I verified two actual suggest calls with the first trial outstanding, low_cost_partial_config={"n": 5}, a queued n=0 point, constraint n < 5, and a controlled global proposal n=1: the second call returns n=5. The fallback configuration at BlendSearch.suggest is not re-screened after replacing the original proposal. This uses a controlled global suggestion, not a fully native optimizer run, and is a remaining path in the advertised fix rather than a claimed new baseline regression. Please validate the completed fallback before registering/returning it and add an outstanding-trial regression. The submitted tests pass two cases on each native stack; exact-main controls give one expected strict-boundary failure and one pass. The independent Low gpt-6.2-astra review additionally suggested a deterministic feasible boundary point instead of exhausting a finite search space.
No PR approval submitted. Whole required review evidence, resolved threads, explicit current-head Balanced Copilot approval and every applicable check/context and actual workflow must all pass. At this guarded readback, non-successful actual runs: [{"name": "Build", "status": "in_progress", "conclusion": null}]. No foreign thread was resolved and no earlier review was dismissed.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Constraint-rejected fallbacks leave the original global proposal’s running count incremented and its Optuna trial unfinished, so repeated rejections distort search accounting.
The reason will be displayed to describe this comment to others. Learn more.
The strict threshold and fallback rejection tests pass on Python 3.10 and 3.13. Changes requested for the existing global-proposal cleanup discussion.
I independently exercised public BlendSearch.suggest with its default real Optuna backend, using Optuna's enqueue API for deterministic proposals and forcing only admissibility validation false to reach the fallback. Three current suggestions return None, are not registered for completion, and leave three actual Optuna trials RUNNING; the global running count grows from one to four on both native stacks. The preceding/main fallbacks return invalid configurations and have their own accounting behavior, so they are not claimed healthy.
Please retire the outstanding original global proposal and balance its running count exactly once when rejecting the fallback. The regression should keep backend proposal/accounting effects active rather than mocking SearchThread.suggest, and assert that only the genuinely outstanding initial trial remains running.
Low-priority test follow-up: the 30-sample target exceeds the five feasible integer configurations and depends on retry exhaustion. A queued boundary point followed by a valid point can make that check deterministic. No duplicate inline comment or foreign-thread resolution was posted.
…lates a constraint
The original proposal's running slot is released and its backend trial failed, so repeated rejections no longer inflate the global thread count or leave backend trials running. Make the strict '<' boundary test deterministic.
Thanks for the review, thinkall. I've addressed the issues and pushed the fixes in commits 1a1b1780 and 30811508.
Issue raised and addressed
BlendSearch fallback – rejected proposals were not being retired correctly.
When BlendSearch's fallback configuration violated a constraint and was rejected, the original global proposal remained counted as running, and its corresponding Optuna trial was left unfinished.
Repeated rejections caused the running count to increase incorrectly. For example, after three rejections, the running count went from 1 to 4, while three Optuna trials remained in the RUNNING state.
The rejected fallback path now correctly retires the original global proposal:
The corresponding backend trial is marked as failed.
The running count is decremented exactly once.
No result is recorded for the rejected proposal.
No constraint penalty is assigned to it.
This cleanup is skipped when the proposal comes from the random-search path (use_rs), since there is no outstanding global proposal to retire in that case.
2. Regression test added
Added a regression test using the real Optuna backend:
Proposals are created using enqueue_trial.
Only _valid is forced to return False.
After three rejected suggestions, the running count remains at 1.
There are zero Optuna trials left in the RUNNING state.
Before the fix, the running count increased from 1 to 4.
3. Strict constraint test improvement
Regarding your low-priority feedback about the 30-sample strict-< test depending on retry exhaustion, I've updated the test to make the behavior deterministic.
It now seeds: points_to_evaluate=[{"n": 5}, {"n": 3}]
with num_samples=2.
The test explicitly verifies that:
The first evaluated point is 3.
The maximum evaluated value remains strictly below 5.
The test fails if the old >= comparison is restored.
This removes the dependency on retry exhaustion to demonstrate strict constraint handling.
4. Test cleanup
The later commit (30811508) also removes the mocked-suggest fallback test because the new regression test exercises the real Optuna proposal flow and covers the same behavior more directly.
5. Test results test_constraints.py
Before the fix: 3 passed, with the new cleanup regression test failing.
After the fix: 4 passed.
After removing the redundant mocked test: 3 passed.
Additional test suites
The following suites pass:
test_tune
test_lexiflow
test_searcher
test_search_thread
test_record_incumbent
The only remaining failure is test_no_optuna, which fails with a subprocess error. The same failure also occurs on main in the current environment, so it is not introduced by this PR.
6. Summary
The rejected fallback path now correctly retires outstanding global proposals, cleans up their Optuna trials, and maintains the running count without recording rejected configurations as results or assigning constraint penalties.
The regression coverage now exercises the real Optuna backend, and the strict-constraint test no longer relies on retry exhaustion.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Rejected fallback paths can leave backend trials outstanding, indefinitely retaining pending-trial slots and stalling further suggestions.
No open issues 🎉
2 previously missed issues
In code that hasn't changed since last review
Constraint failure can leave duplicate proposals outstanding
flaml/tune/searcher/blendsearch.py:757
If the global proposal duplicates a running configuration, _should_skip() leaves its backend trial outstanding, but a feasible random replacement still sets use_rs = 1. If the init fallback then violates the constraint, this guard skips cancellation and returns None, leaving the backend trial and its running slot outstanding indefinitely. Track whether the original proposal remains outstanding independently of use_rs, and cancel it here without double-completing proposals already handled by _should_skip().
When a fallback is rejected, this condition skips the completion callback for non-Optuna global_search_alg implementations because they lack _ot_trials. The proposal is never registered for later completion, so backends that limit pending trials can retain a slot indefinitely and stall further suggestions. Notify backends without _ot_trials with error=True too, while retaining the trial-membership check for Optuna.
The reason will be displayed to describe this comment to others. Learn more.
The new standard Optuna cleanup test now passes on both native stacks: four selected passes, with the preceding head failing the two new cleanup cases. Two other dropped-proposal paths still prevent whole-PR clearance.
[P2] Retire non-Optuna backend proposals through the Searcher protocol. A pending Searcher fixture passed as global_search_alg receives no error completion from _cancel_proposal, because it has no private _ot_trials dictionary. Current suggest returns None and restores the thread count, but the backend retains the dropped ID and its next suggest returns None. This is a public protocol reproduction, not a real Hyperopt or Ray ConcurrencyLimiter run. Retire outstanding proposals independently of Optuna-specific storage, and cover a pending non-Optuna backend.
[P2] Also clean up the duplicate/random-replacement rejection path. In a focused actual Optuna enqueue/ask reproduction, an in-flight duplicate triggers random replacement and then a rejected initial fallback. suggest returns None, yet thread.running rises from one to two, the backend trial remains RUNNING, and no _trial_proposed_by owner is recorded. Admissibility and replacement configurations were controlled; Optuna's ask and trial-state operations were real. The if not use_rs guard does not guarantee that the original proposal was retired.
Both paths reproduce on Python 3.10/NumPy 1.26 and Python 3.13/NumPy 2.3, on current and preceding PR heads. Main instead returns the invalid fallback, so this is not a claim of a healthy old cleanup implementation. Preserve the newly fixed normal path while covering these remaining lifecycle branches. No foreign threads were resolved or prior reviews dismissed; approval remains withheld.
…dom-replacement paths
A rejected init fallback now cancels the outstanding global proposal whenever
the backend still holds it, not only when no random replacement was used, and
notifies backends without Optuna's trial table through the Searcher protocol.
A duplicate proposal whose random replacement is also skipped is cancelled too.
Non-Optuna backends: _cancel_proposal now reports an error completion to all backends, not just Optuna.
Duplicate proposals: If both the replacement config and fallback are rejected, the global proposal is cancelled and thread.running returns to its baseline.
Tests: test_constraints.py improved from 3 failures to 6 passing tests.
I also identified two additional issues that already exist on main, but left them out of this PR:
A backup local thread can leave the global proposal pending. This needs a small, two-line fix.
A replacement config can double-count thread.running. Fixing this requires deciding which trial should receive the result.
The reason will be displayed to describe this comment to others. Learn more.
Whole-PR Medium review at 693a77fbb94a4339919d04982805bebfaaf90bb9: all six lenses have valid content, but proposal retirement remains incomplete.
After completing the initial trial and creating a local backup thread, a rejected global proposal can return no trial while retaining the backend proposal and increasing global running from 0 to 1.
An accepted init-point replacement changes a backend proposal n=1 into returned n=5, but global running becomes 2 and only decreases to 1 after completion; completion is still attributed to the original backend proposal.
With the initial trial outstanding, a constraint-rejected first backend proposal leaves its trial pending without a backend completion. The new pending calculation assumes _should_skip notified the backend, although the initial-config heuristic can suppress that notification.
Focused native fixtures reproduce these paths on both stacks. The underlying accounting defects also exist on predecessor/main controls: they are remaining coupled lifecycle gaps, not newly introduced by the latest delta. Retire proposals when their configurations are replaced, track backend trial identity, and cover local-backup, accepted-fallback and outstanding-init cases.
The 12 targeted current passes verify the covered paths, not complete lifecycle correctness. Original duplicate/cache, optional-dependency and test-fidelity findings are retained with their qualifications. The fresh Balanced peer recommendation is "Needs a closer look", not approval.
Both the original failed lens and its bounded same-model recovery are preserved. No source changes, duplicate inlines or review outputs were pushed.
…r configuration
SearchThread now records which trials the underlying search algorithm still holds a proposal for. A proposal is retired (the algorithm is told the trial failed, the running slot is released) when the trial is given to a local backup thread, when a rejected fallback or a rejected backup returns no trial, and when a random or init-point configuration replaces it; in the last case the trial's later result is not reported to the algorithm as the result of the proposal, and the trial counts once in running. A constraint-rejected proposal completed by _should_skip is now forwarded to the algorithm even before the global thread has completed its first trial.
When _should_skip had completed the proposal and a random configuration then ran under the same trial id, the trial's own completion was reported to the backend a second time. Remove the unused has_proposal helper.
The reason will be displayed to describe this comment to others. Learn more.
Review of author head 4a78832cd2dd5777a2a512235b729ec4eee20e83.
The new global-proposal retirement cases fix the previously verified global-slot/backend leaks, but the new lifecycle sets break continuation of older checkpoints.
Using the public BlendSearch.save/restore APIs, save an outstanding initial trial with the immediate predecessor, restore it with this head, and complete that trial. On both native stacks, completion raises AttributeError: 'SearchThread' object has no attribute '_proposed': unpickling does not call __init__, so neither new set exists. Previous-to-previous and current-to-current controls succeed. Please migrate/initialize the new lifecycle state when restoring older checkpoints.
There are also remaining coupled lifecycle followups: controlled real FLOW2 proposals that collide with an in-flight cache entry return no trial while retaining a local running slot and consuming quota; a protocol-conforming custom backend receives callbacks for initial IDs it never proposed. Those two behaviors also occur on predecessor/main and are not new regressions in this correction. Duplicate init fallback work is still observable, but the suggested second-error-completion crash was not reproduced and is not claimed here.
The current targeted suite passed 22 cases, and all ten selected predecessor cases fail. The controlled native probes are not a full external-searcher or distributed-concurrency matrix.
Current selected-scope independent coverage: 5/6; whole-PR scope. Required whole-PR independent evidence remains incomplete; no clean signoff is claimed. No contributor source or tests were edited; review evidence is retained locally and is not pushed to this PR.
… unattributable trials of older checkpoints to a custom backend
A start point rejected by a config constraint left a None entry in _candidate_start_points, which kept the other candidates from creating the first local search thread. A checkpoint written before proposals were tracked cannot say which of several outstanding trials a non-Optuna backend proposed; their completions are no longer reported to it, with a warning.
An older checkpoint is ambiguous only while the initial configuration and a backend proposal are both running. After the initial trial completes, every outstanding trial belongs to the backend and is reported as before.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Active issues can cause CFO to return no suggestions indefinitely and leave restored capacity-limited backends permanently occupied after trials complete.
The reason will be displayed to describe this comment to others. Learn more.
New author correction only, reviewed at be44a678e342bb5d77879402795207ef572b9f10 against frozen baseline cc32fc3274aa6621614d4971ad74967181d4d564.
Legacy restore now strands a capacity-limited custom backend (flaml/tune/searcher/search_thread.py:201-207). With an initial trial and one backend proposal outstanding, the new unattributed counter suppresses both completion callbacks. After initial-first completion, FLAML reports running=0 and unattributed=0, but the backend still has pending={'proposal'} and received no completion. A source-pinned probe passes on the predecessor and fails on this head. Safely reconstruct/retire ownership, or reject an unsupported ambiguous restore explicitly rather than returning a backend with permanently occupied capacity.
The rejected-start correction also remains incomplete for categorical spaces. With feasible low-cost a, initial points a/reject, and another feasible choice b, rejecting the final start creates local thread 1 but leaves _init_used=False; six subsequent suggestions return None. The predecessor also stalls, but never creates that local thread. This is an incomplete fix, not an entirely new starvation regression; tune.run has a failure limit, so an unbounded process hang is not claimed.
Other foreign intermediate/multiple-start callbacks also reproduce on the predecessor and are retained as inherited findings. The discarded second pickle result and legacy fixture fidelity are test-quality notes. All 44 selected regression checks pass, but the additional liveness/CFO probes expose the cases above.
Independent selected-scope coverage: 4/6; original findings, priorities and failed attempts remain recorded. This is not a clean whole-PR approval; a lifecycle lens reached the execution safety limit and was not replayed.
At 2026-12-03T06:14:24.077602+00:00, checks=FAILURE; actual current-head workflows: docs=completed/success; Code formatting=completed/failure; Build=completed/success. Workflow authorization is not CI success. Main advanced during frozen review; that later integration is not reviewed or treated as approval clearance. No contributor source was changed and no review outputs were pushed here.
All-files evidence hooks did not pass; their failures are retained, not claimed as passing approval gates.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical restore handling can permanently exhaust backend capacity, while incomplete initialization can cause subsequent suggestions to return None indefinitely.
… last CFO start point is rejected
Restoring an older checkpoint with the initial trial and a custom backend's proposal outstanding could not say which trial the backend proposed; suppressing both completions left the backend's capacity occupied for good, so the restore now fails with a clear message. When the last start point is rejected after CFO reset its initialization flag, creating the local thread now marks initialization used, so the next suggestions do not return to the initial point. test_constraints.py is formatted with the repository's black.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The trial-ownership lifecycle and rejection of some legacy custom-backend checkpoints require human review of compatibility policy and untested Ray/custom-backend integration behavior.
The reason will be displayed to describe this comment to others. Learn more.
New author corrections inspected at 6a5af7f9b1d2ab78c3b4a537ad6c2e2a90fe9ccc: the categorical start-point path now finishes initialization, and ambiguous older in-flight checkpoints are rejected instead of silently leaving an unfinishable backend proposal. The selected constraint tests pass23cases on each pinned stack (46total); the current tests distinguish the predecessor in four cases.
Independent automated review remains blocked. The earlier review execution safety limit still applies to this PR, so I did not dispatch another reviewer, fabricate a review artifact, or count these native checks as a complete code-review signoff. The older incomplete whole-PR coverage is not cleared by a new commit or these passing tests. This is a formal status COMMENT, not approval or a newly completed independent review. Current-head CI must also finish successfully.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Changes to concurrent proposal ownership and legacy checkpoint resumability require maintainer confirmation of the compatibility policy and validation of retirement, replacement callbacks, and restore behavior across supported backends.
The reason will be displayed to describe this comment to others. Learn more.
Base integration inspected at 5d0cc9d22078fde2dde845a9f37dc544e5a858eb. The branch update is an exact merge with current main, with no new edits to the existing feature. Only the imported foreign SVC cloning and forest preprocessing changes were selected; the separate own-authored release docs/version changes are excluded. The selected integration tests pass14cases on each pinned stack (28total).
Independent automated review remains blocked by the earlier review execution safety limit. No new reviewer or standalone artifact writer was dispatched for this PR. Native checks and merge/projection proofs are not whole-PR code-review signoff, and a base merge does not reset any missing-review or safety bound. Existing feature findings and incomplete whole-PR coverage remain held; current-head CI and peer/thread gates are separate requirements. This is a formal status COMMENT, not approval. No review outputs were pushed here.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Changes to concurrent proposal ownership and legacy-checkpoint restoration require human compatibility review and backend integration validation that was unavailable here.
The reason will be displayed to describe this comment to others. Learn more.
Base integration inspected at ef0e75bcab146569916afaa3f33c8f31b47a9f5f. The branch update is an exact merge with current main, with no new edits to the existing feature. Only the imported foreign FLOW2 categorical-choice correction was selected; the separate own-authored CD/workflow and package-metadata changes are excluded. The selected integration tests pass14cases on each pinned stack (28total).
Independent automated review remains blocked by the earlier review execution safety limit. No new reviewer or standalone artifact writer was dispatched for this PR. Native checks and merge/projection proofs are not whole-PR code-review signoff, and a base merge does not reset any missing-review or safety bound. Existing feature findings and incomplete whole-PR coverage remain held; current-head CI and peer/thread gates are separate requirements. This is a formal status COMMENT, not approval. No review outputs were pushed here.
Posted by thinkall-agent-auto-reviewer
This branch has not been deployed
No deployments
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
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.
Why are these changes needed?
BlendSearch._violate_config_constriants()flagssign == "<"only whenvalue > threshold; equality also violates a strict<. The docs (website/docs/Use-Cases/Tune-User-Defined-Function.md, "More constraints on the tuning") list "<=", ">=", "<" and ">" separately; ">" was already strict. Withconfig_constraints=[(lambda c: c["n"], "<", 5)]ontune.randint(0, 11),n == 5was still evaluated. The existing test uses threshold 0.5 on a 0/1 value, so equality never occurs.Change:
>to>=for the<case. Test: a CFO run withpoints_to_evaluate=[{"n": 5}]must never evaluaten >= 5; fails on main (assert 5 < 5), passes now.Related issue number
None.
Checks
Checks run: black (line length 120) and ruff on the changed files. The pinned pre-commit hook versions were not run. No doc changes are needed.