Skip to content

[proto] declare ReportEvent snapshot schema#235

Closed
charpty wants to merge 2 commits into
mainfrom
codex/reportevent-snapshot-proto-only
Closed

[proto] declare ReportEvent snapshot schema#235
charpty wants to merge 2 commits into
mainfrom
codex/reportevent-snapshot-proto-only

Conversation

@charpty

@charpty charpty commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Align kv_cache_manager/protocol/protobuf/meta_service.proto with the schema shape from Add ReportEvent block snapshot reconciliation #230.
  • Rename the ReportEvent parameter message types to NodeRegisterEventParams, BlockAddEventParams, BlockDeleteEventParams, HostDownEventParams, and HeartbeatEventParams.
  • Add EVENT_BLOCK_SNAPSHOT, BlockSnapshotItem, BlockSnapshotEventParams, and the block_snapshot = 7 oneof branch.
  • Add BlockDeleteEventParams.spec_names = 3 as declared by Add ReportEvent block snapshot reconciliation #230.
  • Add a manager UT that constructs EVENT_BLOCK_SNAPSHOT and verifies the current server behavior is a safe rejection (INVALID_ARGUMENT item result), not an accidental implementation.

Design / Implementation status

  • This PR only declares the proto schema needed by the later full snapshot implementation.
  • EVENT_BLOCK_SNAPSHOT is still unavailable on the server side in this PR; callers must not send it until the implementation PR lands.
  • BlockDeleteEventParams.spec_names is included to match Add ReportEvent block snapshot reconciliation #230's schema; this PR does not change the current server-side delete behavior.
  • Existing in-tree C++ handlers continue to compile because they use stable oneof accessors such as item.block_add() / item.block_delete(); the oneof field names and numbers are unchanged.
  • The full snapshot reconciliation logic, including the later versioned-URI full-report design, is intentionally not implemented here.

Validation

  • Local: git diff --check
  • On 11.122.133.161, screen -x qisa, window 3, commit fb2290a:
    • git diff --check HEAD^
    • git diff --exit-code origin/pr/230 -- kv_cache_manager/protocol/protobuf/meta_service.proto
    • bazelisk --output_base=/home/qisa.cb/workdir/bazel/kvcm-code3-proto230-verify build --config=debug //kv_cache_manager/manager:cache_manager //kv_cache_manager/service:meta_service_impl //kv_cache_manager/service:service
    • bazelisk --output_base=/home/qisa.cb/workdir/bazel/kvcm-code3-proto230-verify test --config=debug --config=asan --test_env ASAN_OPTIONS=detect_odr_violation=0 //kv_cache_manager/manager/test:CacheManagerTest
    • Result: proto diff against Add ReportEvent block snapshot reconciliation #230 is empty, build completed successfully, CacheManagerTest PASSED, TEST_EXIT=0

@qoderai qoderai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

The snapshot-schema placeholder is reasonable and the comments correctly warn that EVENT_BLOCK_SNAPSHOT is not yet usable. Two concerns:

  1. Breaking renames — Renaming every existing *Params message to *EventParams is a breaking change for all generated-code consumers. This feels broader than a "schema-only, snapshot-focused" PR. If this is just aligning with PR #230, please make that explicit in the summary.

  2. Unimplemented semanticsBlockDeleteEventParams.spec_names describes runtime filtering behavior, but the PR is schema-only. Clarify whether the server already honors this field or if it should be treated as currently ignored, similar to the EVENT_BLOCK_SNAPSHOT warning.


🤖 Generated by Qoder

Comment on lines +114 to +121
NodeRegisterEventParams node_register = 2;
BlockAddEventParams block_add = 3;
BlockDeleteEventParams block_delete = 4;
HostDownEventParams host_down = 5;
HeartbeatEventParams heartbeat = 6;
// Declared for schema compatibility only; EVENT_BLOCK_SNAPSHOT is not
// usable until its server implementation lands.
BlockSnapshotEventParams block_snapshot = 7;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Renaming all existing *Params messages to *EventParams is a breaking change for any generated-code consumers (C++/Python/Go clients and the server). Since the PR description says this is a schema-only, snapshot-focused change, the scope of these renames feels broader than necessary. If PR #230 already introduced these names and this is just aligning, please mention that in the summary so reviewers know the breakage is intentional and pre-negotiated. Otherwise, consider keeping the original names and only adding the new snapshot types.


🤖 Generated by Qoder

Comment on lines +86 to +88
// Optional. When set, KVCM applies the delete only if these component names
// contain a full-attention spec; mamba-state-only deletes are ignored.
repeated string spec_names = 3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The comment describes runtime behavior ("KVCM applies the delete only if these component names contain a full-attention spec"), but this PR is schema-only. If the server does not yet honor spec_names, the comment could mislead callers into expecting filtering that does not exist. Please either clarify that this field is currently ignored (like EVENT_BLOCK_SNAPSHOT) or confirm that the matching implementation is already present elsewhere.


🤖 Generated by Qoder

@github-actions github-actions Bot added the ai reviewed AI has reviewed this PR label Jul 14, 2026
@charpty
charpty force-pushed the codex/reportevent-snapshot-proto-only branch from 5ef5d2b to c5a9b98 Compare July 14, 2026 09:39
@charpty
charpty marked this pull request as ready for review July 14, 2026 09:55
@charpty
charpty force-pushed the codex/reportevent-snapshot-proto-only branch from c5a9b98 to 76039c6 Compare July 14, 2026 09:57

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c5a9b98efb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +86 to +88
// Optional. When set, KVCM applies the delete only if these component names
// contain a full-attention spec; mamba-state-only deletes are ignored.
repeated string spec_names = 3;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor spec_names before deleting block locations

When a reporter sends EVENT_BLOCK_DELETE with spec_names set to only mamba-state names, this new schema promises that KVCM will ignore the delete, but the current ReportEvent path never reads p.spec_names() and always queues BuildLocationId(p.medium(), host_ip_port) for deletion in cache_manager.cc:1619-1620. That removes the entire host/medium location, including any full-attention specs previously added under the same location, so clients following the newly advertised field can accidentally evict valid KV cache metadata.

Useful? React with 👍 / 👎.

Comment on lines +72 to +76
message NodeRegisterEventParams {
repeated string mediums = 1; // mediums supported by the node, e.g. ["mem","disk"]
}

message BlockAddParams {
message BlockAddEventParams {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve generated ReportEvent message type names

Renaming the existing protobuf messages changes the generated API surface even though the field numbers and oneof accessors stay wire-compatible. Downstream ReportEvent producers that construct or annotate NodeRegisterParams, BlockAddParams, etc. from the current schema will fail to compile/import after regenerating stubs because those public types have been replaced by *EventParams; keeping the old message names while adding the snapshot types avoids a source-breaking schema-only change.

Useful? React with 👍 / 👎.

Comment on lines +56 to +57
// where each cache component of the block lives. KVCM currently matches only
// full-attention specs and ignores mamba-state specs by LocationSpec.name.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Don't advertise mamba specs as ignored

This comment creates an API contract that mamba-state LocationSpec.names are ignored, but the current EVENT_BLOCK_ADD implementation copies every reported spec into the upsert list (cache_manager.cc:1589-1595) with no name filtering. If a cache subscriber follows this schema text and reports mamba-only or mixed specs, KVCM can index and later return those non-full-attention components as cache metadata instead of ignoring them.

Useful? React with 👍 / 👎.

@charpty
charpty requested a review from lucky-zzz July 14, 2026 12:05

@wangxiyu191 wangxiyu191 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

@wangxiyu191 wangxiyu191 changed the title Declare ReportEvent snapshot proto schema [proto] declare ReportEvent snapshot schema Jul 16, 2026
@charpty charpty closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai reviewed AI has reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants