#1 [high] Stale spec: helios/manifest.md still states the lifted restriction
helios/manifest.md:89-95 (unchanged by PR #640) still says:
"An execution catalog may optionally declare Execution.persistent_workers (repeated Protobuf message PersistentWorker, field 8) to run a dedicated graph concurrently with serving graphs on a spatially partitioned CUDA Green Context. Helios currently supports at most one persistent worker entry on single-rank cores; cores declaring more than one entry, multi-rank cores, and multi-host cluster cores declaring a persistent worker fail validation before execution."
"multi-rank cores ... fail validation before execution" is now false for local multi-rank cores with a rank-0 worker. The PR only reworded docs/runtime-core-design.md:642-644. AGENTS.md "Required prose review" (lines 52-60) requires every document to state the architecture the code implements; two specs now disagree. Fix: reword manifest.md:92-95 to match ("at most one entry, on rank 0 of a local multi-host-free core; peer ranks and multi-host cluster cores ... rejected"). The PR body's "What changed" list does not mention manifest.md.
Related wording divergence created by the PR: "persistent workers are only supported on rank 0 of a local core" (model.rs:130, threaded.rs:634), "persistent workers are only supported on rank 0" (selection.rs:287), "persistent workers are only supported on single-rank cores" (parallel.rs:124, :556).
#2 [high] selection.rs rank>0 guard is unreachable from the only production caller
helios/src/runtime_core/selection.rs:282-289 (new code):
if execution.persistent_workers.len() > 1 {
return Err(invalid("at most one persistent worker is supported per rank"));
}
if !execution.persistent_workers.is_empty() && rank > 0 {
return Err(invalid(
"persistent workers are only supported on rank 0",
));
}
LoadOptions::select is pub(super) and its only non-test caller is helios/src/runtime_core/model.rs:441, inside load_agreeing, which at model.rs:386 already ran validate_persistent_worker_topology(&cores, cluster.as_ref()) — whose new body (model.rs:118-132) rejects exactly any peer-rank worker (cores.iter().skip(1).any(...)). So rank > 0 && worker can never be observed by select in production; the branch is dead. Its only exercise is the synthetic test at selection.rs:710-720, which calls select directly and bypasses the topology validation.
Recommended subtraction: delete selection.rs:285-289 and keep the single topology predicate in model.rs (or vice versa — one site, not two). This also removes the third error-string variant "persistent workers are only supported on rank 0". Note the pre-existing len() > 1 check at :282-284 is likewise duplicated by protobuf.rs:295-300, manifest.rs:442-448 and mod.rs:362-368, but that predates this PR.
#3 [high] same_layout worker clause duplicates ThreadedExecutor::new's peer check and is asymmetric
helios/src/execution/threaded.rs:1292-1294 (new code), end of same_layout:
if !b.persistent_workers.is_empty() {
return false;
}
It replaces the old field-wise comparison ( if a.persistent_workers.len() != b.persistent_workers.len() || a.persistent_workers.iter().zip(&b.persistent_workers).any(|(a, b)| { a.worker_sm_count != b.worker_sm_count || a.graph != b.graph || a.metrics_count != b.metrics_count }) { return false; } )
Two problems in one:
- Duplication:
ThreadedExecutor::newat threaded.rs:632-636 (if ranks.iter().any(|rank| !rank.persistent_workers.is_empty()) { return Err(...) }) already rejects every peer manifest carrying a worker, beforesame_layoutis ever consulted (loop at :637-642). Sob.persistent_workersis guaranteed empty by the timesame_layoutruns; the clause is a redundant second validator that only changes the error text from the precise "persistent workers are only supported on rank 0 of a local core" to "rank graph I/O schemas differ". - Asymmetry/no-op: the clause makes
same_layoutnon-commutative and makes a worker-bearing manifest unequal to itself, asserted by the new test at threaded.rs:1648-1650 (assert!(!same_layout(&root, &root))). A layout predicate that says a manifest differs from itself is not a layout predicate.
Recommended: delete threaded.rs:1292-1294 entirely (nothing else compares workers; the only caller besides tests is :639, and the peer rule is enforced once at :632). Then the new test rank_layout_permits_persistent_worker_only_on_rank_zero (threaded.rs:1631-1651) reduces to three assert!(same_layout(...)) — i.e. it no longer tests anything worth keeping, because peer rejection is already covered by helios/src/execution/tests.rs:1372-1373 (ThreadedExecutor::new(value, vec![value]) and (manifest(), vec![value]) must err). Either delete the test with the clause, or move it to a ThreadedExecutor::new acceptance case, which is the currently untested direction.
#5 [high] Research summary
Subtraction/Simplicity/Conventions review of PR #640 complete. Notes are in the scratchpad (entries 1-4).
Verdict: mostly lean, but three pieces of the new code should not exist. The diff is net +68/−34 and is mostly the correct kind of change — predicates swapped, tests updated. The problems are all additions that duplicate a check the same call path already makes, plus one stale spec the PR forgot.
High-value finding 1 — helios/src/execution/threaded.rs:1292-1294: delete. The new if !b.persistent_workers.is_empty() { return false; } replaces a field-wise worker comparison with an asymmetric test that makes a worker-bearing manifest unequal to itself (assert!(!same_layout(&root, &root)), threaded.rs:1650). It is also redundant: ThreadedExecutor::new at threaded.rs:632-636 already rejects every peer manifest carrying a worker, and it does so before same_layout is consulted (loop at :637-642), with a precise error instead of "rank graph I/O schemas differ". Deleting the clause also removes the need for the new test at threaded.rs:1631-1651, whose peer-rejection direction is already covered by helios/src/execution/tests.rs:1372-1373.
High-value finding 2 — helios/src/runtime_core/selection.rs:285-289: delete. LoadOptions::select is pub(super) and its only non-test caller is helios/src/runtime_core/model.rs:441, which runs validate_persistent_worker_topology at model.rs:386 — whose new body rejects exactly any peer-rank worker. The rank > 0 branch is unreachable in production and only exercised by the synthetic test at selection.rs:710-720 that calls select directly. Removing it collapses three error strings back to two and keeps the rank-0 rule in one place.
Medium finding 3 — helios/src/runtime_core/model.rs:118-127: the same five-line closure is written twice (has_rank0_worker, has_peer_worker); collapse to one local closure.
Convention finding 4 — helios/manifest.md:92-95 is now false ("multi-rank cores … fail validation before execution") and the PR body does not mention it; only docs/runtime-core-design.md:642-644 was reworded. AGENTS.md requires design documents to state the architecture the code implements, and two specs now disagree. Recommended rejection/rescue: none of these need a new abstraction — every fix is a deletion plus a one-line reword.
#6 [high] Lens verdict: what is lean vs. what to delete (summary for report)
Overall Subtraction/Simplicity/Conventions verdict for PR #640 (4 files, +68/−34): mostly lean, 3 pieces of added code should not exist, 1 stale spec.
Already lean — verified and NOT worth flagging:
- No new flags, config keys, LoadOptions fields, env vars, wrappers, or fallback branches anywhere in the diff.
LoadOptions(selection.rs:16-43) is untouched apart from deleting the locallet multi_rank = cores.len() > 1;at old selection.rs:225 — a genuine subtraction. helios/src/execution/parallel.rs:122-126and:552-559(socket TP / serve_rank worker rejection) are deliberately untouched and still say "single-rank cores"; that is scope-consistent, not dead code (covered by parallel/tests.rs:675-707).helios/src/runtime_core/mod.rs:362-368,protobuf.rs:295-300,manifest.rs:442-448one-worker-per-rank checks predate this PR; not this PR's cleanup.- Test changes are proportionate: renamed tests keep the same shape, the
[worker_core(), core()]acceptance added at selection.rs:697-707 is the right new coverage; the loop collapse at selection.rs:710-720 is fine. - docs/runtime-core-design.md:642-644 rewording is a genuine simplification of a convoluted "single-rank ... or multi-rank or multi-host rejected" sentence.
To delete / reword (details in entries 1-4):
- threaded.rs:1292-1294 —
if !b.persistent_workers.is_empty() { return false; }— redundant with threaded.rs:632-636, asymmetric, makes same_layout(&x,&x)==false. Delete; then threaded.rs:1631-1651 test is redundant with execution/tests.rs:1372-1373. - selection.rs:285-289 —
if !execution.persistent_workers.is_empty() && rank > 0 { ... }— unreachable from the only production caller (model.rs:441 after model.rs:386). Delete. - model.rs:118-127 — duplicated 5-line closure; hoist one
let has_worker = |core: &Core| .... - helios/manifest.md:92-95 — still says "multi-rank cores ... fail validation before execution"; now false. Reword to match docs/runtime-core-design.md:642-644.
Process note: AGENTS.md "Reject unsupported abstractions and churn" and "Require focused, meaningful validation" (AGENTS.md:188-199) support findings 1-2 — a second validator for a rule already enforced upstream is exactly the redundant layer that policy names.
#4 [medium] model.rs topology validation duplicates the same predicate twice
helios/src/runtime_core/model.rs:118-132 (new code):
let has_rank0_worker = cores.first().is_some_and(|core| {
core.execution
.as_ref()
.is_some_and(|execution| !execution.persistent_workers.is_empty())
});
let has_peer_worker = cores.iter().skip(1).any(|core| {
core.execution
.as_ref()
.is_some_and(|execution| !execution.persistent_workers.is_empty())
});
The same five-line closure body is written twice. Collapse to one:
let has_worker = |core: &Core| {
core.execution
.as_ref()
.is_some_and(|execution| !execution.persistent_workers.is_empty())
};
let has_rank0_worker = cores.first().is_some_and(has_worker);
let has_peer_worker = cores.iter().skip(1).any(has_worker);
Minor and mechanical, but this is the one place in the diff that got longer than it needs to be. Note the sibling predicate let wants_worker = core.execution.as_ref().and_then(|e| e.persistent_workers.first()); at helios/src/runtime_core/mod.rs:369-372 is the same test expressed differently; a shared accessor on Core/wire::Execution would serve both, but that is optional beyond this PR's scope.