Skip to content

[Fix] Settle rollout forwarding timeouts at the normal offload barrier - #2380

Closed
jayhenry wants to merge 1 commit into
InternLM:mainfrom
jayhenry:fix/http-timeout-barrier-simplified
Closed

jayhenry wants to merge 1 commit into
InternLM:mainfrom
jayhenry:fix/http-timeout-barrier-simplified

Conversation

@jayhenry

@jayhenry jayhenry commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

Motivation

An upstream HTTP forwarding timeout can end the local request while LMDeploy is still generating. Treating that request as an unknown failure blocks the whole cross-weight-update barrier. This is a simpler alternative to #2332. It lets healthy requests finish and commit their traces, then uses the ordinary pause and offload sequence to confirm that remaining inference has stopped.

Changes

  • request_gate.py, session_server.py, worker.py distinguish a connector-confirmed timeout before send from a timeout during forwarding. The latter releases the HTTP lease but keeps the original request ID pending under its SID. The gate rejects reuse of that SID until backend stop is confirmed. This path requires LMDeploy PyTorch and a fixed entrypoint or session affinity.
  • controller.py, cross_weight_update_rollout.py, lmdeploy.py drain healthy requests before pausing and require successful ordinary offload across the fixed worker cohort before weight loading. A failed offload keeps admission sealed. Publication follows successful weight and KV reload.
  • sandbox_agent_loop/agent_in_sandbox_loop.py releases orphaned traces from mixed groups and preserves the traces and routed-expert references owned by retained samples. CPU regression tests cover these paths and both trainer modes.

Validation

Run in pt29_glm2 with CUDA_VISIBLE_DEVICES=''. The HTTP integration tests use loopback inference and management endpoints, the actual XTuner LMDeploy adapter, and a CPU Ray trace store.

python -B -m pytest -ra tests/rl/{test_request_gate,test_session_server_cross_weight_update_rollout,test_session_server_trace,test_session_server_endpoints,test_rollout_request_barrier,test_rollout_forward_timeout_offload}.py
python -B -m pytest -ra tests/rl/{test_rollout_logic,test_rollout_config_dist_port_base_patch,test_affinity_port_integration,test_affinity_router,test_trace_store_turn_provenance,test_rollout_state_training,test_rollout_teacher_scorer,test_rollout_to_train_item,test_lmdeploy_trust_remote_code,test_agent_loop_localhost,test_single_turn_agent_loop}.py
python -B -m pytest -ra tests/rl/{test_agent_loop_timeout_training,test_agent_loop_manager_checkpoint,test_rl_colocate_trainer,test_rl_disaggregated_trainer,test_rl_trainer_checkpoint}.py

All 268 CPU tests passed across the three groups (69, 143, and 56).

ruff check, ruff format --check, git diff --check, and the applicable pre-commit hooks passed, including mypy. The unmodified repository-wide Pydantic hook tries to initialize CUDA while importing RMSNorm, which also fails on upstream main with devices hidden. The schema scan passed on CPU with that CUDA-only import excluded.

Keep timed-out request IDs pending after the HTTP lease exits. Confirm backend stop at offload and preserve trace ownership for retained samples.
@jayhenry

jayhenry commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator Author

The HTTP timeout barrier patch is now Layer 1 of the same-repository Mini-Agent stack. Closing this fork PR in favor of #2381.

@jayhenry jayhenry closed this Dec 4, 2026
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