Skip to content

id(comms): P0-A core — shared abuse evaluator, token buckets, structured refusal, counter registry (phase of #2244) #3881

Closed

Description

@dezren39

Phase of #2244 (P0-A of #2032, per the #2033 design in PR #3834). Triage record: task 5839 on #2244 (CONFIRMED at origin/main 064ce9e).

Build the shared core the frame seam and adapters will consume — no behavior change to existing paths in this phase:

  • New shared module in pkgs/id (e.g. src/abuse.rs): typed subjects (endpoint EndpointId, connection), one AbusePolicy evaluator owning token buckets for frames and bytes.
  • Defaults from id: investigate: comms abuse controls — blocks, rate limits, and per-counterparty budgets #2032/id: design: abuse-control primitives v1 for ID comms #2033: authorized endpoint 60 frames/s burst 180 and 512 KiB/s burst 4 MiB; pre-authorization 10 frames/s burst 30; max 4 concurrent connections per peer; the endpoint bucket is shared across that peer's connections (more streams must not multiply allowance).
  • One structured refusal type: reason (rate_limited | budget_exhausted | blocked_by_operator | unauthorized) + retry_after_ms bounded 1 s floor / 60 s cap for temporary refusals, absent for permanent blocks. (Several local Refusal enums exist — event_store/ingest.rs:109, directory.rs:94 — none is this shared contract; do not add another local one.)
  • Counter registry: per-(local node, remote endpoint key) frame/byte counters with a snapshot API for the observability surface in the integration phase.

Acceptance:

  • Evaluator + structured refusal + counter registry land with unit tests: bucket drain/refill, burst, endpoint allowance shared across connections, refusal retry bounds, counter increments.
  • No existing path changes behavior in this phase.

Parent: #2244 · Design: #2033 (PR #3834) · Program: #2056

Activity

  1. added
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    queue/queuedHas a queued task in the Supabase agent queue
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed
    queue/queuedHas a queued task in the Supabase agent queue
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  3. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked

    State at park

  4. added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    queue/claimedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 1, 2026
  5. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    {"v":1,"kind":"picked_up","task":5845,"lane":"f","note":"Task 5845 picked up: implementing the P0-A core only — new shared abuse module in pkgs/id (typed subjects, one AbusePolicy evaluator owning frame+byte token buckets, structured refusal type, per-peer counter registry with snapshot API) plus unit tests. No wiring into frames/HTTP/world chat (Packet B), no existing limiter behavior changes. Branch queue/5845-3881-abuse-core in laptop worktree ~/git/fleet/5845; verification via CI on the PR per fleet policy."}

  6. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    {"v":1,"kind":"progress","task":5845,"lane":"f","note":"Correction to the pickup note: the P0-A implementation already exists — a prior lane pushed branch queue/5845-3881-abuse-core and opened PR #3891. No competing work will be created. This lane owns the remaining gate: PR #3891 has ONE unresolved Codex finding (P2, unbounded retained endpoint/counter state, abuse.rs). Fixing it in the existing worktree, then re-requesting Codex review; merge follows a clean round."}

  7. added 2 commits that reference this issue on Nov 1, 2026
  8. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    {"v":1,"kind":"done","task":5845,"lane":"f","note":"Task 5845 complete: PR #3891 MERGED (merge commit bc76a7e). The P0-A abuse core landed as built by the prior lane; this lane dispositioned the one outstanding Codex P2 finding (unbounded retained state) in commit 162b374 — prune_idle_endpoints evicts connection-less fully-refilled endpoint states (admission-equivalent to fresh), CounterRegistry gained last-seen stamps + prune() retention, with two new tests. Codex re-review of 162b374: no unresolved findings. Verification: cargo test -p id --lib abuse:: on the laptop — 10 passed, 0 failed. Side finding filed as #3923: workspace cargo test --lib is broken on main by id-core tests using vt100 without an id-core dependency (pre-existing, #3447 split leftover); the -p id run above is the current workaround."}

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

    app/idPackage/app: id (pkgs/ or apps/ in this repo)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions