Repository navigation
feat(cp): add primary delegation MCP tools and CLI - #1529
Conversation
This comment has been minimized.
This comment has been minimized.
|
Important CHANGES REQUESTED What This PR DoesCompletes Agent Control Plane v1 by adding the primary-side initiating surface: a primary OpenAB runtime can discover peers and delegate work through four typed MCP tools ( How It Works
Resolution of Previous-Round FindingsAll eight items raised on the prior head are addressed in
Findings (This Round)
Finding Details🟡 F1: Terminal-history eviction comment and out-of-order edge
Impact is bounded: parked awaiters are notified before Suggested change: correct the comment to describe admission-order eviction, or make eviction skip the just-terminated key / evict by completion order, and add an out-of-order-completion regression test (the current byte-bound test inserts terminals in admission order only). 🟢 F2: Prior findings fully resolvedEach of the eight previous-round items is fixed at this head with a matching regression test, verified against the diff of the fix commit. The socket-directory hardening (asymmetric verify-vs-create with symlink/uid/mode guards) and the ack-id validation are particularly solid. 🟢 F3: Unified enforcement pathThe closure-based Baseline Check
Verification Notes
5. Three Reasons We Might Not Need This PR
|
|
Important CHANGES REQUESTED What This PR DoesAdds the primary-side (initiating) half of the Agent Control Plane: four typed MCP tools ( How It WorksA JSON-lines UDS ( Findings
Finding Details🟡 F1: O(n^2) terminal-history eviction near capacity
🟡 F2: Self-evicted huge terminal is silently unqueryableIn 🟡 F3: Direct-tool name resolution is ctx-relative
🟡 F4: Audit hash can collapse on serialization failure
🟢 F5-F8: What's done wellStrong UDS threat model (TOCTOU-safe unlink, no chmod of foreign dirs, bounded framing), airtight Baseline Check
Accepted Residual Risk (not counted as a finding)The handle registry bounds at 4096 cumulative minted tokens with oldest-first eviction (not live-count). After more than 4096 sequential spawns a still-live delegation's token can age out, after which 5. Three Reasons We Might Not Need This PR
Each is answerable (primaries are the point of the ADR; the CLI serves operators/hooks while tools serve agents; the deployment target is Unix containers), which sharpens rather than weakens the case for the PR. |
thepagent
left a comment
There was a problem hiding this comment.
Final regression review — approved
Reviewed final head a2bd011909989d1c491437a1e4fd6c05a5dafc54 under the frozen review contract and three-stage stopping rule.
- The round-2 terminal-order finding is resolved with completion-ordered eviction and an out-of-order regression test.
- macmini validation passed: 97 focused control-plane tests, strict
openab-coreclippy, and the complete 834-test core suite plus 11 real-CP integrations. - Independent Sol and Fable final-regression audits both returned
PASS.
The round-3 automation explicitly reports no correctness or auth defects and labels its remaining items non-blocking hardening/clarity nits. They are classified as post-freeze SCOPE EXPANSION, not regressions or Late Blockers:
- O(n²) worst-case eviction scan: bounded to the 4096-entry history and correctness-preserving; performance hardening only.
- A >16 MiB single terminal self-eviction: unreachable through the current sub-1-MiB transport/result caps and already covered by bounded-history residual-risk semantics.
- Context-relative collision-policy wording: harmless with the single shipped session-gated provider; documentation clarification only.
- Audit-hash serialization fallback: the reviewer confirms the failure path is not reachable for a freshly parsed JSON map; no present security defect.
No additional review round is authorized. The review contract is satisfied and this head is approved.
- Cargo.lock: #1529 added the `reqwest013` dev-dependency to the root crate but the lockfile's `openab` block was never regenerated, so `cargo check --workspace --all-features --locked` failed and any plain `cargo check` rewrote the lock. Regenerated; `--locked` now passes. - main.rs: `report_facade_status` was keyed on `cfg.mcp.is_some()`, so a headless control-plane primary without `[mcp]` logged "unconfigured — nothing was started" while the automatic loopback facade on 127.0.0.1:8848 was in fact serving. Key it on `facade_serving`, the same bool that decides whether the listener is spawned. Self-review round 3 findings F1/F2 on #1528.
Summary
Complete Agent Control Plane v1 with the primary-side initiating surface defined in ADR section 6:
cp/delegate, result tracking, cancel, andcp/list_agentsspawn_agent,check_delegation,list_agents,cancel_delegationopenab agent spawn|list|status|cancelStacked on recovery PR #1528 because the original #1471 merge landed into an obsolete stacked base rather than
main.Discord Discussion URL: https://discord.com/channels/1491295327620169908/1491365158868619404/1532377620241449040
Review Contract
Goal
A primary OpenAB agent can discover peers and delegate work directly through four typed MCP tools, while operators/hooks can perform the same operations with
openab agent. Both frontends use one owner-only local API; neither the agent nor CLI receives CP credentials or addresses.Non-goals
cp/attach), session streaming, or lobby UI.Accepted Residual Risks
unknown handle; live CP work is not cancelled by eviction.spawn_agentwaits until the requested deadline plus a five-second local response margin. Async mode is the escape hatch for long work.[mcp]is absent. A bind conflict is fatal and visible rather than silently removing the agent's delegation tools.Acceptance Criteria
(delegation_id, admission).check_delegationis nonblocking and reports pending/running/terminal state.Follow-ups
openab-cpimage, release workflow, and single-replica canary deployment.cp/attachhuman relay and session streaming.Review Remediation
All actionable round-1, Sol/Fable, and final-regression findings are resolved in commits
027a7689b57bc1806bc0049b7e0060ad2ba2cf73anda2bd011909989d1c491437a1e4fd6c05a5dafc54:$HOME/.openab/run, stale entries are removed only when they are current-user Unix sockets, and all local lines are strictly bounded while preserving pipelined requests.InvalidRequestlocally without dropping the CP connection; a real-CP integration test immediately lists agents over the still-live connection.deadline + 5soperation bound; deadlines outside1..=1800are rejected consistently.tools/list/tools/callbehavior.Architecture
The handle returned to local callers is random and opaque. The runtime alone maps it to the protocol
(delegation_id, admission)pair, so delayed checks/cancels cannot target a same-id re-admission.Verification
macmini exact-content matrix:
--all-features: passed--no-default-features: passedopenab-core,openab-mcp, root): passed with-D warningsopenab-cp: 142 unit + 9 integration passedopenab-mcp: 245 passedopenab-core: 834 unit + 11 real-CP integration passed (one known unrelated macOS secret test intentionally skipped)PASS/PASS