feat(pi-ext-gate): @agentic-kit/pi-ext-gate — policy + remote approvals for pi tool calls - #1727
Merged
Conversation
…ith pi entries stored verbatim
A pi extension that drains pi's append-only session into an @agentic-kit/run-log store — verbatim, in order, same code locally and in the cloud (only runId and the store differ). Draining is index-based because the session is append-only; the read position is keyed to the session header id so a switch/fork re-mirrors and the store's idempotency absorbs the duplicates. A drain advances only after a successful append, and store failures are rethrown into pi's dispatch by default rather than silently dropping entries.
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Package 5 of the additive
@agentic-kit/*series (planning issue #1657): what makes an unattended cloud run safe to start. Tool calls are gated by a declared policy (data, not code paths), and anything the policy won't decide alone is deferred to an approval channel that reaches a human on another machine over the platform's existing rows/API — no socket back into the cluster.The mechanism is small because pi's
tool_callhandler can await:Decisions worth reading the code for:
ask, notallow. A tool nobody declared isn't implicitly trusted, and denying it outright would strand the run. First matching rule wins, and a rule can narrow on arguments (match: ({ input }) => /\brm\b/.test(String(input.command))).askwith noapprovalschannel throws at construction, not on the first sensitive tool call.pollingApprovalChannelis the DB-rendezvous baseline (submita row,pollfor the decision); if nobody decides withintimeoutMsthe answer isdeny— an unattended run must not act unapproved just because nobody was watching.onTimeout: 'allow'opts out.submit/pollerrors propagate and the tool call fails rather than degrading into a silent allow.staticApprovalChannel({ decision: 'allow' })exists so "approve everything" has to be written down.onDecisionemits every settled decision (policy verdict, final decision, deciding actor, timestamp) — the record the run log / audit trail stores. The blockreasonis the model's only explanation for a refusal, so policy reasons are written for the model to read.Nothing here touches the network or a model: the policy is pure, the channel takes an injected clock/sleep, and the extension is driven through a fake
ExtensionAPI(21 tests). Registered in theagenticCI shard.This branch is stacked on #1723 → #1724 → #1725 → #1726, so its diff against
maincarries those packages until they merge.Link to Devin session: https://app.devin.ai/sessions/450ce6d6659c47759c184ae6ec19a2a8
Requested by: @pyramation