Repository navigation
id-caps: reconcile the two #7916 policy points into mcp_policy - #13220
Conversation
Spike step 4 landed twice: mcp_policy (PR #13192, bridge-integrated PolicySession) and agent_policy (PR #13182, standalone PolicyPoint). Keep mcp_policy as the one policy point — it is the shape spike step 5 drives through the bridge — and port the standalone point's remaining pieces into it: - per-tool rate limits (design 6.3): RoleGrant.rate_limits, a sliding admitted-call window per tool, RefusedRateLimit audit outcome and RefusalKind::RateLimited; act() now takes the host time that drives the windows - the structured park event: PolicyRefusal.park_event is now a serializable ParkEvent (kind/reason/message/agent/world/at/spend/ budget) instead of the bare message string - owner summary refusals broken down by stable refusal code (AuditOutcome::refusal_code) Delete agent_policy.rs and its acceptance test file; the ported behaviors are covered by new mcp_policy unit tests (rate-limit window slide, park-event fields, summary breakdown). Deliberately not ported: delegation expiry (the #13202 union does not list it and RoleGrant carries no expiry) and the join-granted opening event (the bridge session's world.join call is the audited join here).
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 5 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 576950cd81
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #[test] | ||
| fn rate_limit_refuses_beyond_the_role_limit_and_the_window_slides() { |
There was a problem hiding this comment.
Add invariant-driven coverage for the ported rate limiter
The ported stateful rate limiter is covered only by a fixed two-call/60-second example, despite the repository testing doctrine requiring property tests for invariants and model-based tests where a specification exists. Add generated action/time sequences checked against a trailing-window reference model, covering expiration boundaries, independent tools, and the invariant that refused calls neither execute nor spend quota; name the model as the test oracle.
AGENTS.md reference: AGENTS.md:L37-L39
Useful? React with 👍 / 👎.
Reconciles the duplicate spike step-4 policy points (#7916 landed twice) to one, per #13202.
Survivor:
id_caps::mcp_policy::PolicySession— the bridge-integrated shape spike step 5 (#7917) drives. Deleted:agent_policy.rs(standalonePolicyPoint) and its acceptance test file.Ported from the deleted module so the survivor carries the union:
RoleGrant.rate_limits, sliding admitted-call window per tool,RefusedRateLimitaudit outcome,RefusalKind::RateLimited.act()now takes host time (now, unix seconds) to drive the windows and stamp the park event.PolicyRefusal.park_eventis now a serializableParkEvent(kind / reason / message / agent / world / at / quota spent / budget) instead of the bare message string.OwnerSummary.refusals_by_code, keyed by the newAuditOutcome::refusal_code().Not ported, deliberately: delegation expiry (not in #13202's union;
RoleGrantcarries no expiry) and the join-granted opening audit event (here the bridge session'sworld.joincall is the audited join).New unit tests cover the ported behaviors: rate limit refuses past the cap, is audited, charges nothing, and the window slides open again; park-event fields on quota refusal; summary breakdown by code.
Verification:
cargo test -p id-capsin the pkgs/id dev shell on the laptop (results in the closing comment on #13202). The remote dispatch route cannot runnix developtoday (#13159 family), so the laptop run is the verifying route; main-branch CI is the remaining gate per repo policy.Closes #13202.
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T11:10:58Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": null, "model": null, "lane_start_issues": [], "workspace_ref": null, "auth_subject": "archer", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.