fix(#1197): plumb hop-context to handleNodePaths resolveWithContext (GREEN)

routes.go:1428 (handleNodePaths) was the last production call site
still passing nil context to pm.resolveWithContext. handleNodePaths
aggregates paths that terminate at the queried node (lowerPK), so
seeding the resolver with [lowerPK] lets tier-1/2 hop-context
disambiguation light up for prefix collisions on the destination —
exactly the regression class #1197 targets.

Verified by extended call-site gate (resolve_context_callsites_test.go)
which now passes across all cmd/server/*.go.
This commit is contained in:
OpenClaw Bot
2026-05-15 14:02:10 +00:00
parent 59f7bd95f8
commit 0c7dd2237f
+7 -1
View File
@@ -1421,11 +1421,17 @@ func (s *Server) handleNodePaths(w http.ResponseWriter, r *http.Request) {
pathGroups := map[string]*pathAgg{}
totalTransmissions := 0
hopCache := make(map[string]*nodeInfo)
// Anchor the resolver with the node being queried so tier-1/2 hop-context
// resolution lights up when a hop prefix matches the destination node
// (handleNodePaths aggregates paths terminating at lowerPK). Passing nil
// here re-introduced regression #1197 in production. See
// resolve_context_callsites_test.go.
hopContext := []string{lowerPK}
resolveHop := func(hop string) *nodeInfo {
if cached, ok := hopCache[hop]; ok {
return cached
}
r, _, _ := pm.resolveWithContext(hop, nil, s.store.graph)
r, _, _ := pm.resolveWithContext(hop, hopContext, s.store.graph)
hopCache[hop] = r
return r
}