Skip to content

fix(pi): skip terminal permission-gate after island allow#287

Open
cat0825 wants to merge 1 commit into
wxtsky:mainfrom
cat0825:fix/pi-island-permission-double-confirm
Open

fix(pi): skip terminal permission-gate after island allow#287
cat0825 wants to merge 1 commit into
wxtsky:mainfrom
cat0825:fix/pi-island-permission-double-confirm

Conversation

@cat0825

@cat0825 cat0825 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #286.

On pi, approving a dangerous bash command on the Dynamic Island still left a second Yes/No confirmation from a co-installed permission-gate.ts.

pi runs every extension tool_call handler; only { block: true } short-circuits. Island allow previously returned undefined, so permission-gate always re-prompted.

Changes

1. codeisland-pi.ts (v2v3)

  • On explicit island allow, record event.toolCallId on globalThis.__codeislandAllowedToolCalls.
  • Timeout / null response does not set the marker (terminal gate remains fallback).
  • Fix the header comment that incorrectly claimed the extension "replaces" permission-gate.ts.

2. Installer version bump

  • piExtensionVersion: v2v3 so repair reinstalls the fixed resource.

3. OMP version independence (regression guard)

  • isOmpExtensionInstalled previously reused piExtensionVersion.
  • A pi-only bump would false-flag healthy OMP installs as needing repair.
  • Introduce independent ompExtensionVersion = "v2" and check it directly.

4. Tests

  • Assert installed pi extension contains // version: v3 and __codeislandAllowedToolCalls.
  • Leave OMP expectation at v2.

Coordination with user-managed permission-gate.ts

CodeIsland does not own permission-gate.ts (user extension). The intended companion check is:

const allowed = (globalThis as any).__codeislandAllowedToolCalls as Set<string> | undefined;
if (event.toolCallId && allowed?.has(event.toolCallId)) {
  allowed.delete(event.toolCallId);
  return undefined; // skip TUI prompt
}

Without that skip, the island still prompts once, but the terminal gate will still ask. With both sides, island Allow is sufficient for that tool call.

Degradation matrix

Scenario Result
Island Allow marker set → compatible gate skips TUI
Island Deny { block: true } (unchanged)
Island timeout / offline no marker → terminal gate still prompts
No permission-gate.ts behavior unchanged (island only)

Related

Verification

  • Diff review of the three changed files.
  • Local pi install already uses the same marker protocol with a companion permission-gate.ts skip.
  • Installer/unit tests updated for v3 marker content.
  • Full swift test not run in this environment (no local git checkout / Xcode build path for this fork via API-only push). Happy to iterate on CI.
# after local checkout
swift test --filter ConfigInstallerTests

Island Allow for dangerous bash currently returns undefined, so a
co-installed permission-gate.ts still prompts in the TUI.

Record toolCallId on globalThis when CodeIsland explicitly allows, bump
pi extension to v3, and keep OMP version detection independent so a
pi-only bump does not false-flag healthy OMP installs.

Fixes wxtsky#286
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.

fix(pi): island Allow still requires terminal permission-gate confirmation

1 participant