Skip to content

tools/rl/accept.py: RL acceptance harness and the mesh_sglang check - #124

Merged
junyyang-amd merged 2 commits into
RLfrom
task-106
Nov 17, 2026
Merged

junyyang-amd merged 2 commits into
RLfrom
task-106

Conversation

@junyyang-amd

@junyyang-amd junyyang-amd commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #106. Ready for review. No blocking issues.

Adds the acceptance harness tools/rl/accept.py, which the later checks #107 to #111 build on, and its first check, mesh_sglang (A1).

Dev record

  • Found: SGLang's update_weights_from_disk reports the new version through /model_info, so A1 needs no SGLang changes. lmsysorg/sglang-rocm on g24 has no tag, so the harness names it by image id.
  • Decided: when started off g24, accept.py runs itself on g24 over ssh, once g24 sees the same tree (HEAD, diff and untracked files). Without -tt a dropped ssh client leaves that run going, so a run first removes its issue's leftover containers (Harness.remove_leftovers). Containers that run the tree mount it at its own path. The JSON records commit and dirty.
  • Decided: each check module also exports ISSUE, which sets its rl-<ISSUE>-<role> container names. Container names end in their port, so a check can start a fresh server next to its workers. GPUs are handed out from 0 upward. A GPU using more than 1 GB is refused, not skipped. Container logs go under rl-accept/logs/<check>/.
  • Decided: start_atom_workers installs only jsonschema, the dependency Spike: what happens to in-flight 1P1D requests when P and D are paused and their weights changed #92 found missing from the image. Its log names the atom package path that ran. start_pd_pair returns [p_url, d_url] for start_mesh(urls, pd=True). equals_fresh returns a bool and compares output_ids over PROMPTS.
  • Surprised: none.
  • Left undone: start_atom_workers, start_pd_pair, start_trainer, generate and equals_fresh have not run on a GPU yet. Their first GPU runs are in accept: refit_disk and cache checks #107 to accept: pd check #111. The tests parse their command lines with EngineArgs.

Named result

python3 tools/rl/accept.py mesh_sglang at 1a93edf (clean tree) prints PASS mesh_sglang and exits 0 in 147 s.

Per-route results from mesh_sglang.json
Route HTTP Result
GET /v1/rl/workers 200 total 2, both engine: sglang
GET /v1/rl/workers/{id}, each 200 equal to the listed entry
model_info before, each 200 weight_version: default
POST /v1/rl/engine/pause_generation 200 2/2 succeeded
POST /v1/rl/engine/update_weights_from_disk 200 2/2 succeeded, Qwen3-1.7B-Base to Qwen3-1.7B
POST /v1/rl/engine/continue_generation 200 2/2 succeeded
model_info after, each 200 weight_version: mesh-sglang-v2
probe selector_required 400 selector_required
probe invalid_selector 400 invalid_selector
probe no_workers_match 400 no_workers_match
probe worker_not_found 404 worker_not_found
probe invalid_engine_path 400 invalid_engine_path

Gates

task-106 @ 1a93edf: gate green; 13826 passed, 1477 skipped, 3 xfailed; cargo tests ok; black and ruff clean.

Evidence
  • Revert-red: drop --enable-rl from Harness.atom_argv. Result: 1 failed, 6 passed. test_atom_workers_start_as_rl_servers_on_their_own_ports fails on assert ('/ckpt', False, 2) == ('/ckpt', True, 2). With the fix restored: 7 passed.
  • The failure-path tests show the verdict firing: a worker left on the old version gives FAIL mesh_sglang: model_info w1 after. A mesh that accepts a missing selector, or refuses it with the wrong code, gives FAIL mesh_sglang: probe selector_required. Each exits 1 and writes passed: false.
  • Revert-red at 1a93edf: the tree mount, the remove_leftovers call and the probe's code comparison taken out together give 3 failed, 7 passed, one failure per new test. Details are in the round 2 comment.
  • Cost against the estimate (line_count.py against the merge base): code 681 against 480, test 234 against 150. Code stays under the escalation threshold of twice the estimate. Most of the overrun is black putting docker argv lists one item per line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@junyyang-amd

Copy link
Copy Markdown
Owner Author

Round 1 pushed afe8835.

First round: the harness, the mesh_sglang check and their tests. The gate is green and PASS mesh_sglang ran at this head.

Comment thread tools/rl/checks/mesh_sglang.py Outdated
@@ -0,0 +1,136 @@
"""A1: ATOMesh's /v1/rl routes over two SGLang workers.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docstring opens with A1:, an acceptance-item label from the umbrella issue and the design doc. Code must not cite design-doc labels (rules.md, What gets published). Drop the label and keep the sentence: ATOMesh's /v1/rl routes over two SGLang workers.

Comment thread tools/rl/accept.py Outdated
+ "exec python3 -m atom.entrypoints.openai_server "
+ shlex.join(argv)
)
flags = ["-w", str(TREE), "-e", f"PYTHONPATH={TREE}"]

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. A tree outside /share_nfs (say under $HOME) is not mounted: container() mounts only /share_nfs, Docker creates -w <tree> empty, and the image's own atom runs with no error. start_trainer has the same gap. Add -v f"{TREE}:{TREE}" to both flag lists.

Comment thread tools/rl/accept.py
rerun = ["python3", "tools/rl/accept.py", args.check]
rerun += ["--tree-digest", tree_digest()]
remote = f"cd {shlex.quote(str(TREE))} && {shlex.join(rerun)}"
ssh = ["ssh", "-o", "BatchMode=yes", NODE, remote]

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking. Without a tty, sshd sends no SIGHUP when the client goes away, so teardown never runs. The rl-<issue>-* containers keep their GPUs, and the next run fails in refuse_busy before its docker rm -f. Pass -tt, or remove the issue's own containers before the GPU check.

@junyyang-amd

Copy link
Copy Markdown
Owner Author

REQUEST CHANGES @ afe8835: 1 blocking.

Blocking: tools/rl/checks/mesh_sglang.py opens its docstring with the doc label A1: (inline). The two inline comments on tools/rl/accept.py do not block.

Checked: gate green at the head; PASS mesh_sglang reproduced from a separate worktree; --enable-rl revert-red seen; line count matches the Dev record (code 669, test 191, under the escalation line); no existing test edited; no issues opened.

Accepted with reservation: no test goes red when judge stops comparing a probe's error code with the code it expects. A mesh that gives the right status with the wrong code would still pass. A canned answer such as 400 {"error": "invalid_selector"} for selector_required would pin it.

Watch next: #107 to #111 run start_atom_workers, start_pd_pair and start_trainer on a GPU for the first time. Check that the atom from line in each worker log names the tree.

Evidence
  • Gate (gate.sh, review worktree at afe8835, base fork/RL): 13823 passed, 1477 skipped, 3 xfailed; cargo tests ok; black and ruff clean; exit 0.
  • python3 tools/rl/accept.py mesh_sglang at afe8835, clean tree: PASS mesh_sglang, exit 0, 347.9 s (includes a fresh cargo release build for this tree). Every route ok, the same answers as the PR's table. Both workers went from default to mesh-sglang-v2, and the three fan-outs gave 2/2. No rl-106-* containers were left.
  • Revert-red ("--enable-rl" changed to "--enable-rl-x" in Harness.atom_argv, line count unchanged): 1 failed, 6 passed. The failure is test_atom_workers_start_as_rl_servers_on_their_own_ports, assert ('/ckpt', False, 2) == ('/ckpt', True, 2). The same run also dropped and error == code from judge, and no test caught it (the reservation above).

…ners, drop a doc label

Containers that run the tree's code mount it at its own path, so a tree
outside /share_nfs is not silently replaced by the image's own atom. A run
on the node first removes its issue's rl-<issue>-* containers, which an
earlier run whose ssh client went away left holding GPUs. A test pins that
a probe answering the right status with the wrong error code fails.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@junyyang-amd

Copy link
Copy Markdown
Owner Author

Round 2 pushed 1a93edf.

  • Blocking, the A1: label: dropped in 1a93edf.
  • Tree not mounted outside /share_nfs: fixed in 1a93edf (TREE_FLAGS, and in build_mesh).
  • No teardown when ssh goes away: fixed in 1a93edf. A run first calls Harness.remove_leftovers. Not -tt, which turns the output into CRLF.
  • Reservation: a probe with the right status and the wrong code now fails a test.
Evidence

New tests: test_containers_running_the_tree_mount_it_at_its_own_path, test_a_run_first_removes_its_issues_leftover_containers, and a fake_mesh(no_selector="invalid_selector") case that answers 400 invalid_selector with no selector.

Revert-red: three changes made together, line count unchanged. (1) The tree mount became /share_nfs:/share_nfs. (2) The h.remove_leftovers() call became pass. (3) judge compared error == error. Result: 3 failed, 7 passed.

  • test_containers_running_the_tree_mount_it_at_its_own_path: assert '<tree>:<tree>' in ['/share_nfs:/share_nfs', '/share_nfs:/share_nfs']
  • test_mesh_sglang_fails_naming_the_route[FakeMesh-probe selector_required1]: assert (0 == 1)
  • test_a_run_first_removes_its_issues_leftover_containers: assert ['docker', 'rm', '-f', 'rl-106-sglang-18200'] in []

With the fixes restored: 10 passed.

@junyyang-amd

Copy link
Copy Markdown
Owner Author

APPROVE @ 1a93edf.

No blocking issues. Round 1's blocking A1: label is gone. The tree mount, the teardown after ssh drops and the probe's error code are fixed, each with a test I saw go red.

Checked: the whole head against #106's brief. Gate green. PASS mesh_sglang reproduced from my own worktree on a clean tree. The line count matches the Dev record (code 681, test 234), under the escalation line. No existing test edited, no issues opened, no doc labels left.

Accepted with reservation:

  • test_a_run_first_removes_its_issues_leftover_containers does not check that removal comes before any GPU is taken: it stays green if h.remove_leftovers() moves into finally.
  • remove_leftovers also removes a concurrent run of the same check. The node's one-GPU-job rule covers this today.

Watch next: #107 to #111 first run the ATOM containers, as root over the tree mount. Check that each log's atom from line names the tree and that no root-owned files land in it.

Evidence
  • Gate (gate.sh, review worktree at 1a93edf, base fork/RL): 13826 passed, 1477 skipped, 3 xfailed. Cargo tests ok, black and ruff clean, exit 0.

  • python3 tools/rl/accept.py mesh_sglang at 1a93edf on a clean tree: PASS mesh_sglang, exit 0, 349.4 s. The JSON has commit 1a93edf and dirty: false. All 15 routes are ok, with the same statuses as the PR's table. No rl-106-* containers were left afterwards.

  • Revert-red, in a git archive snapshot with line counts unchanged. Three changes: the tree mounts in TREE_FLAGS and build_mesh set to /share_nfs:/share_nfs, the h.remove_leftovers() call replaced by pass, and judge comparing error == error. Result: 3 failed, 7 passed.

    • test_containers_running_the_tree_mount_it_at_its_own_path: assert '<tree>:<tree>' in ['/share_nfs:/share_nfs', '/share_nfs:/share_nfs']
    • test_mesh_sglang_fails_naming_the_route[FakeMesh-probe selector_required1]: assert (0 == 1)
    • test_a_run_first_removes_its_issues_leftover_containers: assert ['docker', 'rm', '-f', 'rl-106-sglang-18200'] in []

    At the head: 10 passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant