From d3beeadfc93747e28526938c6ba6eeb58f4a605b Mon Sep 17 00:00:00 2001 From: shentonyan Date: Sun, 4 Oct 2026 21:26:18 +0800 Subject: [PATCH 1/3] fix: assign confidence when call stack resolves a layer; drop hardcoded seed path in test_publish - sglang_trace_analyze/structure_mapper._map_one: when a call stack is present and the layer is resolved, 'confidence' was never assigned, raising UnboundLocalError. Default to 'high' (matches test_build_mapping_with_call_stack). - harness_evolve/tests/test_publish.py: resolve the dcu_kernel_auto_opt harness_default seed relative to the test file instead of a machine-specific absolute path, so the tests run on any checkout. Co-Authored-By: Claude Sonnet 5.5 --- metainfer/tasks/harness_evolve/tests/test_publish.py | 4 ++-- .../sglang_trace_analyze/orchestrator/structure_mapper.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/metainfer/tasks/harness_evolve/tests/test_publish.py b/metainfer/tasks/harness_evolve/tests/test_publish.py index ea26f41f..2cf8ebcd 100644 --- a/metainfer/tasks/harness_evolve/tests/test_publish.py +++ b/metainfer/tasks/harness_evolve/tests/test_publish.py @@ -14,8 +14,8 @@ publish_kernels, ) -_DCU_SEED = Path("/root/zth_agent/MetaInfer/metainfer/tasks/" - "dcu_kernel_auto_opt/harness_default") +_DCU_SEED = (Path(__file__).resolve().parents[2] + / "dcu_kernel_auto_opt" / "harness_default") def _fake_experiment(tmp_path, *, verdict="PROMOTE", held="PASS"): diff --git a/metainfer/tasks/sglang_trace_analyze/orchestrator/structure_mapper.py b/metainfer/tasks/sglang_trace_analyze/orchestrator/structure_mapper.py index b900f9c1..ae436423 100644 --- a/metainfer/tasks/sglang_trace_analyze/orchestrator/structure_mapper.py +++ b/metainfer/tasks/sglang_trace_analyze/orchestrator/structure_mapper.py @@ -74,6 +74,9 @@ def _map_one( confidence = "low" elif layer is None: confidence = "medium" + else: + # Call stack present and the layer was resolved from it. + confidence = "high" return { "kernel_name": kernel_name, From 45afd7dfa2c1931308fcfbfd24c8f0d5db1f05b1 Mon Sep 17 00:00:00 2001 From: shentonyan Date: Sun, 4 Oct 2026 21:42:45 +0800 Subject: [PATCH 2/3] test(e2e): only count held GPUs when asserting a slot was released scoreboard.list_claims() is documented as a snapshot of every GPU, free or held, so a released slot still appears as a row with status='free'. The four e2e tests asserted that no row exists for the slot (or that the list is empty) and therefore failed after a successful release. Filter on status == 'held'. test_remote_job_flow's during-run check had the same flaw and always passed; it now also requires status == 'held'. Co-Authored-By: Claude Sonnet 5.5 --- metainfer/tests/e2e/test_admin_force_kill.py | 3 ++- metainfer/tests/e2e/test_pp2_contention.py | 3 ++- metainfer/tests/e2e/test_remote_job_flow.py | 5 +++-- metainfer/tests/e2e/test_worker_crash.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/metainfer/tests/e2e/test_admin_force_kill.py b/metainfer/tests/e2e/test_admin_force_kill.py index 2331ee9c..3561edc9 100644 --- a/metainfer/tests/e2e/test_admin_force_kill.py +++ b/metainfer/tests/e2e/test_admin_force_kill.py @@ -50,7 +50,8 @@ def test_force_release_endpoint_frees_slot(tmp_path: Path) -> None: assert body["was_held"] is True # Slot must be gone. - claims = scoreboard.list_claims() + # list_claims() reports every GPU (free or held); only held rows count. + claims = [c for c in scoreboard.list_claims() if c["status"] == "held"] assert all(not (c["node_id"] == "w0" and c["gpu_idx"] == 0) for c in claims) # cancel.marker must be present in the job_dir so the worker sees it. diff --git a/metainfer/tests/e2e/test_pp2_contention.py b/metainfer/tests/e2e/test_pp2_contention.py index 723cb891..cdacbf9c 100644 --- a/metainfer/tests/e2e/test_pp2_contention.py +++ b/metainfer/tests/e2e/test_pp2_contention.py @@ -56,5 +56,6 @@ def run_round(round_idx: int) -> None: assert len(winners_per_round) == rounds, \ "all rounds must complete (no deadlock)" # After all rounds done, no slots remain held. - remaining = scoreboard.list_claims() + # list_claims() reports every GPU (free or held); only held rows count. + remaining = [c for c in scoreboard.list_claims() if c["status"] == "held"] assert remaining == [], f"no slot should remain held, got {remaining}" diff --git a/metainfer/tests/e2e/test_remote_job_flow.py b/metainfer/tests/e2e/test_remote_job_flow.py index cd2ec320..398e225f 100644 --- a/metainfer/tests/e2e/test_remote_job_flow.py +++ b/metainfer/tests/e2e/test_remote_job_flow.py @@ -40,7 +40,8 @@ def test_full_remote_job_flow_acquire_release_result(tmp_path: Path) -> None: def handler(handle: JobHandle, own_node_id: str) -> JobResult: # While the job is running, the slot must be held. claims = scoreboard.list_claims() - acquired = [c for c in claims if c["node_id"] == "w0" and c["gpu_idx"] == 0] + acquired = [c for c in claims if c["node_id"] == "w0" and c["gpu_idx"] == 0 + and c["status"] == "held"] captured["acquired_during_run"] = len(acquired) == 1 # Write some stdout so tail-readers can verify (Path(handle.job_dir) / "stdout.log").write_text("hello e2e\n") @@ -69,7 +70,7 @@ def handler(handle: JobHandle, own_node_id: str) -> JobResult: "GPU slot must be held while job is running" # Slot must be released after job. - claims_after = scoreboard.list_claims() + claims_after = [c for c in scoreboard.list_claims() if c["status"] == "held"] assert all(not (c["node_id"] == "w0" and c["gpu_idx"] == 0) for c in claims_after), "slot must be released" diff --git a/metainfer/tests/e2e/test_worker_crash.py b/metainfer/tests/e2e/test_worker_crash.py index 3956f632..8cb4173f 100644 --- a/metainfer/tests/e2e/test_worker_crash.py +++ b/metainfer/tests/e2e/test_worker_crash.py @@ -47,6 +47,6 @@ def test_worker_dead_surfaces_and_slot_reaped(tmp_path: Path) -> None: assert result.status == "worker_dead", \ f"expected worker_dead, got {result.status}" # Slot must be released (RemoteJob's finally calls release_gpus). - claims = scoreboard.list_claims() + claims = [c for c in scoreboard.list_claims() if c["status"] == "held"] assert all(not (c["node_id"] == "w0" and c["gpu_idx"] == 0) for c in claims), \ f"slot leaked: {claims}" From 71b3a4fae4402ac01ee3b719b17b856811fd4205 Mon Sep 17 00:00:00 2001 From: shentonyan Date: Sun, 4 Oct 2026 21:42:46 +0800 Subject: [PATCH 3/3] test(gen-cpp): drop task_type from StateStore.init_or_resume calls StateStore.init_or_resume(task_id) no longer takes task_type (run.json does not store it; requirements.json is the source of truth). Two cpp framework tests still passed it and raised TypeError. Co-Authored-By: Claude Sonnet 5.5 --- .../gen_infer_framework_cpp/tests/test_cpp_framework_task.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metainfer/tasks/gen_infer_framework_cpp/tests/test_cpp_framework_task.py b/metainfer/tasks/gen_infer_framework_cpp/tests/test_cpp_framework_task.py index f7563689..679c0eaa 100644 --- a/metainfer/tasks/gen_infer_framework_cpp/tests/test_cpp_framework_task.py +++ b/metainfer/tasks/gen_infer_framework_cpp/tests/test_cpp_framework_task.py @@ -693,7 +693,7 @@ def test_correctness_only_mode_stops_after_d_review(self): root = Path(td) state_dir = root / "state" store = StateStore(state_dir) - store.init_or_resume(task_id="bounded", task_type=TASK_TYPE) + store.init_or_resume(task_id="bounded") cfg = OrchestratorConfig( workdir=state_dir, repo_root=root, @@ -738,7 +738,7 @@ def test_optimize_mode_stops_after_measured_target_and_review(self): root = Path(td) state_dir = root / "state" store = StateStore(state_dir) - store.init_or_resume(task_id="target", task_type=TASK_TYPE) + store.init_or_resume(task_id="target") cfg = OrchestratorConfig( workdir=state_dir, repo_root=root,