Skip to content

[None][fix] Contain ambiguous Python KV retirement and shutdown - #17982

Draft
chienchunhung wants to merge 6 commits into
NVIDIA:mainfrom
chienchunhung:codex/disagg-kv-ownership-p1-4-retirement-containment
Draft

chienchunhung wants to merge 6 commits into
NVIDIA:mainfrom
chienchunhung:codex/disagg-kv-ownership-p1-4-retirement-containment

Conversation

@chienchunhung

@chienchunhung chienchunhung commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Stack position

Phase1-PR4 of 5. Depends on #17981 (Phase1-PR3). This layer remains dormant; #17983 is the sole activation gate.

  1. Phase1-PR1: [None][fix] Guard Python KV receive ownership and publication #17720 — receive ownership and publication gate
  2. Phase1-PR2: [None][fix] Correlate Python KV receive evidence by generation #17979 — process-local receive-evidence generation
  3. Phase1-PR3: [None][fix] Retain Python KV source ownership through backend quiescence #17981 — CTX source ownership and backend quiescence
  4. Phase1-PR4: [None][fix] Contain ambiguous Python KV retirement and shutdown #17982 — ambiguous retirement and shutdown containment
  5. Phase1-PR5: [None][fix] Qualify Python KV physical ownership for context-first #17983 — activation, fail-closed qualification, and H100 canary

The stack is linear on current main@586d84cdc; because fork heads cannot be upstream PR bases, each PR targets main. Review only 9c3b2db43...6fe42ebc8.

Problem and change

PR1–PR3 establish destination and source owners, but timeout, lost/contradictory evidence, request removal, and shutdown still need a fail-closed retirement policy.

This PR:

  • retains source or destination ownership when backend completion or terminal-result publication is ambiguous;
  • introduces IN_DOUBT retention and progressive polling instead of treating local timeout as quiescence;
  • shares one sticky physical-ownership fault across send and receive directions and fail-stops participating ranks before later collectives;
  • retires failed/cancelled sessions only after every physical accessor is proven quiescent;
  • refuses request-resource release and shutdown while transfer-owned memory may still be in use; and
  • makes ownership-enabled shutdown progressive and retryable without changing the legacy default-off teardown path.

Validation

Focused CPU regressions cover timeout retention, lost/contradictory evidence, late completion, session removal, allocator reuse, local/remote ownership-fault votes, request retirement, and shutdown. Four activation-boundary regressions and the H100 canary are intentionally in Phase1-PR5.

Repeated TRT-LLM code-owner self-review is clean. isort, yapf, ruff, Python compilation, pinned-memory policy, test-list validation, and git diff --check pass. Runtime pytest is unavailable locally; CI was not triggered for stack construction.

Isolated change size

Area Insertions Deletions Changed lines
Production 863 67 930
Tests 568 0 568
Total 1,431 67 1,498

Deferred

Production activation, deployment preflight, no-retry enforcement, and the qualified canary are Phase1-PR5. Retry/replay, generation-first, bounce/layerwise/auxiliary resources, real multi-rank or multi-worker qualification, broader Python adapters, leases, reroute, and C++ remain later phases.

@chienchunhung
chienchunhung force-pushed the codex/disagg-kv-ownership-p1-4-retirement-containment branch from 6fe42eb to 506941f Compare August 20, 2026 22:35

This branch has not been deployed

No deployments
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