Skip to content

feat(cp): scale hardening — indexed sweeps, sharded admission, borrowed lookup keys #1473

Closed as not planned

Description

@chaodu-agent

Description

Three scale-dependent ceilings recorded during #1469 round-4 review (F8/F9/F10), all documented v1 tradeoffs rather than defects:

  1. Sweeper failure paths are O(expired x in-flight) (router.rs fail_instance/sweep_deadlines): each expired handle rescans the full in-flight table under the global mutex. During mass-expiry events (network partition, CP failover) this blocks complete/cancel on the same lock. Fix: maintain a deadline-ordered index plus a handle -> delegation keys index alongside the primary map.

  2. One global admission mutex serializes all namespaces (router.rs delegate): the critical section spans registry scan/sort and serialization of prompts up to 256 KiB. Fix: shard admission by namespace; move serialization/frame construction outside the lock with a rollback path.

  3. Per-lookup key allocation (DelegationKey::new): every contains_key/get/parent lookup clones two Strings inside the admission lock. Fix: Borrow-based borrowed-key wrapper for reads.

All three should land with a load regression test.

Use Case

A CP instance serving multiple namespaces with hundreds of concurrent delegations (fleet-wide deployment) must not let one namespace's mass-expiry or large prompts stall every other namespace's admission and completion paths.

Activity

  1. github-actions commented on Aug 28, 2026

    @github-actions

    This issue has been open for more than 14 days with no linked pull request, so it is being closed as not planned.

    If this is still needed, please open a new issue with updated context and reference this closed issue instead of reopening it. A linked PR is the strongest signal that the work matters.

  2. added
    auto-closed-staleClosed by stale automation; reopening grants a permanent exemption
    and removed
    stale-close-pendingStale-close transaction in progress; recovered on next run if interrupted
    on Aug 28, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions