Survive a control plane restart without orphaning live engines
CI / test (push) Successful in 1m44s

Not persisting replica state left one hole: restarting the control plane made it
forget every replica while the engines kept running. They held GPUs the
inventory believed were free, so the next placement failed to allocate, with an
error naming the new process rather than the old one.

The fix belongs on the agent, not in a database. A row can say "running" about a
process that died; the fleet cannot.

- the supervisor writes the full shard spec, not just a pid and command line. A
  pid identifies a process; the spec is what lets it be described back to the
  control plane and matched to a replica.
- Adopt takes over an engine a previous agent left running. It is not this
  process's child, so it cannot be waited on: it is watched by polling and
  stopped by signalling its group directly. Its earlier output is gone and the
  log says so rather than presenting emptiness as silence.
- every Register reports what the agent is running, not only the first, because
  a reconnect may be a control plane restart and has to recover the same way.
- the reconciler rebuilds replicas from those reports and reclaims their GPUs.
  Anything whose model or profile left the catalog is stopped; nothing will
  route to it and it is holding cards.
- an engine the agent cannot identify is killed. A process holding GPUs that
  nothing can describe is worse than no process, because placement hands those
  GPUs out again.

Stop was also wrong for adopted shards: it checked for an exec.Cmd, which they
do not have, and reported them stopped without killing anything.

TestAgentReconnects had been passing for no reason. httptest's
CloseClientConnections does nothing to an h2c stream — prior-knowledge h2c
hijacks the connection and httptest stops tracking hijacked ones — so the agent
never reconnected, and the assertion on the connection map passed on a stale
entry. Tests now sever connections through their own listener and count opened
streams.

Plan §11 also records what multi-node still needs, since placement landing early
makes it look further along than it is: workers never become Ready because the
agent health-checks every shard while only rank 0 serves HTTP; RayCommand is
written and tested but never called; and startup is fire-and-forget.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
ilkerandClaude Opus 5 committed 2026-09-16 06:15:04 +02:00
1 parent 40427b2705
commit 75a8e76706
13 files changed
+1312 -145

No files matched your search

+287 -71
View File
@@ -90,7 +90,7 @@ func (x ShardStatus_State) Number() protoreflect.EnumNumber {
// Deprecated: Use ShardStatus_State.Descriptor instead.
func (ShardStatus_State) EnumDescriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{6, 0}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{7, 0}
}
// AgentMessage is anything a node tells the control plane.
@@ -327,8 +327,17 @@ type Register struct {
// engine_versions decides which CLI flags and metric names apply; both drift
// between engine releases (plan §14).
EngineVersions map[string]string `protobuf:"bytes,8,rep,name=engine_versions,json=engineVersions,proto3" json:"engine_versions,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
// running_shards are the engines this agent is already supervising, including
// ones adopted from a previous agent.
//
// This is what lets a control plane restart recover instead of orphaning live
// engines. Without it the control plane forgets every replica, places new
// ones, and the old engines keep holding GPUs the inventory believes are free
// — so the new engines fail to allocate, with an error naming the wrong
// process (plan §6.5).
RunningShards []*RunningShard `protobuf:"bytes,9,rep,name=running_shards,json=runningShards,proto3" json:"running_shards,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *Register) Reset() {
@@ -417,6 +426,169 @@ func (x *Register) GetEngineVersions() map[string]string {
return nil
}
func (x *Register) GetRunningShards() []*RunningShard {
if x != nil {
return x.RunningShards
}
return nil
}
// RunningShard describes an engine already running on a node.
//
// It carries enough for the control plane to rebuild the replica it belongs to,
// which is more than a shard id: the replica's identity, its pool and fabric,
// and the leader endpoint clients reach it through.
type RunningShard struct {
state protoimpl.MessageState `protogen:"open.v1"`
ReplicaId string `protobuf:"bytes,1,opt,name=replica_id,json=replicaId,proto3" json:"replica_id,omitempty"`
ShardId string `protobuf:"bytes,2,opt,name=shard_id,json=shardId,proto3" json:"shard_id,omitempty"`
Rank int32 `protobuf:"varint,3,opt,name=rank,proto3" json:"rank,omitempty"`
Nnodes int32 `protobuf:"varint,4,opt,name=nnodes,proto3" json:"nnodes,omitempty"`
GpuIndices []int32 `protobuf:"varint,5,rep,packed,name=gpu_indices,json=gpuIndices,proto3" json:"gpu_indices,omitempty"`
Hcas []string `protobuf:"bytes,6,rep,name=hcas,proto3" json:"hcas,omitempty"`
HttpPort int32 `protobuf:"varint,7,opt,name=http_port,json=httpPort,proto3" json:"http_port,omitempty"`
State ShardStatus_State `protobuf:"varint,8,opt,name=state,proto3,enum=llmgw.v1.ShardStatus_State" json:"state,omitempty"`
// model and profile name the catalog entry this shard was started from.
Model string `protobuf:"bytes,9,opt,name=model,proto3" json:"model,omitempty"`
Profile string `protobuf:"bytes,10,opt,name=profile,proto3" json:"profile,omitempty"`
// pool and fabric are echoed back from the StartShard that created it; the
// agent has no way to derive them.
Pool string `protobuf:"bytes,11,opt,name=pool,proto3" json:"pool,omitempty"`
Fabric string `protobuf:"bytes,12,opt,name=fabric,proto3" json:"fabric,omitempty"`
LeaderAddr string `protobuf:"bytes,13,opt,name=leader_addr,json=leaderAddr,proto3" json:"leader_addr,omitempty"`
LeaderPort int32 `protobuf:"varint,14,opt,name=leader_port,json=leaderPort,proto3" json:"leader_port,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *RunningShard) Reset() {
*x = RunningShard{}
mi := &file_llmgw_v1_agent_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *RunningShard) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*RunningShard) ProtoMessage() {}
func (x *RunningShard) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use RunningShard.ProtoReflect.Descriptor instead.
func (*RunningShard) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{3}
}
func (x *RunningShard) GetReplicaId() string {
if x != nil {
return x.ReplicaId
}
return ""
}
func (x *RunningShard) GetShardId() string {
if x != nil {
return x.ShardId
}
return ""
}
func (x *RunningShard) GetRank() int32 {
if x != nil {
return x.Rank
}
return 0
}
func (x *RunningShard) GetNnodes() int32 {
if x != nil {
return x.Nnodes
}
return 0
}
func (x *RunningShard) GetGpuIndices() []int32 {
if x != nil {
return x.GpuIndices
}
return nil
}
func (x *RunningShard) GetHcas() []string {
if x != nil {
return x.Hcas
}
return nil
}
func (x *RunningShard) GetHttpPort() int32 {
if x != nil {
return x.HttpPort
}
return 0
}
func (x *RunningShard) GetState() ShardStatus_State {
if x != nil {
return x.State
}
return ShardStatus_STATE_UNSPECIFIED
}
func (x *RunningShard) GetModel() string {
if x != nil {
return x.Model
}
return ""
}
func (x *RunningShard) GetProfile() string {
if x != nil {
return x.Profile
}
return ""
}
func (x *RunningShard) GetPool() string {
if x != nil {
return x.Pool
}
return ""
}
func (x *RunningShard) GetFabric() string {
if x != nil {
return x.Fabric
}
return ""
}
func (x *RunningShard) GetLeaderAddr() string {
if x != nil {
return x.LeaderAddr
}
return ""
}
func (x *RunningShard) GetLeaderPort() int32 {
if x != nil {
return x.LeaderPort
}
return 0
}
type GPU struct {
state protoimpl.MessageState `protogen:"open.v1"`
Index int32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"`
@@ -442,7 +614,7 @@ type GPU struct {
func (x *GPU) Reset() {
*x = GPU{}
mi := &file_llmgw_v1_agent_proto_msgTypes[3]
mi := &file_llmgw_v1_agent_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -454,7 +626,7 @@ func (x *GPU) String() string {
func (*GPU) ProtoMessage() {}
func (x *GPU) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[3]
mi := &file_llmgw_v1_agent_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -467,7 +639,7 @@ func (x *GPU) ProtoReflect() protoreflect.Message {
// Deprecated: Use GPU.ProtoReflect.Descriptor instead.
func (*GPU) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{3}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{4}
}
func (x *GPU) GetIndex() int32 {
@@ -582,7 +754,7 @@ type FabricAttachment struct {
func (x *FabricAttachment) Reset() {
*x = FabricAttachment{}
mi := &file_llmgw_v1_agent_proto_msgTypes[4]
mi := &file_llmgw_v1_agent_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -594,7 +766,7 @@ func (x *FabricAttachment) String() string {
func (*FabricAttachment) ProtoMessage() {}
func (x *FabricAttachment) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[4]
mi := &file_llmgw_v1_agent_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -607,7 +779,7 @@ func (x *FabricAttachment) ProtoReflect() protoreflect.Message {
// Deprecated: Use FabricAttachment.ProtoReflect.Descriptor instead.
func (*FabricAttachment) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{4}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{5}
}
func (x *FabricAttachment) GetFabric() string {
@@ -645,7 +817,7 @@ type Heartbeat struct {
func (x *Heartbeat) Reset() {
*x = Heartbeat{}
mi := &file_llmgw_v1_agent_proto_msgTypes[5]
mi := &file_llmgw_v1_agent_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -657,7 +829,7 @@ func (x *Heartbeat) String() string {
func (*Heartbeat) ProtoMessage() {}
func (x *Heartbeat) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[5]
mi := &file_llmgw_v1_agent_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -670,7 +842,7 @@ func (x *Heartbeat) ProtoReflect() protoreflect.Message {
// Deprecated: Use Heartbeat.ProtoReflect.Descriptor instead.
func (*Heartbeat) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{5}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{6}
}
func (x *Heartbeat) GetNodeId() string {
@@ -712,7 +884,7 @@ type ShardStatus struct {
func (x *ShardStatus) Reset() {
*x = ShardStatus{}
mi := &file_llmgw_v1_agent_proto_msgTypes[6]
mi := &file_llmgw_v1_agent_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -724,7 +896,7 @@ func (x *ShardStatus) String() string {
func (*ShardStatus) ProtoMessage() {}
func (x *ShardStatus) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[6]
mi := &file_llmgw_v1_agent_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -737,7 +909,7 @@ func (x *ShardStatus) ProtoReflect() protoreflect.Message {
// Deprecated: Use ShardStatus.ProtoReflect.Descriptor instead.
func (*ShardStatus) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{6}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{7}
}
func (x *ShardStatus) GetNodeId() string {
@@ -808,13 +980,17 @@ type StartShard struct {
HttpPort int32 `protobuf:"varint,10,opt,name=http_port,json=httpPort,proto3" json:"http_port,omitempty"`
Profile *EngineProfile `protobuf:"bytes,11,opt,name=profile,proto3" json:"profile,omitempty"`
StartupTimeoutMs int64 `protobuf:"varint,12,opt,name=startup_timeout_ms,json=startupTimeoutMs,proto3" json:"startup_timeout_ms,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
// pool and fabric are control plane concepts the agent cannot derive. They
// are sent so the agent can echo them back in RunningShard after a restart.
Pool string `protobuf:"bytes,13,opt,name=pool,proto3" json:"pool,omitempty"`
Fabric string `protobuf:"bytes,14,opt,name=fabric,proto3" json:"fabric,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *StartShard) Reset() {
*x = StartShard{}
mi := &file_llmgw_v1_agent_proto_msgTypes[7]
mi := &file_llmgw_v1_agent_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -826,7 +1002,7 @@ func (x *StartShard) String() string {
func (*StartShard) ProtoMessage() {}
func (x *StartShard) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[7]
mi := &file_llmgw_v1_agent_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -839,7 +1015,7 @@ func (x *StartShard) ProtoReflect() protoreflect.Message {
// Deprecated: Use StartShard.ProtoReflect.Descriptor instead.
func (*StartShard) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{7}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{8}
}
func (x *StartShard) GetReplicaId() string {
@@ -926,6 +1102,20 @@ func (x *StartShard) GetStartupTimeoutMs() int64 {
return 0
}
func (x *StartShard) GetPool() string {
if x != nil {
return x.Pool
}
return ""
}
func (x *StartShard) GetFabric() string {
if x != nil {
return x.Fabric
}
return ""
}
type EngineProfile struct {
state protoimpl.MessageState `protogen:"open.v1"`
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
@@ -945,7 +1135,7 @@ type EngineProfile struct {
func (x *EngineProfile) Reset() {
*x = EngineProfile{}
mi := &file_llmgw_v1_agent_proto_msgTypes[8]
mi := &file_llmgw_v1_agent_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -957,7 +1147,7 @@ func (x *EngineProfile) String() string {
func (*EngineProfile) ProtoMessage() {}
func (x *EngineProfile) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[8]
mi := &file_llmgw_v1_agent_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -970,7 +1160,7 @@ func (x *EngineProfile) ProtoReflect() protoreflect.Message {
// Deprecated: Use EngineProfile.ProtoReflect.Descriptor instead.
func (*EngineProfile) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{8}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{9}
}
func (x *EngineProfile) GetName() string {
@@ -1060,7 +1250,7 @@ type StopShard struct {
func (x *StopShard) Reset() {
*x = StopShard{}
mi := &file_llmgw_v1_agent_proto_msgTypes[9]
mi := &file_llmgw_v1_agent_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1072,7 +1262,7 @@ func (x *StopShard) String() string {
func (*StopShard) ProtoMessage() {}
func (x *StopShard) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[9]
mi := &file_llmgw_v1_agent_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1085,7 +1275,7 @@ func (x *StopShard) ProtoReflect() protoreflect.Message {
// Deprecated: Use StopShard.ProtoReflect.Descriptor instead.
func (*StopShard) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{9}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{10}
}
func (x *StopShard) GetShardId() string {
@@ -1105,7 +1295,7 @@ type DrainShard struct {
func (x *DrainShard) Reset() {
*x = DrainShard{}
mi := &file_llmgw_v1_agent_proto_msgTypes[10]
mi := &file_llmgw_v1_agent_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1117,7 +1307,7 @@ func (x *DrainShard) String() string {
func (*DrainShard) ProtoMessage() {}
func (x *DrainShard) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[10]
mi := &file_llmgw_v1_agent_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1130,7 +1320,7 @@ func (x *DrainShard) ProtoReflect() protoreflect.Message {
// Deprecated: Use DrainShard.ProtoReflect.Descriptor instead.
func (*DrainShard) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{10}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{11}
}
func (x *DrainShard) GetShardId() string {
@@ -1152,7 +1342,7 @@ type Ack struct {
func (x *Ack) Reset() {
*x = Ack{}
mi := &file_llmgw_v1_agent_proto_msgTypes[11]
mi := &file_llmgw_v1_agent_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1164,7 +1354,7 @@ func (x *Ack) String() string {
func (*Ack) ProtoMessage() {}
func (x *Ack) ProtoReflect() protoreflect.Message {
mi := &file_llmgw_v1_agent_proto_msgTypes[11]
mi := &file_llmgw_v1_agent_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1177,7 +1367,7 @@ func (x *Ack) ProtoReflect() protoreflect.Message {
// Deprecated: Use Ack.ProtoReflect.Descriptor instead.
func (*Ack) Descriptor() ([]byte, []int) {
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{11}
return file_llmgw_v1_agent_proto_rawDescGZIP(), []int{12}
}
func (x *Ack) GetMessageId() string {
@@ -1216,7 +1406,7 @@ const file_llmgw_v1_agent_proto_rawDesc = "" +
"\x04stop\x18\x02 \x01(\v2\x13.llmgw.v1.StopShardH\x00R\x04stop\x12,\n" +
"\x05drain\x18\x03 \x01(\v2\x14.llmgw.v1.DrainShardH\x00R\x05drain\x12!\n" +
"\x03ack\x18\x04 \x01(\v2\r.llmgw.v1.AckH\x00R\x03ackB\x05\n" +
"\x03msg\"\xe1\x03\n" +
"\x03msg\"\xa0\x04\n" +
"\bRegister\x12\x17\n" +
"\anode_id\x18\x01 \x01(\tR\x06nodeId\x12\x1a\n" +
"\bhostname\x18\x02 \x01(\tR\bhostname\x12\x1b\n" +
@@ -1225,13 +1415,34 @@ const file_llmgw_v1_agent_proto_rawDesc = "" +
"\x04gpus\x18\x05 \x03(\v2\r.llmgw.v1.GPUR\x04gpus\x124\n" +
"\afabrics\x18\x06 \x03(\v2\x1a.llmgw.v1.FabricAttachmentR\afabrics\x12#\n" +
"\ragent_version\x18\a \x01(\tR\fagentVersion\x12O\n" +
"\x0fengine_versions\x18\b \x03(\v2&.llmgw.v1.Register.EngineVersionsEntryR\x0eengineVersions\x1a9\n" +
"\x0fengine_versions\x18\b \x03(\v2&.llmgw.v1.Register.EngineVersionsEntryR\x0eengineVersions\x12=\n" +
"\x0erunning_shards\x18\t \x03(\v2\x16.llmgw.v1.RunningShardR\rrunningShards\x1a9\n" +
"\vLabelsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1aA\n" +
"\x13EngineVersionsEntry\x12\x10\n" +
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc8\x03\n" +
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x97\x03\n" +
"\fRunningShard\x12\x1d\n" +
"\n" +
"replica_id\x18\x01 \x01(\tR\treplicaId\x12\x19\n" +
"\bshard_id\x18\x02 \x01(\tR\ashardId\x12\x12\n" +
"\x04rank\x18\x03 \x01(\x05R\x04rank\x12\x16\n" +
"\x06nnodes\x18\x04 \x01(\x05R\x06nnodes\x12\x1f\n" +
"\vgpu_indices\x18\x05 \x03(\x05R\n" +
"gpuIndices\x12\x12\n" +
"\x04hcas\x18\x06 \x03(\tR\x04hcas\x12\x1b\n" +
"\thttp_port\x18\a \x01(\x05R\bhttpPort\x121\n" +
"\x05state\x18\b \x01(\x0e2\x1b.llmgw.v1.ShardStatus.StateR\x05state\x12\x14\n" +
"\x05model\x18\t \x01(\tR\x05model\x12\x18\n" +
"\aprofile\x18\n" +
" \x01(\tR\aprofile\x12\x12\n" +
"\x04pool\x18\v \x01(\tR\x04pool\x12\x16\n" +
"\x06fabric\x18\f \x01(\tR\x06fabric\x12\x1f\n" +
"\vleader_addr\x18\r \x01(\tR\n" +
"leaderAddr\x12\x1f\n" +
"\vleader_port\x18\x0e \x01(\x05R\n" +
"leaderPort\"\xc8\x03\n" +
"\x03GPU\x12\x14\n" +
"\x05index\x18\x01 \x01(\x05R\x05index\x12\x12\n" +
"\x04uuid\x18\x02 \x01(\tR\x04uuid\x12\x12\n" +
@@ -1276,7 +1487,7 @@ const file_llmgw_v1_agent_proto_rawDesc = "" +
"\vSTATE_READY\x10\x04\x12\x12\n" +
"\x0eSTATE_DRAINING\x10\x05\x12\x11\n" +
"\rSTATE_STOPPED\x10\x06\x12\x10\n" +
"\fSTATE_FAILED\x10\a\"\x8e\x03\n" +
"\fSTATE_FAILED\x10\a\"\xba\x03\n" +
"\n" +
"StartShard\x12\x1d\n" +
"\n" +
@@ -1295,7 +1506,9 @@ const file_llmgw_v1_agent_proto_rawDesc = "" +
"\thttp_port\x18\n" +
" \x01(\x05R\bhttpPort\x121\n" +
"\aprofile\x18\v \x01(\v2\x17.llmgw.v1.EngineProfileR\aprofile\x12,\n" +
"\x12startup_timeout_ms\x18\f \x01(\x03R\x10startupTimeoutMs\"\xfd\x02\n" +
"\x12startup_timeout_ms\x18\f \x01(\x03R\x10startupTimeoutMs\x12\x12\n" +
"\x04pool\x18\r \x01(\tR\x04pool\x12\x16\n" +
"\x06fabric\x18\x0e \x01(\tR\x06fabric\"\xfd\x02\n" +
"\rEngineProfile\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x16\n" +
"\x06engine\x18\x02 \x01(\tR\x06engine\x12\x1b\n" +
@@ -1341,47 +1554,50 @@ func file_llmgw_v1_agent_proto_rawDescGZIP() []byte {
}
var file_llmgw_v1_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_llmgw_v1_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_llmgw_v1_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
var file_llmgw_v1_agent_proto_goTypes = []any{
(ShardStatus_State)(0), // 0: llmgw.v1.ShardStatus.State
(*AgentMessage)(nil), // 1: llmgw.v1.AgentMessage
(*ControlMessage)(nil), // 2: llmgw.v1.ControlMessage
(*Register)(nil), // 3: llmgw.v1.Register
(*GPU)(nil), // 4: llmgw.v1.GPU
(*FabricAttachment)(nil), // 5: llmgw.v1.FabricAttachment
(*Heartbeat)(nil), // 6: llmgw.v1.Heartbeat
(*ShardStatus)(nil), // 7: llmgw.v1.ShardStatus
(*StartShard)(nil), // 8: llmgw.v1.StartShard
(*EngineProfile)(nil), // 9: llmgw.v1.EngineProfile
(*StopShard)(nil), // 10: llmgw.v1.StopShard
(*DrainShard)(nil), // 11: llmgw.v1.DrainShard
(*Ack)(nil), // 12: llmgw.v1.Ack
nil, // 13: llmgw.v1.Register.LabelsEntry
nil, // 14: llmgw.v1.Register.EngineVersionsEntry
nil, // 15: llmgw.v1.EngineProfile.EnvEntry
(*RunningShard)(nil), // 4: llmgw.v1.RunningShard
(*GPU)(nil), // 5: llmgw.v1.GPU
(*FabricAttachment)(nil), // 6: llmgw.v1.FabricAttachment
(*Heartbeat)(nil), // 7: llmgw.v1.Heartbeat
(*ShardStatus)(nil), // 8: llmgw.v1.ShardStatus
(*StartShard)(nil), // 9: llmgw.v1.StartShard
(*EngineProfile)(nil), // 10: llmgw.v1.EngineProfile
(*StopShard)(nil), // 11: llmgw.v1.StopShard
(*DrainShard)(nil), // 12: llmgw.v1.DrainShard
(*Ack)(nil), // 13: llmgw.v1.Ack
nil, // 14: llmgw.v1.Register.LabelsEntry
nil, // 15: llmgw.v1.Register.EngineVersionsEntry
nil, // 16: llmgw.v1.EngineProfile.EnvEntry
}
var file_llmgw_v1_agent_proto_depIdxs = []int32{
3, // 0: llmgw.v1.AgentMessage.register:type_name -> llmgw.v1.Register
6, // 1: llmgw.v1.AgentMessage.heartbeat:type_name -> llmgw.v1.Heartbeat
7, // 2: llmgw.v1.AgentMessage.shard:type_name -> llmgw.v1.ShardStatus
8, // 3: llmgw.v1.ControlMessage.start:type_name -> llmgw.v1.StartShard
10, // 4: llmgw.v1.ControlMessage.stop:type_name -> llmgw.v1.StopShard
11, // 5: llmgw.v1.ControlMessage.drain:type_name -> llmgw.v1.DrainShard
12, // 6: llmgw.v1.ControlMessage.ack:type_name -> llmgw.v1.Ack
13, // 7: llmgw.v1.Register.labels:type_name -> llmgw.v1.Register.LabelsEntry
4, // 8: llmgw.v1.Register.gpus:type_name -> llmgw.v1.GPU
5, // 9: llmgw.v1.Register.fabrics:type_name -> llmgw.v1.FabricAttachment
14, // 10: llmgw.v1.Register.engine_versions:type_name -> llmgw.v1.Register.EngineVersionsEntry
0, // 11: llmgw.v1.ShardStatus.state:type_name -> llmgw.v1.ShardStatus.State
9, // 12: llmgw.v1.StartShard.profile:type_name -> llmgw.v1.EngineProfile
15, // 13: llmgw.v1.EngineProfile.env:type_name -> llmgw.v1.EngineProfile.EnvEntry
1, // 14: llmgw.v1.AgentService.Connect:input_type -> llmgw.v1.AgentMessage
2, // 15: llmgw.v1.AgentService.Connect:output_type -> llmgw.v1.ControlMessage
15, // [15:16] is the sub-list for method output_type
14, // [14:15] is the sub-list for method input_type
14, // [14:14] is the sub-list for extension type_name
14, // [14:14] is the sub-list for extension extendee
0, // [0:14] is the sub-list for field type_name
7, // 1: llmgw.v1.AgentMessage.heartbeat:type_name -> llmgw.v1.Heartbeat
8, // 2: llmgw.v1.AgentMessage.shard:type_name -> llmgw.v1.ShardStatus
9, // 3: llmgw.v1.ControlMessage.start:type_name -> llmgw.v1.StartShard
11, // 4: llmgw.v1.ControlMessage.stop:type_name -> llmgw.v1.StopShard
12, // 5: llmgw.v1.ControlMessage.drain:type_name -> llmgw.v1.DrainShard
13, // 6: llmgw.v1.ControlMessage.ack:type_name -> llmgw.v1.Ack
14, // 7: llmgw.v1.Register.labels:type_name -> llmgw.v1.Register.LabelsEntry
5, // 8: llmgw.v1.Register.gpus:type_name -> llmgw.v1.GPU
6, // 9: llmgw.v1.Register.fabrics:type_name -> llmgw.v1.FabricAttachment
15, // 10: llmgw.v1.Register.engine_versions:type_name -> llmgw.v1.Register.EngineVersionsEntry
4, // 11: llmgw.v1.Register.running_shards:type_name -> llmgw.v1.RunningShard
0, // 12: llmgw.v1.RunningShard.state:type_name -> llmgw.v1.ShardStatus.State
0, // 13: llmgw.v1.ShardStatus.state:type_name -> llmgw.v1.ShardStatus.State
10, // 14: llmgw.v1.StartShard.profile:type_name -> llmgw.v1.EngineProfile
16, // 15: llmgw.v1.EngineProfile.env:type_name -> llmgw.v1.EngineProfile.EnvEntry
1, // 16: llmgw.v1.AgentService.Connect:input_type -> llmgw.v1.AgentMessage
2, // 17: llmgw.v1.AgentService.Connect:output_type -> llmgw.v1.ControlMessage
17, // [17:18] is the sub-list for method output_type
16, // [16:17] is the sub-list for method input_type
16, // [16:16] is the sub-list for extension type_name
16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
}
func init() { file_llmgw_v1_agent_proto_init() }
@@ -1406,7 +1622,7 @@ func file_llmgw_v1_agent_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_llmgw_v1_agent_proto_rawDesc), len(file_llmgw_v1_agent_proto_rawDesc)),
NumEnums: 1,
NumMessages: 15,
NumMessages: 16,
NumExtensions: 0,
NumServices: 1,
},
+42
View File
@@ -57,6 +57,43 @@ message Register {
// engine_versions decides which CLI flags and metric names apply; both drift
// between engine releases (plan §14).
map<string, string> engine_versions = 8;
// running_shards are the engines this agent is already supervising, including
// ones adopted from a previous agent.
//
// This is what lets a control plane restart recover instead of orphaning live
// engines. Without it the control plane forgets every replica, places new
// ones, and the old engines keep holding GPUs the inventory believes are free
// — so the new engines fail to allocate, with an error naming the wrong
// process (plan §6.5).
repeated RunningShard running_shards = 9;
}
// RunningShard describes an engine already running on a node.
//
// It carries enough for the control plane to rebuild the replica it belongs to,
// which is more than a shard id: the replica's identity, its pool and fabric,
// and the leader endpoint clients reach it through.
message RunningShard {
string replica_id = 1;
string shard_id = 2;
int32 rank = 3;
int32 nnodes = 4;
repeated int32 gpu_indices = 5;
repeated string hcas = 6;
int32 http_port = 7;
ShardStatus.State state = 8;
// model and profile name the catalog entry this shard was started from.
string model = 9;
string profile = 10;
// pool and fabric are echoed back from the StartShard that created it; the
// agent has no way to derive them.
string pool = 11;
string fabric = 12;
string leader_addr = 13;
int32 leader_port = 14;
}
message GPU {
@@ -142,6 +179,11 @@ message StartShard {
EngineProfile profile = 11;
int64 startup_timeout_ms = 12;
// pool and fabric are control plane concepts the agent cannot derive. They
// are sent so the agent can echo them back in RunningShard after a restart.
string pool = 13;
string fabric = 14;
}
message EngineProfile {