Skip to content

refactor: one request policy for remote surfaces, and write routes for skill index/approve #1748

Closed

Description

@ajianaz

What

Findings from the end-to-end check of #1730 and #1731 with the real ONNX embedder, and from reading how the CLI, uteke serve and uteke-mcp reach the same core. Findings only; no design is decided here.

1. The policy in front of the core has no single home

The core is shared: reads go to Uteke::skill_* / doc_* from the CLI directly, and from HTTP and MCP through Uteke::skill_remote (validation, bounds). The policy in front of it is spread out:

  • Size limits live in skill_remote and doc_similarity_query; the CLI has its own.
  • The embedding gate (remote_guard::EmbedGate) first lived inside Uteke and could never refuse over HTTP, because uteke serve locks the whole Uteke per request (found with the real model: 20 parallel 30000-character drafts all answered 200, the slowest after 247 s). fix(server): take the remote embedding slot before the store lock #1747 moved the slot to the router, so now there are two gates: the router's for HTTP and the Uteke one for MCP.
  • Token scope (read-only or read-write) is decided in the server registry and in the MCP read-only set, separately.

A new remote route has to repeat all three. Candidate: one "remote request policy" module (size bounds, embedding slot, token scope) used by the server router and by MCP.

2. A permitted draft still embeds under the store lock

/doc/similar and /skill/similar with a text (max 32768 characters), and semantic search, embed the client string while the store lock is held. Two max-size drafts block every other request for about 20 s (10 to 12 s each, debug build, real model). Embedding first, outside the lock, and locking only to read neighbours would remove it.

3. skill index, approve, record, lint exist only in the CLI

Reads are available over HTTP and MCP; the write side is not. A client that talks only HTTP (tole's stated way of using the library) can read but cannot register a skill or approve a hash. The logic is already central (skill_index, skill_approve), so a route is a thin adapter; what has to be decided is the policy:

  • a read-write token required, and approve as the trust anchor never reachable with a read-only token;
  • what index means remotely (a directory on the server, not on the caller's machine), and its bounds;
  • the ledger actor for a remote caller.

4. Not covered by the embedding gate

/doc/search with a semantic query and the memory recall routes also embed a client string and take the store lock, without the slot or the 32768 cap.

Why

Each gap above was found by running the real binary and model, not by tests with the marker embedder: the unit tests for the guard passed while the guard could not trigger over HTTP.

Decisions (2026-11-13, owner delegated: follow the architecture review where it covers a finding, otherwise best judgment)

  1. Policy home: follow the review, candidate 4. Tracked in refactor(server): the core answers "does this request embed?", one embedding gate #1753 (the core answers "does this request embed?", one gate shared by HTTP and MCP).
  2. Embedding outside the store lock: not done. The review rates replacing the server's store lock a design change, not a deepening, and the comment in route records the lock as deliberate. The cost stays bounded by the slot and the 32768-character cap (two max-size drafts can still block other requests for about 20 s; documented, revisit only with evidence from real use).
  3. Remote index, approve, record, lint: not added; they stay CLI-only. The review does not cover this, so by judgment: index would take a path on the server from a remote caller (a file-read surface with no counterpart need), and approve is the trust anchor, which tole itself keeps out of band (its approvals live in the owner's data directory, written only by tole skills approve); a remote approve adds attack surface for little gain, and tole can call the CLI. Reopen if a concrete client needs it, with the policy listed above.
  4. Not covered by the gate: handled in refactor(server): the core answers "does this request embed?", one embedding gate #1753 for /doc/search (if the route is LAB). The memory recall routes are CORE; adding a new 429 there would change the CORE contract, so they are left as they are and the reason is written down.

Other candidates from the review: #1750 (CLI recall through run_recall), #1751 (one update execution), #1752 (error class to wire mapping), #1754 (open-and-configure), #1755 (MCP tool declaration), #1756 (widen policy), #1757 (skill depth re-evaluation), #1758 (index_sync audit).

Refs #1730 #1731

Activity

  1. added
    scope:core
    type:task
    on Nov 12, 2026
  2. ajianaz commented on Nov 13, 2026

    @ajianaz
    CollaboratorAuthor

    All four findings are dispositioned in the Decisions section: 1 and 4 go to #1753 (PR #1764 open), 2 and 3 were decided not to be done, with the reasons recorded. #1747 landed the slot-before-lock fix. Reopen if a concrete client needs remote index/approve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority:mediumscope:coretype:task

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions