Skip to content

feat(acp): onboard Pi as an enforced ACP backend via a gate extension - #10334

Merged
bolichen97 merged 1 commit into
mainfrom
feat/acp-backend-pi
Sep 14, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
feat/acp-backend-pi

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

You cannot pick Pi in Kiro Crew today. Pi drives a local Ollama model from one
models.json entry, so selecting it lets a session run entirely on the user's own
machine. It is also the second harness through the auth seam from #9616 and the first
one with a different shape: two components instead of one, and no permission gate of
its own at all.

That last part is the whole problem. pi runs every tool call without asking, by
design. pi-acp sends session/request_permission only when an extension inside pi
raises a confirm dialog. The prior research in #6307 recorded Pi as asking per tool
call; on the wire it does not, and the same command runs unasked. A backend offered in
that state would show a gate that gates nothing.

Why it matters

A user who wants a local model gets one, with the same checks every other backend gets.
Every Pi tool call now reaches HookManager.on_tool_call with its real name and
arguments, or it does not run.

And the seam gets its second measurement, on a harness whose answer to "how is it made
to ask" was "it cannot be, unless we put the gate there ourselves". That measurement is
below, and the number went up.

What changed (motivation → approach → change)

Pi has nothing to seed, so Kiro Crew loads its own gate into it. A small pi extension
ships as package data (agent_sdk/gate_extensions/pi/kiro_crew_tool_gate.ts). It
intercepts every tool_call event and raises pi's confirm dialog with the tool call
written into the message as a JSON envelope; pi-acp forwards that dialog as
session/request_permission, and the call blocks until the client answers. A launcher
in the sandbox run directory execs the resolved pi with --extension <that file>, and
the adapter is told to run the launcher in place of pi through its own
PI_ACP_PI_COMMAND. Nothing is written into the work dir or the operator's pi
directory.

That is verified, not declared. The file the launcher names is a sealed copy: the
packaged bytes are checked against a digest pinned in the driver at every spawn and
written read-only into the sandbox run directory, so a package file an agent rewrote on
a source install is refused before any child starts. Before the first prompt the session
runs the launcher with the adapter's own arguments, asks pi's command registry
(get_commands), and requires the extension's probe command to be present AND sourced
from that copy. An operator extension registering the same name, or the same bytes under
another path, is refused; the probe's source path and the sealed copy are compared as
the same FILE (realpath, case-normalized on both sides), since pi reports the path in its
own spelling. The run directory is a precondition, not a preference: sandbox._ensure_run_dir
falls back to the system temp directory when <config_dir>/run cannot be made — a
fallback that predates this PR and that every sandbox launcher tolerates as a liveness
matter — but this PR is the first to place a SECURITY artifact there, and a gate copy in a
shared directory can be re-chmodded and rewritten by any same-UID process between the
seal and the exec. So the pi spawn requires both artifacts to live under the real run
directory and refuses the session otherwise (_pi_gate_run_dir), mirroring the posture
the sandbox floor takes when the credential mask cannot be applied; the shared helper is
not changed. And it is guarded in band after that: every call the extension asks about
leaves its toolCallId in the envelope — recorded on every reader that answers a
permission frame, the auto-approve path included — so a tool_call_update reaching
completed for an id the gate never asked about kills the harness and fails the turn
(_tripwire_pi_gate) — an adapter release that stops honouring PI_ACP_PI_COMMAND or
stops forwarding dialogs costs one tool call, never a silent session. The run-directory
sweep reclaims the gate artifacts of a dead gateway by owner PID (never by age: they are
written once per gateway process and reused). This is a new Routing.VERIFIED_GATE_EXTENSION: neither existing member
describes a harness with no setting to read back. On the client side the dispatch
parser reads the envelope out of the permission frame, so the gate judges bash with
its command rather than a dialog titled "confirm". It does so only for a session running
the extension and only under a per-session nonce the extension echoes, because on every
harness a permission frame's rawInput is the model's own tool arguments. A shell command
and a document body (write's content, edit's two halves) are forwarded WHOLE — the
deny rules read the command's text, and the host skips body keys in its command-line scan
only while the arguments are intact — while any other oversize string value is bounded with
path intact and the call marked untrusted; only an envelope over 200k chars is refused.

Two things this harness cannot do are recorded as facts, not gaps to paper over. Pi
accepts the session/new MCP array and never forwards it to the agent, so it stays
outside ACP_BACKENDS_SESSION_MCP_ARRAY and its projection is a no-channel entry with
that reason. And a bash result carries no stdout text on this adapter; the model sees
the output, the transcript pill shows the call and its exit code.

The measurement

Round 4 (#10006) touched 36 files: 33 onboarding, 3 seam-gap fixes. The pre-seam
baseline was 38. This PR touches 42 (39 at the first push; review rounds added
sandbox.py, test_sandbox_argv.py, .gitattributes and the standalone fence, and
removed test_deny_diff.py when the AST parser came back out). It does not go down, and the table says why: a
harness with no gate of its own pays for the mechanism that gates it, and this repo
keeps its ratchets as hard-coded literals in tests.

File Checklist item that forced it Would a third provider touch it again?
agent_sdk/backends.py 1 — id, known set, baseline, policy id, registry namespace, in-or-out for all 16 sets, the new Routing member, the probe-command table yes (vocabulary)
acp_backends.py 1 — re-export shim the parity gate reads through yes
acp/types.py 2 — PROVIDER_LABEL_PI + id re-export yes
providers/acp.py 2 — label branch + identity predicate yes
agent_sdk/tool_gate.py 1 — enforce the new mechanism: ENFORCED_ROUTINGS, verdict, remedy, gate_extension_issue, label only if it brings a NEW routing mechanism
acp_tool_gate.py 1 — re-export shim yes
acp/client.py 3 — two resolvers, the sealed digest-verified copy, the launcher, the read-back, the in-band tripwire, the arm, the handshake row, env, two labels yes
acp/_dispatch.py 3 — the gate envelope decode no — built once for every gate-extension harness
agent_sdk/gate_extensions/pi/kiro_crew_tool_gate.ts 3 — the gate itself (NEW) only a harness with no gate of its own
setup.cfg, MANIFEST.in 3 — ship the extension as package data no — the glob covers the next one
fixtures/acp_frames/pi/* (3 .jsonl + 3 .expected.json + README) 4 — live corpus yes (7 files)
fixtures/acp_frames/README.md 4 — provenance table yes
test/acp_frame_replay_harness.py, test/test_acp_frame_replay.py, scripts/update_acp_frame_snapshots.py 4 — replay hands the fixture's nonce to the parser no — built once
docs/.../agent-host-contract.md 5 — a column in all nine buckets + meaning row. Auth file 2 of 2 yes
docs/.../harness-onboarding.md 5 — the worked example yes
agent_sdk/backend_install.py 6 — two-component probe yes
agent_sdk/drivers/acp.py 6 — the three driver seams the probe calls yes
agent_sdk/host_auth.py the auth seam — auth file 1 of 2 yes (one literal)
providers/mirrors/registry.py 8 — the no-channel projection yes
scripts/deny_diff.py the auth seam's hand-kept scrub list (seam gap 1) yes (one literal)
test/test_acp_pi_backend.py 3 + 9 (NEW) yes (its own file)
test/test_acp_tool_gate.py 9 — enforced-set literal only with a new mechanism
test/test_acp_backend_kas.py 9 — the one-identity-predicate ratchet yes
test/test_agent_backend_editable.py 7 — baseline literal yes
test/test_agent_sdk_capabilities.py 7 — known-set literal yes
test/test_acp_capability_sets_leaf.py 9 — pinned memberships yes
test/test_harness_parity.py 7 — label map + selectable-and-answerable pairing yes
test/test_agent_sdk_backend_install.py 6 — probe coverage + pinned row order yes
test/test_spawn_audit.py 3 — the read-back's BENIGN_SPAWNS entry yes, if it spawns a read-back
sandbox.py, test/test_sandbox_argv.py 3 — the run-dir sweep learns the gate-artifact family no — built once
.gitattributes 3 — LF pin so the digest survives a Windows checkout no — the glob covers the next one
apps/builtins/aws_control/crew/packaging/build.py the auth seam's one hand-kept mirror (seam gap 4) — auth file 3 of 3 yes (one literal)

Totals. Files this PR touches: 42. Files a third provider touches again, minus
what was built once (_dispatch.py, setup.cfg, MANIFEST.in, the three
replay-harness files, sandbox.py, test_sandbox_argv.py, .gitattributes = 9), minus
what only a new routing mechanism costs (tool_gate.py, test_acp_tool_gate.py, the
.ts = 3): 30. Against OpenCode's 33 (36 minus its 3 seam gaps) and the pre-seam
38, the clean read is 30, of which 7 are the fixture files, 9 are test literals and 2
are hand-kept credential lists the seam cannot reach (deny_diff.py, the standalone
fence). The vocabulary and its ratchets are the floor; the seam did not
move that floor, it moved the auth cost to one literal and one doc column — plus, found
by running the whole suite rather than the ACP tests, one more literal below.

Auth-specific files: 3, not the 2 the seam promises — agent_sdk/host_auth.py, the
bucket 3 column, and aws_control/.../packaging/build.py's _SENSITIVE_RELATIVE_DIRS.
The third is a deliberate hand-kept mirror: that build runs standalone where
kiro_crew.security cannot be imported, so its coarse fence cannot derive the leaf, and
test_the_local_subset_fences_every_foreign_credential_store is the ratchet that caught
the omission. Reported as seam gap 4 rather than tuned away.

Seam gaps found

  1. scripts/deny_diff.py spells every harness's home-override variable by hand.
    Round 4 added XDG_DATA_HOME; this adds PI_CODING_AGENT_DIR. An earlier head of
    this PR replaced the list with an AST parse of host_auth.py; the First Principles
    lane pointed out that test_child_environment_scrubs_every_declared_home_override
    already forces the edit (it compares the tuple to the live declarations), so the
    parser bought a second edit nobody has to make and cost sixty lines. Reverted to
    the literal. A third provider pays one line, and the test tells them which.
  2. A permission frame can describe something other than the tool call. Every
    parser before this one assumed toolCall on session/request_permission names the
    tool. A gate delivered through a harness's generic dialog does not, so the envelope
    contract and its nonce are new dispatch vocabulary. Built once.
  3. The Routing enum needed a third member. Reported for the same reason round 4
    reported its second: the alternative was claiming an enforcement the existing
    members document as absent.
  4. The auth seam has a mirror it cannot reach. aws_control's standalone packaging
    build keeps its own credential-leaf fence because it runs where the product cannot be
    imported; a new credential_leaves declaration is a second literal there, and only a
    full-suite run (not the ACP tests) surfaces it. Not fixed here — the fence is coarse
    by design and the test pins parity — but it is a third auth file until that build can
    read the declaration some other way.
  5. The own-leaf carve-out is readable by the harness's shell. adapter_own_leaves
    removes ~/.pi/agent/auth.json from the OS mask for the whole sandboxed tree, and pi's
    bash runs in that tree; the shell gate matches no paths by design, and the read gate
    covers file tools only. This is the posture codex and OpenCode ship on main today,
    and Pi ships it too by the owner's decision so the three stay one question, held in
    adapter_own_leaves lets an enforced harness's shell read its own credential store (codex, OpenCode, Pi) #10438 with the measurements (Linux's empty-file mask keeps a keyless local model
    working; macOS's deny makes pi-acp refuse session/new). Stated in bucket 3 and the
    onboarding checklist rather than left implied safe.
  6. The run-directory temp fallback was never a security question before. Every
    launcher in <config_dir>/run was a liveness artifact; the pi gate copy is the first
    whose location is load-bearing. Answered narrowly here (refuse the pi spawn) rather
    than by changing the shared helper; a second gate-extension harness inherits the check.

What #6307 recorded about Pi, checked

Three of its four facts were wrong. PERMISSION_REQUEST routing: false, Pi asks for
nothing and the enum member no longer exists. credential_leaves=(): false, Pi stores
API keys and OAuth tokens in ~/.pi/agent/auth.json, relocated by
PI_CODING_AGENT_DIR — verified on disk with pi auth check --credentials. MCP "may be
inert": correct, and now verified live. Two components, no pi acp subcommand: correct.

Local model

Pi drives Ollama through a models.json provider entry (openai-completions,
baseUrl http://localhost:11434/v1); every capture here is llama3.2:3b. No sign-in
is involved, which is why the auth remedy names an action and asserts no state.

Tests

  • test/test_acp_pi_backend.py (new): both resolver ladders, the launcher body on
    POSIX and Windows, the read-back's failure modes and env scrub, the issue vocabulary,
    the envelope (accepted, forged nonce, wrong title, no nonce, truncated), the
    vocabulary sync between the .ts and the Python, and a live test that drives the
    real launcher against the real pi and refuses a copy of the extension elsewhere.
  • Ratchet literals updated in the eight test files named above; corpus replay green
    for all seven required classes.
  • Mutation-verified: probe name in the .ts, the source check in
    gate_extension_issue, envelope trust in _dispatch.py, and the deny_diff parser
    each break exactly the test meant to catch them.
  • Local gates: harness parity, comment history, agent-sdk boundary, black, isort,
    flake8, mypy, docs lint — all clean. Both local review lanes returned no findings on
    this head after two blocking findings on the first local head were fixed (envelope
    forgery from other harnesses; oversize arguments dropping the path). The first PUSHED
    head drew one GPT block (the gate loaded from an agent-writable package path) and a
    design WATCH (the PI_ACP_PI_COMMAND link read from the adapter's source, no in-band
    check); both are fixed here — the sealed digest-verified copy and the completed-call
    tripwire — and the unused _ENV_PI_CODING_AGENT_DIR constant the first-principles
    lane named is gone.
  • Tripwire, sealed copy, tamper refusal, run-directory refusal and same-file
    comparison are each pinned by their own tests (TestGateTripwire,
    TestSealedExtension, TestGateArtifactsRefuseASharedDirectory,
    TestTheReadBackComparesFilesNotStrings); the run-dir test makes the fallback
    fire and asserts the session is refused with nothing written to the fallback.
  • Round 3 (this head). Server findings: the GPT block on the temp-dir fallback (fixed
    fail-closed as above); the Security Scope concerns — the .ts no longer refuses a
    long shell command, it forwards it whole (verified under Node's type stripping: a
    12k-char command arrives intact and unmarked, 250k is refused, a 9k write body is
    bounded with its path intact); the read-back compares files not strings; the
    title-equality check stays because pi-acp copies the dialog title verbatim into
    toolCall.title (the corpus shows it) and the nonce, not the title, is the trust
    anchor. First-principles: the three Node-adapter resolver ladders are one
    _resolve_node_adapter_argv with three thin wrappers; is_pi_backend stays because
    the one-identity-predicate ratchet in test_acp_backend_kas requires it. Windows CI:
    three reds, one cause — the pinned digest 2cb1… is the LF bytes and the Windows
    digest d885… is the same file rewritten CRLF on checkout (verified by hashing both
    renderings), so every seal read the file as tampered. Fixed at both ends: .gitattributes
    pins the extension LF (the vendor-manifest pattern), and the driver hashes and seals the
    LF form of the bytes it read in binary (_pi_gate_extension_bytes), so the property does
    not rest on a repo-config line. Pinned by a test that hashes both renderings to the same
    digest, seals a CRLF file end to end, and still refuses a one-byte edit that is not a line
    ending. Without this a real Windows install would have refused every pi session. Full suite (not just ACP): two real failures fixed — the
    governance chokepoint that builds an AcpClient without __init__ (nonce is now read
    compat-shaped like the caches beside it) and the standalone credential fence above.
    Local lanes on this head: Opus blocked the live test for leaving pi's TypeScript-loader
    cache in the shared temp dir (now pinned to tmp_path) and named the launcher leak and
    the deny_diff fallback narrowing (both fixed: the sweep knows the family; a checkout
    without readable declarations borrows this checkout's rather than scrubbing less); GPT's
    advisory in-function imports are hoisted, and its dropped candidates — the auto-approve
    path never recording asked ids, the text-only reader without the tripwire, an unreadable
    .ts raising bare FileNotFoundError — are fixed anyway with tests, since each was a
    real gap in a security property even if unreachable today. A second local pass on the
    fixed head was clean on both lanes; its two advisories are also taken: document bodies
    are forwarded whole like the shell command (a cut body cleared raw_params_trusted and
    had a large write scanned as a command line).
  • Round 4. Rebased on test: replace synthesized ACP frame corpora with live captures #10326 (live corpora for every backend; the Pi row joins that
    table) and fix: recognise opencode's MCP tool spelling for directive tools #10331. First Principles: the deny_diff AST parser is gone, the literal
    is back with one line added (subtraction taken); is_pi_backend stays because
    test_exactly_one_predicate_holds_for_every_known_backend requires exactly one
    identity predicate per known backend. Design: the completed-update tripwire now has
    a handshake-time complement — _note_pi_adapter_version logs any pi-acp release other
    than the one the gate contract was observed on (PI_ACP_VERIFIED_VERSION, the corpus
    version), so an adapter drift is named before the first tool call rather than after
    the first one that ran unasked. The two live-host confirmations this host cannot
    produce (a gateway turn under user namespaces; a Windows session start) are Pi: live-host verification (gateway turn on a userns host; Windows session start) #10439.
    GPT's security block on the own-leaf carve-out is answered by the owner's override,
    with the repo-wide question in adapter_own_leaves lets an enforced harness's shell read its own credential store (codex, OpenCode, Pi) #10438.
  • Round 5. Rebased over feat(opencode): project the agent spec onto opencode sessions #10335 (OpenCode joins the session MCP array; Pi's absence
    re-stated on behavioural evidence beside the new text) and the doctor test it added,
    which pins the set of shipped no-channel backends: Pi is now the one named member,
    with a companion test that the doctor row renders for it. Design: the tripwire gains
    its third link — a completed update for a call the host DENIED (pi not honouring the
    extension's block) kills the harness like an unasked one, audited as
    ran_despite_deny; the residual rows name all three links, and the digest-pin /
    LF-normalize / seal / read-back / nonce / tripwire sequence is now a numbered template
    in the Stage 3 checklist, not only the worked example. First Principles: the adapter
    version note stays (it is the Design lane's clearing condition for the tripwire watch)
    but logs once per process per version rather than on every session.
  • One pre-existing failure on this host, identical on clean main:
    test_agent_sdk_backend_install::test_owner_gets_one_row_per_backend_in_the_pinned_shape
    reads codex-acp as installed because it is installed here.

Manual verification

  • pi-acp 0.0.33 / pi 0.85.1 over stdio, llama3.2:3b: without the extension the
    model's echo gate-check ran with zero permission frames; with it, session/request_permission
    arrived carrying the envelope and the command ran only after yes. Captured verbatim in
    test/fixtures/acp_frames/pi/permission-request-live.jsonl.
  • MCP: a stdio server in the session/new array produced no error and no tool.
  • A gateway turn was NOT run: the recording host's kernel refuses user namespaces, so
    the sandbox floor refuses every enforced harness there, Pi included, as designed.

Screenshots / video

Not applicable — no frontend change; the option list is data-driven.

Related Issues

#9616 (the auth seam), #10006 (the OpenCode round and its 33/36 baseline), #6307
(prior research, read and checked, deliberately not built on).

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@iamwhatever
iamwhatever requested review from a team and chenmingwei23 September 12, 2026 08:42
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 12, 2026
@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of d238d9619c17be2fec692a0a6c9416038d89797b — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design review complete. The diff matches the description end-to-end: the gate extension, sealed digest-verified copy, run-dir refusal, nonce-keyed envelope, read-back against pi's command registry, and the completed-call tripwire are all present in the code, the resolver-ladder consolidation is a real simplification, and the specs (agent-host-contract.md, harness-onboarding.md) move in the same commit. No user-visible surface under website/src/ changes, so no rendered evidence is required. The known residuals (one drifted tool call before the tripwire kills the harness; the own-leaf carve-out readable by pi's shell) are stated in the PR with their chosen tradeoffs and tracked follow-ups (#10438, #10439), and I could not name a concretely better alternative for either — a hard adapter-version pin trades every release into downtime, and an in-session probe has no surface on this adapter.

Design-Verdict: PASS

Fail-closed gate injection — sealed copy, read-back, nonce, tripwire — is the right shape for enforcing a harness that ships no gate of its own.

[DESIGN-REVIEWED] d238d96

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — 🟡 CONCERNS

Premise-level review of d238d9619c17be2fec692a0a6c9416038d89797b — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

is_pi_backend ships with zero consumers, copied from two siblings that also have none; the Windows launcher rests on an adapter claim no capture verifies.

Not justified as shipped

  1. New is_pi_backend provider property — zero consumers: grep is_pi_backend finds only the definition (src/kiro_crew/providers/acp.py:529) and one exclusivity test. Its only support is symmetry with is_codex_backend/is_opencode_backend, which I counted the same way: zero non-test consumers each. self._client.backend == ACP_BACKEND_PI already exists for any future site.

What this change ships

Inventory (10 items) — 9 justified

Intent: let a user run the Pi coding agent (and a fully local model) through Kiro Crew with Crew's permission gate actually enforced — an ADDITION.

  1. Pi is selectable as a backend; install status names whichever of its two components is missing — justified
  2. Every Pi tool call asks Crew's gate with real name/arguments (extension sealed, digest-pinned, loaded at spawn, read back), or the session is refused — justified
  3. A Pi session is killed mid-turn when a call completes unasked or after a deny (tripwire) — justified
  4. Model picker offers pi's own advertised provider/model list, persisted under a pi namespace — justified
  5. A Pi session mounts none of Crew's MCP tools, and the doctor row says so — justified
  6. Pi refuses to start when the run directory falls back to shared temp (gate artifacts rewritable there) — justified
  7. is_pi_backend property — zero consumers, symmetry-inherited
  8. The three Node-adapter resolvers collapse into one shared ladder, claude/codex behavior unchanged — justified (net deletion)
  9. Run-dir sweep reclaims dead gateways' pi gate artifacts by owner PID, never age — justified
  10. .pi/agent/auth.json joins the credential floor (mask, deny_diff inheritance, packaging scan) — justified

Watch

The Windows spawn path rests on an unmeasured adapter premise: _pi_gate_launcher_body writes a .cmd "on Windows, where the adapter itself uses a shell for exactly that extension" — the frame corpus verified 0.0.33 on the recording (Linux) host only, and the worked example names no Windows run. Wrongness fails closed (refusal with remedy), but it fails every pi-on-Windows session at start.
Clears when: the gate read-back is confirmed against a real Windows pi-acp install, or the doc/description names that observation.

Subtractions

  • Delete the is_pi_backend property (providers/acp.py:529) and its line in test_acp_backend_kas.py — 0 consumers; sites that ever need identity already have == ACP_BACKEND_PI.

[FIRST-PRINCIPLES-REVIEWED] d238d96

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed d238d9619c17be2fec692a0a6c9416038d89797b — this comment is updated in place on each push.

Review details

I've examined the security-critical surface of this PR directly: the gate-extension envelope parsing with nonce+title verification (_dispatch.gate_envelope, fail-closed on missing nonce/marker/title-mismatch), the shell-kind provenance (envelope kind is Crew's code, the frame's own agent-influenced kind is discarded), the sealing path (LF-normalized digest, read-only copy, refusal of the world-writable temp fallback in _pi_gate_run_dir), the read-back requiring the probe be sourced from Crew's own sealed file compared as the same inode, the in-band tripwire killing the harness on a completed call that was never asked about or was denied, and the _note_pi_gate_asked bookkeeping on both the auto-approve and interactive permission paths. Every path fails closed, blocking calls are offloaded via to_thread, and identity checks are positive (_is_pi/nonce-gated). I actively tried to ground a defect on the changed lines and could not reach the bar on any.

No findings.

[OPUS-REVIEWED] d238d96

Verdict parsed from the review's SHA-scoped output markers for commit d238d9619c17be2fec692a0a6c9416038d89797b.

False positive or not applicable? A repository writer can comment:
/ai-review override fable d238d9619c17be2fec692a0a6c9416038d89797b: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ human override accepted

Human judgment by @iamwhatever overrides the GPT 5.6 finding for d238d9619c17be2fec692a0a6c9416038d89797b; the recorded reason is authoritative for this commit.

This comment is updated in place on each push.

The model was not re-run because an authorized human decision supersedes it.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt d238d9619c17be2fec692a0a6c9416038d89797b: <one-sentence reason>

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🟡 CONCERNS

Which legitimate operations does d238d9619c17be2fec692a0a6c9416038d89797b newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: the reviewer's own judgement; no confirmed regression.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 12 classified, 0 newly refused, 12 still allowed.
  • ubuntu-latest (platform posix): 12 classified, 0 newly refused, 12 still allowed.
  • windows-latest (platform windows): 7 classified, 0 newly refused, 7 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: CONCERNS

TIGHTENING: the shared credential path fence (security.paths._SENSITIVE_HOME_DIRS, splice point *host_auth.credential_leaves()) — host_auth.py gains the pi declaration credential_leaves=(".pi/agent/auth.json",) with home_override_env_vars=("PI_CODING_AGENT_DIR",), so the ONE threat it refuses is an agent's file tools or shell reading pi's single credential store ("API keys and OAuth tokens for every provider share this one file"), including a store relocated out from under the gate via PI_CODING_AGENT_DIR ("The variable relocates pi's WHOLE agent directory ... so it stands in for the leaf's parent"). Companion entries in the same direction: scripts/deny_diff.py adds PI_CODING_AGENT_DIR to _INHERITED_HOME_OVERRIDE_ENV_VARS, and the aws_control packaging build adds .pi/agent/auth.json to _SENSITIVE_RELATIVE_DIRS.

ADJUDICATED: 16 candidates, 0 confirmed newly-refused
No confirmed rows were handed back for this run. The candidates work the fence's boundary rather than its middle: the fenced leaf's readable siblings (models.json — which the diff's own signed_out_message directs operators to edit — settings.json, the session store), the parent-directory listings, the PI_CODING_AGENT_DIR override root's non-credential files, a repo-local file sharing the auth.json basename, the maintainers' own verification and install commands (pi auth check --credentials, pi --version, PI_INSTALL_COMMAND verbatim), and the pi snapshot-regeneration workflow this change adds.

PLATFORM COVERAGE: posix (8 rows: tilde spellings of the leaf's siblings and parents, $PI_CODING_AGENT_DIR override spelling, a repo-relative basename probe), windows (4 rows: %USERPROFILE%\.pi\agent backslash spellings, and BOTH %PI_CODING_AGENT_DIR% and $env:PI_CODING_AGENT_DIR override spellings), and any (3 rows: the platform-neutral pi and npm commands). Why these cover the diff's platform assumptions: the new leaf is authored with POSIX separators and re-joined per-OS by _home_dir_targets_uncached, so the windows rows prove the fence did not take the whole .pi\agent tree on the host whose separator differs; and the adapter-root re-anchor for PI_CODING_AGENT_DIR (paths.py _OVERRIDE_ANCHORED_LEAVES loop) joins with the running OS separator only — unlike the os_home anchor, which emits both spellings — so the two windows override rows probe exactly the join this diff's override assumption leans on. Per-leg VERDICTS are the deterministic fold's to report after this review is captured; no platform verdict is asserted here.

UNADJUDICATED: the pi gate extension and its envelope path — guards the shell classifier cannot reach, all scoped to the new pi backend (every hook is gated on _pi_gate_nonce/_is_pi, so no existing backend's operations flow through them):

  • Guard: the tool_call handler in src/kiro_crew/agent_sdk/gate_extensions/pi/kiro_crew_tool_gate.ts. Call path: pi tool call → extension tool_call event → confirm dialog carrying the JSON envelope → pi-acp session/request_permission → gate_envelope() in acp/_dispatch.py substitutes the envelope for the dialog frame → the deny composite judges it → the dialog answer releases or blocks the call. Refusal edges with no shell-command verdict available: (a) !ctx.hasUI blocks EVERY tool call ("no permission channel"), so a pi session on a UI-less transport loses all tools; (b) an envelope over MAX_ENVELOPE_CHARS (200,000) is refused whole ("tool arguments too large to judge") — since write's content and bash's command are deliberately never truncated, a legitimate pi write of a ~200KB+ generated file, or a bash command carrying a giant heredoc, is refused outright. Candidate inputs I would have submitted: a write of a 300KB lockfile/generated asset; a bash heredoc exceeding 200k chars; a headless pi session's first read.
  • Guard: _tripwire_pi_gate in acp/client.py — a tool_call_update reaching completed for an id the gate never asked about, or one it denied, force-kills the harness and fails the turn. Correct against bypass, but an adapter/pi release that stops forwarding dialogs (the drift _note_pi_adapter_version warns about) converts every legitimate session on that version into a killed session; no classifier input can exercise it.
  • Guard: gate_envelope's acceptance checks (nonce echo, rawInput.title == tool) — a mismatch demotes the frame to an ordinary dialog rather than refusing it, so no legitimate operation is lost, but the behavior is likewise outside the classifier.
  • Guard: the aws_control packaging exclusion .pi/agent/auth.json in _SENSITIVE_RELATIVE_DIRS (packaging/build.py) — an admission policy, not the composite; the leaf is exact and no legitimate packaging input names a credential file, so no candidate inputs to submit.

[SCOPE-REVIEWED] d238d96

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 7b36ed0e6f9d37867e01b1c423169463e0b3aa90; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7b36ed0e6f9d37867e01b1c423169463e0b3aa90: <one-sentence reason>

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ⚠️ review incomplete

GPT 5.6 did not produce a complete verdict for 7b36ed0e6f9d37867e01b1c423169463e0b3aa90; inspect the workflow logs and re-run it.

This comment is updated in place on each push.

See the GPT 5.6 Review job logs; this commit has no completed GPT verdict.

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 7b36ed0e6f9d37867e01b1c423169463e0b3aa90: <one-sentence reason>

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Sep 12, 2026
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Sep 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt f2b63f8: adapter_own_leaves spares the harness its OWN token file, the identical carve-out codex (.codex/auth.json) and OpenCode (.local/share/opencode/auth.json) ship on main; masking it fails every hosted-model session at auth, and the shell-read exposure it carries is repo-wide for all three enforced harnesses, documented in bucket 3 and held for a single decision in #10438 rather than closed for one harness here. Drafted by an agent on the repository owner's instruction.

@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for f2b63f8d7c6e77127b96bb29ce9f7ed637e858c8.

adapter_own_leaves spares the harness its OWN token file, the identical carve-out codex (.codex/auth.json) and OpenCode (.local/share/opencode/auth.json) ship on main; masking it fails every hosted-model session at auth, and the shell-read exposure it carries is repo-wide for all three enforced harnesses, documented in bucket 3 and held for a single decision in #10438 rather than closed for one harness here. Drafted by an agent on the repository owner's instruction.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Sep 12, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) September 13, 2026 07:16
bolichen97
bolichen97 previously approved these changes Sep 13, 2026
@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Sep 13, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt ef71a38: adapter_own_leaves spares the harness its OWN token file, the identical carve-out codex (.codex/auth.json) and OpenCode (.local/share/opencode/auth.json) ship on main; masking it fails every hosted-model session at auth, and the shell-read exposure it carries is repo-wide for all three enforced harnesses, documented in bucket 3 and held for a single decision in #10438 rather than closed for one harness here. Rebase-only head (main moved 36 commits; two doc tables and the MCP-array comments re-merged, no functional change since f2b63f8 which this same override cleared). Drafted by an agent on the repository owner's instruction.

@github-actions

Copy link
Copy Markdown
Contributor

AI-review override not recorded: keep the reason to 500 characters or fewer.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Sep 13, 2026
…sion

Pi is the `pi` coding agent reached through `pi-acp`, a third-party Node stdio
adapter that spawns `pi --mode rpc`. Two components, so the resolver, the install
probe and the not-found message each name the half that is missing.

Pi has no permission gate of its own: `pi` runs every tool call unasked, and
`pi-acp` sends `session/request_permission` only when an extension inside `pi`
raises a confirm dialog. So the session loads Kiro Crew's own gate extension into
the harness, through a launcher the adapter is told to run in place of `pi`, and
before the first prompt asks pi's own command registry whether the extension
loaded from Kiro Crew's file, refusing the session otherwise. That is a new
`Routing.VERIFIED_GATE_EXTENSION`, because neither existing member describes a
harness with nothing to seed. The extension writes the tool call into the dialog
as a JSON envelope, and the dispatch parser reads it back so the host gate judges
the real tool name, kind and arguments.

The adapter accepts the `session/new` MCP array and never forwards it to the
agent, so Pi stays outside the session MCP array set and its mirror is recorded
as a no-mirror entry with that reason. The frame corpus is live for all seven
required classes, on pi-acp 0.0.33 over pi 0.85.1 driving a local Ollama model.

The deny differential now derives the home-override variables it scrubs from the
auth declarations module instead of a hand-kept list.
@iamwhatever

Copy link
Copy Markdown
Contributor Author

/ai-review override gpt d238d96: adapter_own_leaves spares the harness its OWN token file, the identical carve-out codex (.codex/auth.json) and OpenCode (.local/share/opencode/auth.json) ship on main; masking it fails every hosted-model session at auth, and the shell-read exposure it carries is repo-wide for all three enforced harnesses, documented in bucket 3 and held for a single decision in #10438 rather than closed for one harness here. Drafted by an agent on the repository owner's instruction.

@github-actions

Copy link
Copy Markdown
Contributor

Human judgment recorded

@iamwhatever marked the gpt AI finding as false positive, not applicable, or explicitly accepted for d238d9619c17be2fec692a0a6c9416038d89797b.

adapter_own_leaves spares the harness its OWN token file, the identical carve-out codex (.codex/auth.json) and OpenCode (.local/share/opencode/auth.json) ship on main; masking it fails every hosted-model session at auth, and the shell-read exposure it carries is repo-wide for all three enforced harnesses, documented in bucket 3 and held for a single decision in #10438 rather than closed for one harness here. Drafted by an agent on the repository owner's instruction.

This decision applies only to this commit. A new push requires a new judgment.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Sep 14, 2026
@bolichen97
bolichen97 merged commit f210fbb into main Sep 14, 2026
88 of 95 checks passed
@bolichen97
bolichen97 deleted the feat/acp-backend-pi branch September 14, 2026 18:16
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 14, 2026
amadsalmon pushed a commit to amadsalmon/KiroCrew that referenced this pull request Sep 22, 2026
…sion (kirodotdev#10334)

Pi is the `pi` coding agent reached through `pi-acp`, a third-party Node stdio
adapter that spawns `pi --mode rpc`. Two components, so the resolver, the install
probe and the not-found message each name the half that is missing.

Pi has no permission gate of its own: `pi` runs every tool call unasked, and
`pi-acp` sends `session/request_permission` only when an extension inside `pi`
raises a confirm dialog. So the session loads Kiro Crew's own gate extension into
the harness, through a launcher the adapter is told to run in place of `pi`, and
before the first prompt asks pi's own command registry whether the extension
loaded from Kiro Crew's file, refusing the session otherwise. That is a new
`Routing.VERIFIED_GATE_EXTENSION`, because neither existing member describes a
harness with nothing to seed. The extension writes the tool call into the dialog
as a JSON envelope, and the dispatch parser reads it back so the host gate judges
the real tool name, kind and arguments.

The adapter accepts the `session/new` MCP array and never forwards it to the
agent, so Pi stays outside the session MCP array set and its mirror is recorded
as a no-mirror entry with that reason. The frame corpus is live for all seven
required classes, on pi-acp 0.0.33 over pi 0.85.1 driving a local Ollama model.

The deny differential now derives the home-override variables it scrubs from the
auth declarations module instead of a hand-kept list.

Co-authored-by: zejiangg <zejiangg@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants