protocol: handshake, capabilities as placement, eval frontend generation (SPEC §7.1) #15
Loading…
Reference in a new issue
No description provided.
Delete branch "lu/protocol-handshake"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
docs/live-upgrades.md §4.4 (version skew) and the
Hello.leases/ immediateLeaseAckpart of §4.1.Hello(NodeAd) gainsproto(absent = 0, legacy),build,caps, andleases(instances the agent runs right now).kb_core::build()readsKB_BUILDat runtime (fallbackCARGO_PKG_VERSION); the flake's newdeployedderivation wraps the unchanged cargobuildwith--set-default KB_BUILD <version>+<rev>, so only that trivial wrapper changes per commit and.#ci.*stays cached. Packages and the NixOS module default usedeployed.Welcome { proto, build }(not sent to legacy agents, who would only log it as undecodable) and an immediateLeaseAckfrom the Hello's leases, via the samerenew_leasesthe heartbeat uses.MIN_AGENT_PROTO..=PROTOplus legacy 0; anything else is refused with close 1008 and a reason naming what to upgrade, shown on/api/nodes,/ui/nodesandkb nodes(which also show build/proto/caps).kb_core::caps:required_caps(&TaskDef, &SchedMeta)matches exhaustively on the whole vocabulary (all baseline today), plusresolved_ref()caps checked at dispatch; the matchmaker enforces caps as constraints and the queue page explains "agent lacks capability 'x'". Rule in kb-core docs and SPEC §7.1: the wire format grows only by fields an older peer ignores or by cap-gated variants.KB_EVAL_FRONTEND=1 exec kb-eval-nix --flake ".#<attr>"; eval jobs requireeval-nix:1; nix agents advertise it; kb-eval-nix refuses a generation other than its own. An env var, not a flag, because today's clap CLI would reject an unknown flag — so legacy agents can safely be treated aseval-nix:1. One-time eval cache miss (script text changed), nokbN-bump.Compatibility
{eval-nix:1}; no Welcome; immediate LeaseAck; new eval script works (env var ignored); newconstraints.capsignoredTests
kb-core serde compat both directions, admission range,
required_caps,has_cap; kb-agent Hello carries leases/proto/build, close reason surfaced; kb-control-planerequired_caps_constrain_placement, newtests/handshake.rs(reconnect → Welcome + immediate ack; legacy admitted and runs eval; future proto refused and shown; cap-gated task waits for a capable agent); kb-eval-nix generation check; kb-cli golden eval hash updated.🤖 Generated with Claude Code
Version skew becomes explicit and safe for the mixed CP/agent versions a staggered nuxbox/ares upgrade produces (docs/live-upgrades.md §4.4, and the `Hello.leases` part of §4.1). - `Hello` carries `proto` (absent = 0, legacy), `build` (`kb_core::BUILD`: `<version>+<rev>` from the flake, else the crate version), `caps`, and `leases`, the instances the agent is running. All additive: today's control plane ignores them. - The control plane answers every admitted Hello with `Welcome { proto, build }` (not sent to legacy agents, which could only log it as undecodable) and an immediate `LeaseAck` that renews the claimed leases exactly as a heartbeat does. It admits proto cp-1..=cp plus legacy 0 and refuses others with a 1008 close naming what to upgrade; refusals are logged and shown on /ui/nodes, /api/nodes and `kb nodes`, which also gain the agent build, proto and caps. - `kb_core::caps::required_caps(def, sched)`: an exhaustive map from every payload/input/isolation/effect/resolved-ref kind and SchedMeta enum value to a cap, empty for everything at proto 1, plus `constraints.caps`. The matchmaker requires them (legacy agents have exactly the frozen legacy set) and checks resolved refs against the chosen node. The skew rule is written into kb-core's docs and SPEC. - The bootstrap eval script is `KB_EVAL_FRONTEND=1 exec kb-eval-nix ...`: the frontend generation is identity (every eval's def_hash changes once; no kbN- bump), the eval requires `eval-nix:1`, agents with the nix feature advertise it, and kb-eval-nix (and `kb` as kb-eval-nix) refuses another generation. An environment variable rather than a flag, because today's frontend ignores it where it would reject an unknown flag - so a legacy agent is safely treated as having `eval-nix:1`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>@krisbuild r+
Removed from the merge queue: head graph failed.
@krisbuild r+
@krisbuild r-
@krisbuild r+
The pull request head's own build failed (graph 602).
nix/build: exit-code on nuxbox, exit 1 — lognix/clippy: exit-code on nuxbox, exit 1 — logPush a fix, or comment
@krisbuild retryto rerun the failed tasks and requeue.Removed from the merge queue: the pull-request head changed.
@krisbuild r+
Removed from the merge queue: the merge conflicts in SPEC.md, crates/kb-agent/src/conn.rs, crates/kb-control-plane/src/http.rs, crates/kb-control-plane/src/scheduler/matchmaking.rs, crates/kb-control-plane/src/ui/mod.rs, crates/kb-control-plane/tests/it/common/mod.rs.
@krisbuild r+
The pull request head's own build failed (graph 653).
nix/test: exit-code on nuxbox, exit 1 — logPush a fix, or comment
@krisbuild retryto rerun the failed tasks and requeue.@krisbuild r+
Merged as
264d8228b6.