Skip to content

feat(acp): bridge Crew MCP tools into Pi through governed broker - #12380

Closed
pstarkgit wants to merge 1 commit into
kirodotdev:mainfrom
pstarkgit:feat/pi-mcp-bridge
Closed

pstarkgit wants to merge 1 commit into
kirodotdev:mainfrom
pstarkgit:feat/pi-mcp-bridge

Conversation

@pstarkgit

@pstarkgit pstarkgit commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let Pi sessions use Kiro Crew MCP tools through per-call host approval.

pi-acp accepts an ACP session/new mcpServers array but does not forward it to Pi. Kiro Crew therefore correctly keeps Pi out of the session MCP array capability, yet Pi member sessions cannot call Crew MCP tools for subagents, schedules, and memory.

Why it matters

Operators using Pi can chat and select their signed-in models, but Crew tools are absent. The member experience is incomplete compared with other supported ACP backends.

Not a goal

  • Make Pi's ACP session/new MCP array carry Crew servers; this PR uses a separate, permission-gated bridge.

What changed (motivation → approach → change)

Pi needs a transport that its ACP adapter actually consumes, without moving MCP credentials or approval authority into the Pi process. This change seals a Pi extension that connects to a session-owned host broker. The broker keeps server commands and environment values on the host, admits the local principal, and forwards a call only after consuming a single-use host approval bound to the call ID, exact tool name, and complete arguments.

  • src/kiro_crew/acp/client.py builds one bounded, policy-filtered AdmittedServerRoster and passes it to pi_mcp_broker.py; the broker cannot re-admit a raw server list. It starts eligible direct servers and pooled stubs through the existing src/kiro_crew/sandbox.py, src/kiro_crew/platform_compat.py, src/kiro_crew/security_posture.py, process-identity, resource, and audit controls. Failed children, oversized frames, stale approvals, replays, cancellation, and teardown failures remain fail-closed without discarding healthy siblings.
  • src/kiro_crew/agent_sdk registers bridged tools as mcp__{server}__{tool}, preserves supported text, image, structured output, and MCP error status, and reports only servers that initialized. The capability declarations in src/kiro_crew/providers expose the bridge only when the backend can serve it. Pi's unresolved @server diagnostics use that same bounded roster because its ACP MCP array remains inert.
  • Secret scrubbing now distinguishes credential-bearing values from ordinary declared metadata. Credential-named keys and credential-shaped values remain protected, including host-injected session tokens, while values such as GITHUB_HOST=github.com, NODE_ENV=production, and AWS_REGION=eu-west-1 no longer redact valid metadata or silently withhold a callable tool.
  • Warm-pool claims in src/kiro_crew/session_pool.py compare the live Pi MCP policy with the prewarmed broker policy and discard stale or unreadable claims. Capability cards report bridged tools only after the extension and broker are verified.
  • The owning ACP, provider, host-contract, and testing specifications document the lifecycle, admission, redaction, compatibility, and mock-process safety contracts. Tests cover authorization, replay, results, cleanup, policy projection, capability reporting, redaction, and Windows ownership behavior.

The session-owned broker is intentionally a Pi transport lifecycle, not a second policy plane. AcpClient remains the sole production admission caller and the shared Crew policy, sandbox, redaction, identity, and audit boundaries remain authoritative.

Backwards compatibility

Compatible: other backends keep their existing MCP launch path. Pi sessions without an available or verified bridge remain chat-capable and report the missing tool mount. No stored settings or MCP server specs are migrated.

Reader: src/kiro_crew/acp/client.py:AcpClient._spawn -- chat -- test_acp_pi_backend.py::test_the_read_back_child_is_sandbox_wrapped_with_the_adapter_mask; the Pi gate artifacts remain exposed for its read-back.
Reader: src/kiro_crew/mcp_core.py:_resolve_session_key_strict -- chat -- test_pi_mcp_broker.py::test_only_verified_host_children_omit_the_pi_credential_mask; the exact managed core child keeps access to its host-owned session binding.
Reader: src/kiro_crew/mcp_cron.py:_call_tool -- cron -- test_pi_mcp_broker.py::test_only_verified_host_children_omit_the_pi_credential_mask; the exact managed cron child keeps its host-owned session binding.

Tests

  • test/test_pi_mcp_broker.py and test/test_acp_pi_backend.py: 304 passed, one skipped on the rebased final implementation.
  • Delegate verification: 94 broker tests and 649 ACP client tests passed; the new ordinary-metadata regression fails against the original length-only predicate.
  • Black, isort, flake8, mypy, docs lint, subprocess encoding, and diff checks passed for the repair.
  • scripts/local-gate.py completed its first related backend batch with 28,409 passed and 172 skipped. Its next batch reached only host-inherited failures: 40 test_cloud_source.py ownership assertions and two ripgrep provenance assertions. Both exact sets reproduce on pristine current main because this container reports / and the ripgrep parent as owned by uid 65534. CI remains the cross-platform authority for those host-sensitive tests.

Manual verification

On an isolated temporary home with no live credentials, actual Pi 0.87.1 and pi-acp made one ACP permission request for read-only mcp__kirocrew-core__knowledge_list_sources. The candidate host approved it, the broker called a real python -m kiro_crew mcp-core child, and the result reached the deterministic local model before end_turn. Replay of the same call ID, name, and arguments was denied. The run discovered 83 Crew tools, called only the selected read-only tool, stopped test-owned processes, and removed its scratch directories.

This isolated test does not validate subscription authentication, the desktop HTTP gateway, native Windows execution, or a signed app update. Those remain release checks.

Screenshots / video

no-visual-delta: Existing capability-card content now reflects bridged tool availability; no panel or layout changes. The isolated tool-call trace is stronger evidence for this backend behavior than a static screen.

Related Issues

No originating work item is linked. #12305 is related to the model catalog, but this Pi MCP bridge does not implement or close it.

Checklist

  • One commit with a Conventional Commits title
  • Focused tests pass and regressions cover authorization, replay, results, cleanup, capabilities, and metadata redaction
  • Self-review and model-pinned repair review completed
  • Owning documentation updated
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Sep 20, 2026
@dwu96

dwu96 commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

👋 Hi! This PR is currently in draft status. Workflow runs won't be auto-approved until it's marked as ready for review.

When you're ready, click "Ready for review" and the workflows will be approved on the next cycle automatically.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 20, 2026
@pstarkgit
pstarkgit marked this pull request as ready for review September 20, 2026 23:19
@pstarkgit
pstarkgit requested review from a team and bolichen97 September 20, 2026 23:19
@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 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 59a5ddfb31e1872a618e0876ad17af684015cd5c via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify the Windows named-pipe broker and launcher live before release — manual verification was POSIX-only, and that soft-fail path is designed but unobserved there.

[DESIGN-REVIEWED] 59a5ddf

Description read

[DESCRIPTION-READ] e4f6f5e1ef20ee4e6be02fea1ff1065636c2f6567128476781ab074b8a735743

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 59a5ddfb31e1872a618e0876ad17af684015cd5c via the fork AI-review pipeline; updated in place on each push.

Review details

One advisory finding: the new spec text enumerates three brokered-call audit outcomes while the broker emits four.

FINDING — docs/system-specs/modules/acp-client.md:191 — the added sentence pins the brokered-call audit contract as "completed, denied, or failed", but pi_mcp_broker.py:1814 sets audit_outcome = "cancelled" if routed else "denied" and test_pi_mcp_broker.py's test_cancelled_broker_call_finishes_its_audit asserts outcomes == ["cancelled"], so the spec shipped in this commit understates the SEL outcomes an auditor will see → Fix: list cancelled alongside completed, denied and failed in that sentence.

[OPUS-REVIEWED] 59a5ddf

@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5, fork) — ✅ PASS

Premise-level review of 59a5ddfb31e1872a618e0876ad17af684015cd5c via the fork AI-review pipeline — 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: PASS

Verify one shape call: Pi sessions now mount Crew tools by default; the registry's tracking RFC (rfc-agent-config-mirror, partial) never names Pi, so maintainers should own that.

The base tree itself recorded the gap and the remedy this PR builds — the Pi registry entry's channel: named "an extension of Crew's that bridges MCP the way the gate extension bridges permissions," and every flipped test pin recorded "no tools today" as measured fact, not a contrary decision. The pi-acp inert-array premise is base-verified live, failure degrades to chat rather than denying boot, the LLMProvider.pool_mcp_policy_current default is the H14-mandated form, and the broker's bounds each guard the untrusted-agent/child-content boundary. The redaction "repair" loosens only this PR's own new sink, no base scrub.

What this change ships

Inventory (10 items) — 10 justified

Intent: Let an operator's Pi sessions call Kiro Crew's MCP tools (subagents, schedules, memory) under per-call host approval — ADDITION.

  1. Pi sessions now offer Crew MCP tools (mcp__server__tool), previously absent — justified
  2. Each bridged call consumes a single-use host approval; replays and changed arguments are denied — justified
  3. A sealed, hash-pinned bridge extension loads into Pi beside the permission gate — justified
  4. A session-owned host broker spawns the MCP servers; credentials never enter Pi — justified
  5. Doctor output and capability cards now report Pi carrying Crew tools — justified
  6. Warm-pool claims discard a prewarmed Pi runtime whose MCP policy changed — justified
  7. Bridged-metadata redaction keeps credentials but no longer hides ordinary values like GITHUB_HOST — justified
  8. Per-server disabled-tools honored on the bridge; identity-bound Crew servers withheld whole — justified
  9. New internal broker-socket env var and sandbox sweep entries for bridge artifacts — justified
  10. New POSIX kill helper for detached MCP descendants (kill_pid_pinned_outside_group) — justified

[FIRST-PRINCIPLES-REVIEWED] 59a5ddf

Description read

[DESCRIPTION-READ] 95ae0dd4509261d408c00789e1435c78605292a666c77afd7653dc9e65c0c558

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Sep 20, 2026
@github-actions

github-actions Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — 🔴 changes requested (blocking)

Reviewed 59a5ddfb31e1872a618e0876ad17af684015cd5c via the fork AI-review pipeline; updated in place on each push.

1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands.

BLOCKING -- src/kiro_crew/acp/client.py:6239 -- Warm-pool rekey loses the claiming channel for direct cron children (origin: validation)
self._pi_mcp_broker.rekey(session_key)
Pi warm pool + disabled MCP gateway + channel-session cron_add without channel -> direct cron child retains the pool’s empty KIROCREW_CHANNEL_ID -> job is persisted without its delivery channel.
Anchor: residual/crash-data-loss-corruption
Fix: Reject Pi warm claims when kirocrew-cron is a direct broker child, forcing a cold spawn with the claiming channel.
[BLOCK-MERGE] 59a5ddf
[GPT-REVIEWED] 59a5ddf

Adjudication (Opus 5) — is blocking on each finding proportionate?

Verified the fenced finding against the base tree and the pre-fetched diff.

F1 — Harm rung: MEDIUM-to-HIGH, silent at the moment it happens: the job persists with channel=None and the delivery the user asked for never arrives.
Conditions confirmed: a pooled provider is built with an empty session key and no channel (session_pool.py:371-375, acp/client.py:6124-6126); control_plane_identity_env emits KIROCREW_CHANNEL_ID only when the channel is non-empty (providers/mirrors/identity.py:102-103), so the broker child's env omits it, and PiMcpBroker.rekey rewrites only _session_key, which is consumed solely by _audit_tool_call — _trusted_server_env is never revisited; the default topology has no gateway caller block, since the overlay exists only when mcp_gateway.stub_servers is non-empty (config/loader.py:5131-5135), leaving _caller_channel_id() empty (mcp_cron.py:2542-2554) and cron_add falling through to the stale env (mcp_cron.py:2484-2489, mcp_cron.py:3090-3092). Recovery: none automatic; repair is manual via cron_update's channel argument (mcp_cron.py:1917) after the user notices nothing was delivered.
Why not FLAG: the required combination is two ordinary opt-ins (agent.acp_backend=pi, a baseline-selectable backend at agent_sdk/backends.py:532, plus session.pool_size>0, off by default per config/sections.py:146) on an otherwise default install — no contradicting timing, no input the system's own writer cannot produce, no legacy-only artifact. That codex's array path carries the same spawn-time identity env (providers/mirrors/codex.py:151-164, documented as the known-stale fallback at identity.py:60-72 and mcp_cron.py:2545-2551) argues the fix belongs in a shared channel carrier rather than a Pi-only claim rejection, but parity with an existing residual does not make this condition combination extreme, so the clearance argument is not mine to pre-draft.

[ADJUDICATION] 59a5ddfb31e1872a618e0876ad17af684015cd5c total=0 uphold=0 downgrade=0
[GPT-ADJUDICATED] 59a5ddfb31e1872a618e0876ad17af684015cd5c

[ADJUDICATION-FENCED] 59a5ddfb31e1872a618e0876ad17af684015cd5c fenced=1 flagged=0
UPHOLD-FENCED F1 src/kiro_crew/acp/client.py:6239 -- Reached by two ordinary operator opt-ins (pi backend plus a non-zero session.pool_size) on the default no-stub topology, with no automatic recovery and a silent wrong delivery default, so the condition combination is plausible rather than extreme.
[GPT-ADJUDICATED-FENCED] 59a5ddfb31e1872a618e0876ad17af684015cd5c

@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
@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: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Sep 23, 2026
@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: checking Automated validation is still running labels Sep 24, 2026
@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: 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 24, 2026
@pstarkgit pstarkgit changed the title feat(acp): bridge Crew MCP tools into Pi via sealed extension feat(acp): bridge Crew MCP tools into Pi via sealed host broker Sep 25, 2026
@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 25, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

Windows: broker MCP children are spawned CREATE_SUSPENDED and never resumed, so the Pi MCP bridge cannot initialize on native Windows

Re-verified against current head b638429 after the rebase.

PiMcpBroker._spawn_children (src/kiro_crew/acp/pi_mcp_broker.py) spawns every stdio MCP child with creationflags including platform_compat.CREATE_SUSPENDED (~line 580), then proceeds directly to _McpChild(...) → reader task → stderr drain → await child.handshake() (~line 601). Nothing between the spawn and the handshake resumes the child.

Mechanism. On Windows CREATE_SUSPENDED (0x4) starts the process with its primary thread suspended; it executes no instruction until ResumeThread is called. On this path none of platform_compat.resume_process_main_thread, acp.client.finish_suspended_spawn, or apply_windows_resource_ceiling is invoked — at this head the file contains one CREATE_SUSPENDED and zero occurrences of all three. create_windows_cleanup_owned_process / _bind_windows_cleanup_process do not resume either; the latter's own docstring describes capturing "the original suspended child before any cancellable resume work", i.e. resuming is the caller's responsibility. CPython's _WindowsSubprocessTransport does not auto-resume a CREATE_SUSPENDED child.

Consequence. Every broker child stays frozen. child.handshake() writes initialize into the pipe, the suspended child never reads it, and the request times out at _HANDSHAKE_TIMEOUT_SECS (30s). The handshake except-arm marks the server failed and kills it, so initialized_servers ends up empty and tool_count is 0.

Affected workflow. A Pi (pi-acp) session on native Windows that projects any MCP servers. The PR's headline capability — bridging Crew MCP tools into Pi — does not function there: the bridge soft-fails and the session falls back to Pi's pre-PR chat-only behaviour, after a ~30s stall per server charged against the 60s _STARTUP_TIMEOUT_SECS budget on the session-start path. POSIX is unaffected because CREATE_SUSPENDED == 0 there, and that asymmetry is what pins the diagnosis.

Suggested fix. After create_windows_cleanup_owned_process returns the child, call the existing acp.client.finish_suspended_spawn(process, process.pid, label=...) off the loop (run_in_executor(subprocess_executor(), ...)), exactly as AcpClient._spawn and AcpRuntime._spawn already do. That helper applies apply_windows_resource_ceiling and then resume_process_main_thread with the fatal-on-live-but-unresumable semantics, so the Job ceiling and the ownership gate come with it — preferable to a hand-rolled bare resume_process_main_thread. If the Job ceiling is deliberately not wanted for these short-lived children, the alternative is to drop CREATE_SUSPENDED from the broker's creationflags so the child is never suspended; note that this leaves open the descendant-escape window apply_windows_resource_ceiling exists to close.

Suggested regression test. In test/test_pi_mcp_broker.py, a Windows-branch assertion that _spawn_children invokes the resume/ceiling helper on each spawned child before handshake(). test/test_windows_cleanup_capacity.py already exercises _McpChild.kill() on the owned-process path; the missing pin is on the spawn/resume side rather than teardown.

Teardown (terminate_windows_asyncio_tree), the named-pipe transport, the POSIX-guarded os.chmod / os.unlink / restrict_to_owner calls, and the artifact sweep all look correct on Windows.

Raised by an automated Windows-compatibility audit of the open PR queue. Non-blocking: the bridge degrades gracefully rather than crashing the session.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

I updated the frozen description sections because the PR template gained a required **Goal:** line and ## Not a goal section after this PR opened. The new wording restates the original Pi MCP-tool goal and the existing note that Pi does not use the ACP session MCP array; it does not change the PR's scope. I also updated the local test count for the rebased head.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

@bolichen97 Addressed in a6906ab9f: the broker now calls finish_suspended_spawn off the event loop after cleanup ownership is attached and before child.handshake(). test_windows_broker_resumes_child_before_handshake checks the resume-before-handshake ordering. Native Windows execution remains a release verification item in the PR description.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

Builder handoff: Grok native-tool invocation investigation

Read-only triage against PR head 86e1a620fc88c0fa13d1d03f64b132e1dce4169d. This is a related incident report, not a confirmed defect in this PR or a competing implementation.

Observed behavior: In a standing Crew member conversation configured as xai/grok-4.7, two turns reported registered native monitor/session tools but attempted to invoke them through shell commands. After selecting openai-codex/gpt-6-sol through the normal model picker, native monitor inspection succeeded, two owned workers were launched, and a follow-up to an existing worker completed. A later scheduled patrol wake also succeeded. Approval settings and member ownership were not changed.

Important limitations: This was not a controlled same-process A/B test. Changing the model may recreate the underlying session; the exact provider response model and tool roster sent on the failing turns were not captured. A separate Grok-configured triage worker subsequently emitted at least one native MCP call, so this does not establish that Grok categorically cannot use Crew tools.

Runtime mismatch: The observed source gateway used detached base e4e6ed7c60b736d9473fe25cc597e57bcece767a plus 38 staged files, not this PR's exact head. Its staged broker was 654 lines versus 1309 at the PR head; the mixed runtime must not be treated as validation of the candidate. No live runtime changes, restart, or competing patch were made during triage.

Relevance: #12380 owns the Pi MCP registration/bridge path and is the primary investigation point. Its documented deterministic-model full-chain test does not establish live xAI tool emission. #12442 addresses child startup/protected identity failures after invocation, but those failures were not demonstrated here. #12305 is model-catalog routing and is not currently implicated.

Suggested next verification for the existing builder:

  1. Reproduce on an isolated checkout of the exact PR head, recording Pi/pi-acp versions and whether a model switch recreates the process/session.
  2. Capture only secret-free tool names/schema metadata and provider/model identifiers for the failing and working turns. Confirm mcp__kirocrew-core__monitor_inspect and the native session tools actually reach each model.
  3. Trace the emitted call name through Pi's provider adapter, extension registration, Crew approval gate, and broker. Distinguish bash selected by the model from a native call incorrectly translated or rejected downstream.
  4. Add regression coverage for native monitor/session-tool registration and retention or correct remounting across session/set_model. If the issue is provider-specific, add an appropriate provider fixture; a deterministic mock alone cannot prove live Grok behavior.
  5. Keep the existing permission and ownership fences intact. Report whether the incident is fixed by this head, needs a scoped follow-up, or lies outside this PR.

The operational workaround is to keep the affected conductor on GPT-6 Sol while this is investigated. Root cause and a Grok fix remain unconfirmed.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

Follow-up runtime evidence from the existing Murmr fleet (September 29):

  • Several existing Pi-backed worker sessions on xai/grok-4.7 returned provider_empty / end_turn, with no visible text, tools, thinking, or billing after automatic recovery. This is a separate observed failure from an earlier native-tool invocation issue; root cause remains unproven.
  • Switching those same dashboard sessions through the supported UI to openai-codex/gpt-6-sol restored substantive native tool execution and source reviews. Session model changes can recreate the underlying runtime, so this is a working recovery, not a controlled proof that the model alone caused the problem.
  • AWS MCP's Invalid request parameters error was independently isolated to the old installed kirocrew-tests profile: identical initialize messages failed with expired SSO (TokenRetrievalError / InvalidGrantException) but succeeded with the renewable scoped profile. No broker wire-format change was needed.
  • A fresh Nyra member runtime then invoked native mcp__aws-mcp__aws_run_script successfully for STS identity and read-only CloudFormation stack metadata. call_boto3 expects PascalCase operation names; correcting a snake_case argument resolved a separate OperationNotFoundError.

Please keep provider-empty reproduction, template/runtime adoption, and expired AWS authentication as distinct test cases. The live checkout contains staged bridge changes and does not establish that this PR's current head has been validated. No competing fix was made to this PR's bridge files.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

fixed
f4747cc records the session-owned Pi broker as an intentional transport lifecycle, not a second policy plane, and identifies every shared admission, sandbox, redaction, identity, teardown, and audit boundary it reuses.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

rebutted
The instance-local swap is installed only inside the Pi spawn arm and leaves the shared _pooled_mcp_servers implementation unchanged for every other backend. Folding Pi membership into the shared method would widen a backend-specific transport exception without changing behavior or closing a reachable defect.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

fixed
f4747cc removes raw-server admission from PiMcpBroker. The sole production caller now passes a required AdmittedServerRoster, and tests construct through that same seam.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

fixed
f4747cc replaces the length-only secret rule with credential-key and credential-shape evidence. Regression tests prove ordinary values such as GITHUB_HOST=github.com remain visible while named and shaped credentials are still redacted and credential-bearing tool names are withheld.

@pstarkgit

Copy link
Copy Markdown
Contributor Author

Live Grok failure triage (2026-09-29): this incident is upstream of the Pi→Crew MCP bridge.

  • In the existing Membr B session, all three xai/grok-4.7 responses at 17:38 UTC ended with provider stopReason=error, zero content/tool calls, and the same xAI HTTP 403: the account has no available credits or needs an eligible Grok subscription. Crew displayed the downstream symptom as provider_empty and retried twice.
  • A separate bounded read-only Grok probe (grok-native-readonly-20260929-003, resolved provider xai, model grok-4.7, Pi 0.87.1) reproduced the same 403 before any tool call. It produced no model response; no shell fallback, file write, or AWS operation occurred.
  • Local Pi auth metadata has an xai OAuth entry. Credential values were not read or reported. Pi's xAI provider routes that OAuth credential to https://api.x.ai/v1; the provider rejected the request. Selecting openai-codex/gpt-6-sol in the same B session then produced normal native tool activity. That demonstrates a working alternative route, not a Grok bridge fix.

Next action is to restore the entitlement/usage of the xAI account used by Pi, or configure an authorized funded xAI API key, then rerun one read-only native tool probe under Grok. Separately, Crew should surface the provider's 403 category instead of labeling it as an unexplained empty response or retrying it. Keep #12380's bridge validation separate: its deterministic-model test remains useful but does not test live Grok entitlement. No bridge code change is supported by this incident evidence.

Copy link
Copy Markdown
Contributor

PR triage (2026-10-05): rebase needed, plus one blocking finding still open

Classification: DISTINCT. Nothing open or merged duplicates this. On origin/main (cc7e79894e) the Pi projection is still ProjectionKind.NO_CHANNEL in providers/mirrors/registry.py, and neither acp/pi_mcp_broker.py nor gate_extensions/pi/kiro_crew_mcp_bridge.ts exists. The merged Pi fixes (#14339, #14411, #14416) and #12305 (a merged PR about the model catalog) don't touch MCP. Other open PRs that share files (#12344, #13335, #12551, #13320/#14861) have different goals and don't add any MCP bridge for Pi.

Rebase: the merge base f0be829 is 495 commits behind origin/main. git merge-tree origin/main origin/pr/12380 reports content conflicts in:

  • docs/system-specs/common/testing-conventions.md
  • docs/system-specs/modules/agent-host-contract.md

Please rebase, and re-check acp/client.py against the merged ACP changes that came after the base, in particular #16280 (stray JSON-RPC lines) and #14406 (cancelled permission requests). The broker's permission path depends on both.

Still open at head 59a5ddf: the GPT review's BLOCK-MERGE finding at acp/client.py:6239 has not been addressed. PiMcpBroker.rekey() (pi_mcp_broker.py:1112) updates only _session_key. It never touches _trusted_server_env. A direct kirocrew-cron child spawned for the warm pool therefore keeps the pool's empty KIROCREW_CHANNEL_ID, and cron_add called without channel from a claimed Pi session saves the job with no delivery channel. Since that review already covers this, I'm not opening a separate change request. It needs a fix or a written rebuttal before merge. One fix: reject the warm claim when cron is a direct broker child. Another: carry the channel the same way the session token is re-bound.

Recommendation: REBASE, then CONTINUE-DEVELOPMENT on the finding above. The approach itself looks fine.

@iamwhatever

Copy link
Copy Markdown
Contributor

Thank you @pstarkgit for this bridge and the deep testing behind it.

Closing this as superseded by another design. #19761 (a60e545d1, "carry Crew's MCP servers into pi sessions") is merged on main. Pi now gets Crew's MCP tools through a broker-only projection at providers/mirrors/registry.py:286. The 2026-10-06 triage called this PR distinct because main had no Pi channel then; main has moved since.

Your branch is kept. If the governed-broker parts cover something #19761 does not, please reopen this or open a follow-up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor) merge conflict Branch has merge conflicts with its base — author must resolve before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants