[2474-P2] 清理 env/command 静默缝:删孤儿 hook、metric fail-closed、注释改写 by TATP-233 · Pull Request #2493 · Motphys/UniLab · GitHub
Skip to content

[2474-P2] 清理 env/command 静默缝:删孤儿 hook、metric fail-closed、注释改写 - #2493

Merged
TATP-233 merged 3 commits into
mainfrom
fix/issue-2474-p2-env-command-silent-seams
Oct 21, 2026
Merged

TATP-233 merged 3 commits into
mainfrom
fix/issue-2474-p2-env-command-silent-seams

Conversation

@TATP-233

Copy link
Copy Markdown
Collaborator

Closes #2492。父审计 issue:#2474(P2 行)。

改动

  1. src/unilab/base/env_factory.py:Genesis spawn 设备绑定注释改写为"必需冷路径",移除 "compatibility shim" 字样,保持 shim 关键词扫描可信(纯注释,零行为变化)。
  2. src/unilab/envs/manager_based_rl_env.py:删除孤儿 hook _suppress_hot_state_refresh(_enter/_exit_suppressed_hot_state_refresh + getattr(..., False) 分支,-17 行)。历史查证:由 fc45ec2 引入,唯一消费方 torch_flashsac_env.py 已随 736025b 整文件删除,全库无残留引用。
  3. src/unilab/envs/mdp/commands/velocity_command.py:_metric_velocities 在 read_plan is None 时由静默返回零张量改为抛 RuntimeError(指明正确生命周期顺序),新增测试 test_metrics_fail_closed_before_read_plan_compilation 钉住。

验证(隔离 worktree @ origin/main 3e528bd)

  • pytest -q tests/envs/mdp/:174 passed, 2 skipped
  • 相关 env/manager/task 聚焦套件:363 passed, 12 skipped
  • pytest -q tests/envs tests/base tests/managers:957 passed, 38 skipped
  • make check:ruff + mypy(210 files) + pyright 全绿
  • make test(非 slow 全量):2737 passed, 60 skipped, 0 failed

备注

velocity_command.py 的 _heading() 在 read_plan is None 时同样返回零张量(:292-298),不在本 issue 范围,留待 #2474 后续跟踪。

…path

The comment block called itself "not a compatibility shim" while still
containing the shim keyword, which defeats keyword scans for residual
shim surfaces. Reword it to state plainly that per-process device binding
in spawn collectors is a required cold path.

Refs #2474, #2492
The _suppress_hot_state_refresh getattr hook and its
_enter/_exit_suppressed_hot_state_refresh pair were introduced in
fc45ec2 for _DeviceResidentColdContractProxy in the motion-tracking
torch_flashsac_env; that sole consumer was removed in 736025b, leaving
a silent getattr(..., False) hook with no in-repo implementation. Delete
it outright instead of promoting an unused extension point.

Refs #2474, #2492
UniformVelocityCommand._metric_velocities silently returned zero tensors
when the scene's packed tensor read plan was not compiled yet, which
would mask an ordering bug since metrics are only consumed by per-step
command compute after plan compilation. Raise an explicit RuntimeError
naming the required lifecycle order, and pin it with a test.

Refs #2474, #2492
@TATP-233
TATP-233 merged commit 7c84137 into main Oct 21, 2026
12 checks passed
@TATP-233
TATP-233 deleted the fix/issue-2474-p2-env-command-silent-seams branch October 21, 2026 14:32
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.

[2474-P2] 清理 env/command 静默缝:_suppress_hot_state_refresh、_metric_velocities、env_factory 注释

1 participant