-
Notifications
You must be signed in to change notification settings - Fork 18
fix(experimentalist): preflight the evaluator entrypoint in doctor and run #1324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
callingmedic911
merged 5 commits into
main
from
aditya/experimentalist-doctor-entrypoint-check-f8e4
Aug 14, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
21e3f24
fix(experimentalist): preflight the evaluator entrypoint in doctor an…
cursoragent 587c6b5
refactor(experimentalist): report an explicitly empty import_path ins…
cursoragent 621741a
fix(experimentalist): require <module>:<attribute> in one shared spli…
cursoragent 9d64d8d
docs(experimentalist): state plainly why the entrypoint contract has …
cursoragent 7dd6db1
fix(experimentalist): require the entrypoint attribute to be an ident…
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
46 changes: 46 additions & 0 deletions
46
...talist/src/nemo_experimentalist_plugin/experimentalist/components/evaluator/entrypoint.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """The agent entrypoint contract: one definition of what the evaluator imports. | ||
|
|
||
| Preflight resolves the same reference the evaluator imports, so it reports a | ||
| missing wrapper before a run instead of at the first trial. It must not import | ||
| ``harbor`` to do so, because whether harbor is importable is itself a check. | ||
| """ | ||
|
|
||
| from importlib.machinery import PathFinder | ||
| from pathlib import Path | ||
|
|
||
| DEFAULT_AGENT_IMPORT_PATH = "harbor_wrapper:WrappedAgent" | ||
|
|
||
|
|
||
| def split_import_path(import_path: str) -> tuple[str, str]: | ||
| """Split ``module:attribute``, the only form the evaluator can import. | ||
|
|
||
| The evaluator reaches the attribute with ``getattr``, so a name that is not | ||
| an identifier — absent, dotted, or holding a second ``:`` — can never | ||
| resolve. | ||
| """ | ||
| module_name, _, attribute = import_path.partition(":") | ||
| module_name = module_name.strip().lstrip(".") | ||
| attribute = attribute.strip() | ||
| if not module_name or not attribute.isidentifier(): | ||
| raise ValueError("import_path must be <module>:<attribute>") | ||
| return module_name, attribute | ||
|
|
||
|
|
||
| def find_entrypoint_module(agent_dir: Path, module_name: str) -> Path | None: | ||
| """Return the file the evaluator would import for *module_name*, or None. | ||
|
|
||
| Searches *agent_dir* alone, as the evaluator's scoped import does, and never | ||
| executes agent code. | ||
| """ | ||
| search = [str(agent_dir)] | ||
| origin: str | None = None | ||
| for part in module_name.split("."): | ||
| spec = PathFinder.find_spec(part, search) | ||
| if spec is None: | ||
| return None | ||
| search = list(spec.submodule_search_locations or ()) | ||
| origin = spec.origin | ||
| return Path(origin) if origin is not None else None | ||
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.