Skip to content

Force radix flush on weight sync for exact RL lanes - #50

Closed
kiddyboots216 wants to merge 1 commit into
cleanup-testsfrom
pr/radix-flush-on-weight-sync
Closed

Force radix flush on weight sync for exact RL lanes#50
kiddyboots216 wants to merge 1 commit into
cleanup-testsfrom
pr/radix-flush-on-weight-sync

Conversation

@kiddyboots216

Copy link
Copy Markdown
Contributor

Force radix flush on weight sync for exact RL lanes

Stack position: after cleanup-tests. The paired xorl-sglang PR is stacked
after the existing xorl-sglang exactness stack and is pinned by this branch.

Problem

An exact RL endpoint can keep radix-prefix KV computed with the previous
weights when a weight update does not explicitly request a cache flush. The
next prefix hit can therefore mix old-policy KV with new-policy weights and
silently break trainer/sampler parity.

Change

  • The xorl-sglang weight-update funnel forces a radix-cache flush whenever
    rl_on_policy_target is active and radix is enabled. A mandatory flush that
    cannot complete fails closed.
  • The XoRL client reports whether each endpoint has radix enabled and makes
    cache_invalidation_mode="auto" flush such endpoints as a compatibility
    backstop for older engines.
  • Behavior outside the exact-RL contract is unchanged; explicit
    cache_invalidation_mode="none" remains a client opt-out, while the engine
    guard still protects exact lanes.

Validation

  • xorl-sglang scheduler weight-updater unit suite: 4 cases covering forced
    engagement, non-RL and radix-disabled autonomy, and fail-closed behavior.
  • XoRL inference-endpoint suite: 7 passed, including radix-enabled BF16 auto
    invalidation and endpoint capability parsing.
  • Live stale-prefix reproduction: the pre-fix endpoint reused cached tokens
    after weight sync and diverged from a fresh prefill; the fixed endpoint
    flushed the cache and restored byte equality.

This PR contains only production code, conventional tests, and the required
xorl-sglang gitlink update. Prototype scenarios and campaign evidence are not
included.

@broly-code-security-scanner

Copy link
Copy Markdown

Broly Security Scan

Note

Clean scan
No vulnerabilities detected in this PR.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (zai-org/GLM-5.2) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Exploit Chains · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

Make cache invalidation fail closed for exact RL weight updates. The paired SGLang engine commit forces a radix-cache flush regardless of the client flag, while the XoRL endpoint policy auto-flushes any endpoint reporting radix enabled. Advance the sampler pin to the engine half so this stack actually consumes the mandatory guard.

@qywu qywu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Approving — this is a real bug with a correctly-sized fix. The stale-prefix failure mode is well described, the client-side rule is scoped to mode == "auto", mode="none" still opts out, and the four new tests cover engagement, both non-engagement paths, and the disable_radix_cache parsing. Ran the suite locally: 7 passed.

Two non-blocking notes.

1. Unknown radix state fails open. _server_info_radix_cache_enabled returns None when an endpoint reports neither radix_cache_enabled nor disable_radix_cache, and the aggregate in _resolve_sync_cache_behavior starts at False and only flips on info.radix_cache_enabled is True. So an endpoint that doesn't report its radix state won't trigger the auto flush — which is the opposite of fail-closed for exactly the older engines this rule is described as backstopping. Since SGLang enables the radix cache by default, treating None as "assume enabled" seems closer to the intent. Cheap to add a case for it in test_radix_state_parsed_from_disable_radix_cache.

2. ruff-format fails. pre-commit run --all-files reformats tests/server/api_server/test_inference_endpoints.py at this head. main is clean, so this would fail lint CI on merge — it just hasn't run, because lint.yml triggers only on pull_request: branches: [main] and this PR targets cleanup-tests.

Note that this branch sits on #49's base, which I've flagged separately as diverged from its declared parent — that's a stacking issue rather than anything wrong with this change.

@kiddyboots216

Copy link
Copy Markdown
Contributor Author

Superseded by #57, which consolidates the complete exact trainer-serving stack directly onto main.

@kiddyboots216
kiddyboots216 deleted the pr/radix-flush-on-weight-sync branch August 17, 2026 23:41
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.

2 participants