Tool runner: serve a node-scoped seat's verb also with no machine, in a queue group

A verb asked with no machine (the indexer's seed asks node-build-go's steps) is
answered by any one holder, on the tool and the caller-named subject.

Builds: lead answer A-393 (design 47 G)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-14 11:33:57 +01:00
parent 30027347e9
commit 9fa29ad801
3 changed files with 74 additions and 2 deletions
+24 -2
View File
@@ -787,7 +787,7 @@ func serveSeats(conn *bus.Conn, modules []string, current func() []registration,
// Its callers checked, then through the approval gate, before the bundle (design 47 G §610, A-179; design 46
// 7-approval-mark §20).
module, v := module, v
stop, err := conn.HandleSubjectCalled(v.Subject, func(caller string, body json.RawMessage) (any, error) {
handle := func(caller string, body json.RawMessage) (any, error) {
if err := admitted(v.Seat, v.Verb, caller); err != nil {
return nil, err
}
@@ -798,13 +798,26 @@ func serveSeats(conn *bus.Conn, modules []string, current func() []registration,
}
// A verb marked chunks: the bundle answers the whole file, the runner sends it in chunks (design 47 G A-257).
return conn.AnswerChunked(v.Seat, v.Verb, body, answer)
})
}
stop, err := conn.HandleSubjectCalled(v.Subject, handle)
if err != nil {
logf("[mesh-tools] cannot serve %s's %s on %s: %v", v.Seat, v.Verb, v.Subject, err)
continue
}
stops = append(stops, stop)
logf("[mesh-tools] serving %s's %s on %s, admitted where %s holds the seat", v.Seat, v.Verb, v.Subject, module)
// A verb of a node-scoped seat is also answered on the subject that names no machine, by any one holder, in
// one queue group per seat and verb (lead answer A-393).
if open, ok := anyHolderSubject(v, m.Node); ok && !have[open] {
have[open] = true
openStop, err := conn.HandleSubjectCalledQueue(open, "seat."+v.Seat+"."+v.Verb, handle)
if err != nil {
logf("[mesh-tools] cannot serve %s's %s on %s: %v", v.Seat, v.Verb, open, err)
continue
}
stops = append(stops, openStop)
logf("[mesh-tools] serving %s's %s on %s, in a queue group, for a call that names no machine", v.Seat, v.Verb, open)
}
}
}
}
@@ -821,6 +834,15 @@ func serveSeats(conn *bus.Conn, modules []string, current func() []registration,
}, serve
}
// anyHolderSubject is a node-scoped seat verb's subject without its machine, the one asked with no machine named; false
// where the verb's subject does not end in the machine (a seat held once).
func anyHolderSubject(v bus.SeatVerb, node string) (string, bool) {
if node == "" || !strings.HasSuffix(v.Subject, "."+v.Verb+"."+node) {
return "", false
}
return strings.TrimSuffix(v.Subject, "."+node), true
}
// consumers holds, per module the runtime serves, the one durable consumer its events arrive on and
// the children its events are handed to (novox/hq ADR 0198).
type consumers struct {