Claude/resume repos migration 9 o2 u1#31
Merged
Conversation
…bilities (Tasks #33 + #34) Closes P0 backlog items #33 and #34 in docs/handover/COORD-MCP-TODO.md. Version bumped to 0.7.0 (cartridge.json + cartridge.ncl + boj_cartridge_version). Task #33 — client_kind extension + free-form variant label - ClientKind enum: added openai (4) + mistral (5) in Zig FFI and Idris ABI (SafeLocalCoord.idr); KIND_COUNT bumped 4 → 6 for reject-ring. - Peer struct gains `variant: [32]u8 + variant_len` (alphanumeric + `.`/`-`/`_` only). New FFI: coord_set_variant(token, variant) coord_read_peer_variant(peer_idx, out, cap) - Adapter `coord_register` accepts optional `variant` and `capabilities` blocks — invalid values roll back the register so the caller sees a clean 400. `coord_list_peers` output now includes a `variant` field. - Durable log: peer_variant_set = 15 (new event type), with logPeerVariantSet + decodePeerVariantSet and replay-dispatch wiring so slot reuse after crash reconstructs variant correctly. Task #34 — capability advertisement for cold-start routing - Per-peer storage: class_csv (≤128B), tier (0=unset, 1..5), and prover_strengths CSV (≤256B). CSV alphabets restricted to [A-Za-z0-9._-+/,] so later JSON rendering stays injection-safe. - New FFI: coord_set_capabilities(token, class, tier, provers) coord_read_peer_class / _tier / _provers - Adapter tools (cartridge.ncl + cartridge.json): coord_set_variant — post-register update coord_set_capabilities — post-register update coord_get_peer_capabilities — returns {peer_id, kind, variant, tier, class[], prover_strengths[]} using the server-rebuilt canonical peer_id rather than echoing client input. - Durable log: peer_capabilities_set = 16 with matching encode + decode + replay-dispatch. Tests - Extended `default role derives from client_kind` to cover openai / mistral → apprentice. - New `set and read peer variant (Task #33)` — round-trip, rejection of invalid chars, slot-reuse clears variant. - New `set and read peer capabilities (Task #34)` — round-trip, tier out-of-range rejection retains prior value, bad CSV char (`"`) rejected. Notes - Build + e2e verification deferred: Zig is not on PATH in this environment. Pattern for every new code path mirrors established idioms in the same file (@memcpy slices, std.io.fixedBufferStream, std.mem.splitScalar, std.mem.writeInt with `buf[p_off..][0..2]`). - cartridge.json was hand-synchronised; note the pre-existing drift from cartridge.ncl (extra tools from Tasks #13..#15, #32, #35 live in .json only). Regenerating from Nickel would currently delete them; kept surgical until Nickel toolchain is available. - D3 in TODO says `just cartridge-install` in 007-lang is gated on these tasks shipping — that unblock now applies. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
From P1 in docs/handover/COORD-MCP-TODO.md. Single read-only tool that
returns a coord-wide snapshot so operators can monitor health without
walking every existing export individually.
Version → 0.8.0 (cartridge.json + cartridge.ncl + boj_cartridge_version).
FFI additions (all require a valid session token, -1 on bad token):
coord_count_quarantine — active quarantine entries
coord_count_claims — active task claims
coord_count_track — track-record ring fill
coord_count_rejects_recent(k) — rejects in the 10-min window for kind k
coord_kind_in_cooldown(k) — 1 if kind k is in reject-cooldown
Adapter:
coord_health {token} → {
peers: { active, max, by_kind, by_role },
quarantine: { pending, max },
claims: { active, max },
track: { entries, max },
rejects: { window_ms, cooldown_ms, recent_by_kind, in_cooldown: [...] }
}
Validates caller token via coord_count_rejects_recent(kind=0); first -1
short-circuits to 401. Per-peer breakdown walks the 16 slots directly
using the existing coord_read_peer_kind / _role exports.
Tests:
`coord_health counts basics` — bad token → -1, valid token with one
active claim reflects count, unseen kind has zero rejects, out-of-range
kind returns -2.
Non-goals for this pass:
- No historical / time-series data (spill to VeriSimDB is a separate
P1 item).
- No rate-limiting on the poll — loopback only, all callers are trusted
session peers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
Closes the last self-assessment layer. From P1 in docs/handover/COORD-MCP-TODO.md, unblocks DD-9 in COORD-MCP-STATE.md. Drift detector -------------- The TODO criterion (`avg_confidence > 0.8 AND effective_affinity < 0.3`) mechanically matches the existing overclaim heuristic, but the *intent* is different: overclaim is a routing FYI, drift is a self-assessment monitoring flag. They warrant distinct envelopes so the master sees both signals without one drowning out the other. `coord_scan_suggestions` now emits, on the same condition: - existing `kind:"overclaim"` — op_kind=fyi, risk_tier=1 (routing) - new `kind:"drift"` — op_kind=warn, risk_tier=2 (monitoring) The drift envelope additionally carries `drift_pct = avg_conf − pct` so the master sees the magnitude of the gap at a glance. kind_str fix ------------ Latent bug from Task #33: the engine-side `switch (agg.client_kind)` in coord_scan_suggestions still mapped only kinds 0..2, falling through to "custom" for openai/mistral peers. Extracted into a shared `kindStr` helper that mirrors the adapter's `kindName` and now includes the new kinds (4=openai, 5=mistral). All four suggestion emit branches use it. Tests ----- - Updated `scan flags overclaim` to also assert that a `kind:"drift"` envelope is emitted from the same condition, with `op_kind:"warn"`, risk_tier=2, and a `drift_pct` field. - New `drift uses Task #33 kind names (openai)` — drift envelope from an openai peer now reports `client_kind:"openai"` rather than the fallback "custom". Docs ---- - COORD-MCP-TODO.md: drift detector + coord_health crossed off in P1. - COORD-MCP-STATE.md: DD-9 layer D moved from "pending P1" to "done" with implementation summary. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> https://claude.ai/code/session_01DobLJY3jgoso4M3z7xcZi8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
RSR Quality Checklist
Required
just testor equivalent)just fmtor equivalent)unsafeblocks without// SAFETY:commentsbelieve_me,unsafeCoerce,Obj.magic,Admitted,sorry).envfiles includedAs Applicable
.machine_readable/STATE.a2mlupdated (if project state changed).machine_readable/ECOSYSTEM.a2mlupdated (if integrations changed).machine_readable/META.a2mlupdated (if architectural decisions changed)TOPOLOGY.mdupdated (if architecture changed)CHANGELOGor release notes updatedsrc/abi/andffi/zig/consistent)Testing
Screenshots