Repository navigation
fix(benchmark): retain research outside native submission trees #8198
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
Merged
Changes from all commits
Commits
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| """Provider-owned research data outside the native submission tree. | ||
|
|
||
| This composes the existing checkpoint component transport. It neither filters | ||
| submitted files nor changes the task's evaluator or feedback permissions. | ||
| """ | ||
| from __future__ import annotations | ||
|
|
||
| from copy import deepcopy | ||
| from pathlib import PurePosixPath | ||
|
|
||
|
|
||
| RESEARCH_DIRECTORY = "/tmp/loopx-benchmark-research" | ||
| RESEARCH_COMPONENT = "benchmark_research" | ||
|
|
||
|
|
||
| def validate_research_scope(workspace: str, submit_paths: list[str]) -> None: | ||
| """Refuse an overlapping task instead of silently changing submission scope.""" | ||
| root = PurePosixPath(workspace) | ||
| research = PurePosixPath(RESEARCH_DIRECTORY) | ||
| roots = [root, *(PurePosixPath(path) if PurePosixPath(path).is_absolute() | ||
| else root / path for path in submit_paths)] | ||
| for path in roots: | ||
| if not path.is_absolute() or ".." in path.parts: | ||
| raise ValueError("Research storage requires normalized absolute task and submission paths") | ||
| if research.is_relative_to(path) or path.is_relative_to(research): | ||
| raise ValueError("Research storage overlaps the task or its submitted paths") | ||
|
|
||
|
|
||
| def with_research_capture(request: dict) -> dict: | ||
| """Add this runner's data to a copy of its explicit capture declaration.""" | ||
| result = deepcopy(request) | ||
| expected = {"id": RESEARCH_COMPONENT, "source_path": RESEARCH_DIRECTORY} | ||
| present = False | ||
| for component in result["components"]: | ||
| if component.get("id") == RESEARCH_COMPONENT: | ||
| if component != expected or present: | ||
| raise ValueError("Reserved research component conflicts with the checkpoint declaration") | ||
| present = True | ||
| else: | ||
| source = PurePosixPath(component["source_path"]) | ||
| research = PurePosixPath(RESEARCH_DIRECTORY) | ||
| if source.is_relative_to(research) or research.is_relative_to(source): | ||
| raise ValueError("Checkpoint component overlaps the reserved research directory") | ||
| if not present: | ||
| result["components"].append(expected) | ||
| return result | ||
|
|
||
|
|
||
| def selected_research_components(metadata: dict, selected, *, managed: bool): | ||
| """Only the runner's exact sealed component joins explicit receiver choices. | ||
|
|
||
| Older checkpoints do not have this component. Their original workspace and | ||
| explicit research selections remain intact; no historical files are moved. | ||
| """ | ||
| if not managed: | ||
| return selected | ||
| if (not isinstance(selected, (tuple, list)) or | ||
| any(not isinstance(key, str) for key in selected) or len(set(selected)) != len(selected)): | ||
| raise ValueError("Research component selection must contain distinct captured IDs") | ||
| matches = [entry for entry in metadata["worker_file_snapshot"]["components"] | ||
| if entry["id"] == RESEARCH_COMPONENT] | ||
| if not matches: | ||
| return selected | ||
| if len(matches) != 1 or matches[0] != {"id": RESEARCH_COMPONENT, "source_path": RESEARCH_DIRECTORY}: | ||
| raise ValueError("Captured runner research component has a conflicting identity") | ||
| return tuple(selected) if RESEARCH_COMPONENT in selected else (*selected, RESEARCH_COMPONENT) | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P2] 在启动前校验捕获输出与新增研究源的重叠。原声明仅捕获 /task、destination=/tmp/loopx-benchmark-research/checkpoints 时,base 可以 capture 并独立 verify;此处追加其父目录作为研究源后,只检查 components 之间的重叠,run.main 仍能抵达外部 solver 边界,但真实 capture 被现有 artifact owner 的 output/source 检查拒绝。请在此处校验有效 destination 的相等、祖先和子目录关系(含适用后续输出),保持原声明,并增加启动前拒绝及非重叠 capture/restore 回归。验证使用合成文件,未执行模型。