Skip to content

[TENT] Add IntentType enum to Request for Transfer Intent API#2810

Merged
alogfans merged 5 commits into
kvcache-ai:mainfrom
catyans:feat/intent-type
Jul 10, 2026
Merged

[TENT] Add IntentType enum to Request for Transfer Intent API#2810
alogfans merged 5 commits into
kvcache-ai:mainfrom
catyans:feat/intent-type

Conversation

@catyans

@catyans catyans commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Define standard intent categories for TENT's Transfer Intent API, so the engine can identify a request's business semantics (KV foreground read vs background prefetch vs migration, etc.) before scheduling.

Changes

tent/include/tent/common/types.h (+11):

  • Add enum class IntentType: INTENT_UNSPEC, FOREGROUND_GET, BACKGROUND_PREFETCH, MIGRATION, CHECKPOINT, WEIGHT_LOADING, STAGING_INTERNAL
  • Add Request::intent_type field (default IntentType::INTENT_UNSPEC, behavior byte-identical to today)

tent/src/python/pybind.cpp (+26/-3):

  • Export IntentType enum to Python
  • Add intent_type, policy_name, deadline_ns to Request.__init__ constructor (all with backward-compatible defaults)
  • Add def_readwrite for all three fields

tent/tests/intent_type_test.cpp (new, 95 lines):

  • 6 gtest cases: defaults, assignment, integer values, field independence, copy, batch usage

Test plan

  • gtest: 6 cases passed on cluster (lingjun-099, gcc-13.3)
  • clang-format-20: passed on all modified files
  • GitHub CI: tent-ci (cuda-on/off), build-wheel, build-arm64, build-musa, format check — all passed

Performance note

This PR adds a metadata-only field (4-byte int) to Request. No runtime logic reads it yet — behavior is byte-identical to before. No performance regression possible.

Design notes

  • Uses enum class (scoped enum) to prevent namespace pollution per reviewer feedback.
  • Opt-in, default-off: INTENT_UNSPEC means "no intent declared" — engine behaves identically to today.
  • The enum is intentionally flat (not a bitfield) because a request has exactly one business intent.
  • Future PRs will use intent_type to drive policy selection, admission priority, or telemetry tagging — this PR only defines the vocabulary.

Relates to: TENT roadmap "Transfer Intent API"

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new IntentType enum and integrates it into the Request struct, its Python bindings, and corresponding unit tests. The reviewer recommends refactoring the plain IntentType enum to a scoped enum class to prevent namespace pollution and improve type safety, along with updating the default initializer and unit tests to use the scoped enum values.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread mooncake-transfer-engine/tent/include/tent/common/types.h Outdated
Comment thread mooncake-transfer-engine/tent/include/tent/common/types.h Outdated
Comment thread mooncake-transfer-engine/tent/tests/intent_type_test.cpp
@catyans
catyans force-pushed the feat/intent-type branch from 0d6bc52 to 0246ac6 Compare July 9, 2026 06:13
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@catyans
catyans force-pushed the feat/intent-type branch from 0246ac6 to 25ff21d Compare July 9, 2026 06:58
Define standard intent categories (FOREGROUND_GET, BACKGROUND_PREFETCH,
MIGRATION, CHECKPOINT, WEIGHT_LOADING, STAGING_INTERNAL) so TENT can
identify a request's business semantics before scheduling.

Changes:
- types.h: add IntentType enum class + Request::intent_type field
  (default INTENT_UNSPEC, behavior byte-identical to today)
- pybind.cpp: export IntentType enum, add intent_type/policy_name/
  deadline_ns to Request constructor and as readwrite attributes
- intent_type_test.cpp: 6 gtest cases covering defaults, assignment,
  integer values, field independence, copy, and batch usage

Relates to: TENT roadmap "Transfer Intent API"
@catyans
catyans force-pushed the feat/intent-type branch from 25ff21d to 9376ba8 Compare July 9, 2026 07:03

@alogfans alogfans left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM after merging conflicts

@catyans

catyans commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator Author

Merged current upstream/main and resolved the pybind conflict in 5905bea5. The binding keeps main’s policy_name and deadline_ns fields and adds this PR’s intent_type without changing the existing positional field order. Cluster smoke build completed, and tent_intent_type_test passes 6/6. The PR is mergeable and approved again; remaining CI jobs are still running.

@alogfans
alogfans merged commit d409ed8 into kvcache-ai:main Jul 10, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants