Repository navigation
mcpx(ci): guard malformed e2e timing seeds - #7897
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 18 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dc84f22fcf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
6 open issues
NamedTemporaryFileis kept open whileload_weights()(and the subprocess in the CLI test) tries… · NewNamedTemporaryFileis kept open whileload_weights()(and the subprocess in the CLI test) tries… · NewNamedTemporaryFileis kept open whileload_weights()(and the subprocess in the CLI test) tries… · NewNamedTemporaryFileis kept open whileload_weights()(and the subprocess in the CLI test) tries… · NewNamedTemporaryFileis kept open whileload_weights()(and the subprocess in the CLI test) tries… · New For deterministic JSON parsing across environments, consider opening the timing seed file with an… · New
What changed in this PR
This PR hardens the e2e shard packer’s timing-seed parsing against malformed inputs (non-object tests, non-finite/non-positive/boolean weights) and adds regression tests to prevent those failures from reoccurring.
Changes:
- Add
_weight_seconds()validation and improveload_weights()fallback/diagnostic notes when seeds are malformed. - Skip invalid per-test weights while keeping valid ones and reporting skipped names.
- Add a new unittest module covering malformed containers, invalid weights, a well-formed seed, and the committed-seed CLI matrix output.
| File | Description |
|---|---|
| pkgs/mcpx/scripts/ci/e2e-shard-packer.py | Adds stricter weight validation and clearer fallback behavior/notes when timing seeds are malformed. |
| pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py | Introduces regression tests for seed parsing edge cases and for the CLI’s emitted GitHub matrix output. |
Review effort: Lite
| with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as seed: | ||
| json.dump(value, seed) | ||
| seed.flush() | ||
| return packer.load_weights(seed.name, ["TestA", "TestB"]) |
| with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as seed: | ||
| json.dump(value, seed) | ||
| seed.flush() | ||
| weights, note = packer.load_weights(seed.name, names) |
| with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as seed: | ||
| json.dump({"tests": {"TestTrue": True, "TestZero": 0}}, seed) | ||
| seed.flush() | ||
| weights, note = packer.load_weights(seed.name, names) |
| with tempfile.NamedTemporaryFile(mode="w", suffix=".json") as seed: | ||
| json.dump({"tests": {"TestA": 12, "TestB": 8}}, seed) | ||
| seed.flush() | ||
| weights, note = packer.load_weights(seed.name, ["TestA", "TestB", "TestC"]) |
| with tempfile.NamedTemporaryFile(mode="w+", suffix=".out") as output: | ||
| result = subprocess.run( | ||
| [ | ||
| sys.executable, PACKER_PATH, | ||
| "--tests-dir", os.path.join(MCPX_DIR, "internal", "e2e"), | ||
| "--timings", TIMINGS_PATH, | ||
| "--target-seconds", "170", | ||
| "--max-shards", "6", | ||
| "--github-output", output.name, | ||
| ], | ||
| cwd=REPO_ROOT, | ||
| capture_output=True, | ||
| text=True, | ||
| timeout=60, | ||
| ) |
| measured: dict[str, float] = {} | ||
| skipped: list[str] = [] | ||
| if path and os.path.exists(path): | ||
| with open(path) as fh: |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
agent-note:v1 |
…seed-shape-guards # Conflicts: # pkgs/mcpx/scripts/ci/e2e-shard-packer.py # pkgs/mcpx/scripts/tests/test_e2e_shard_packer.py
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
agent-note:v1 |
|
agent-note:v1 |


Summary
load_weightsnow rejects non-objecttestscontainers to equal weights with a named seed note, and skips invalid per-test weights (non-finite, non-positive, or boolean) by name.Adds Python regression coverage for malformed containers, invalid weights, a well-formed seed, and the committed-seed matrix invocation. Refs #6822.
Evidence
testsfields raised AttributeError; Infinity caused OverflowError; true was accepted as 1.0s.python3 -m unittest discover -s pkgs/mcpx/scripts/tests -vpasses (14 tests); the committed-seed CLI emits a finite matrix. Committed-seed and no-seed output match the base implementation byte-for-byte.Merge Danger
Door: two-way
Blast Radius: low
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.