Skip to content

fix(console): make the approval-gate worker optional#303

Open
ytallo wants to merge 1 commit into
mainfrom
fix/console-optional-approval-gate
Open

fix(console): make the approval-gate worker optional#303
ytallo wants to merge 1 commit into
mainfrom
fix/console-optional-approval-gate

Conversation

@ytallo

@ytallo ytallo commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Makes the standalone approval-gate worker truly optional for the console.

The console gated all approval UI and approval::* RPC on harness
availability (isHarnessAvailable). But approval-gate is a separate,
optional worker
that owns the approval::* functions. Running console +
harness without the gate caused two problems:

  • the console called approval::get-settings / approval::set-mode (and
    subscribed to approval::pending-*, read approval::list-pending) →
    "function not found" errors;
  • the manual/auto/full permission-mode picker rendered in the composer and the
    Configuration → permissions section, where every interaction failed.

Changes

  • New useApprovalGateStatus / isApprovalGateAvailable
    (use-approval-gate-status.ts) — detects the approval-gate worker
    independently, mirroring the existing useHarnessStatus worker-presence
    pattern (mount probe via engine::workers::list + live worker add/remove
    events). No install CTA — the gate is never pushed on the operator.
  • conversations-context.tsx exposes approvalGateAvailable.
  • ChatView requires the gate for approvalEnabled; this short-circuits
    useApprovalSettings (no approval::* RPC) and hides the picker via a new
    showPermissionMode prop on Composer.
  • ConsoleSettingsTab hides the permissions section and skips the config read
    when the gate is absent.
  • real.ts skips the approval::pending-* subscriptions and
    approval::list-pending read when the gate is absent (new
    approvalGateAvailable stream option).
  • Fixed a stale comment in use-harness-status.ts that claimed harness owns
    approval::*.

Behavior: the picker is hidden only when the gate is absent; when present,
nothing changes. Without the gate, function calls run ungated (no approval
prompt), matching how the harness already treats the gate as an optional
pre_trigger hook.

Test plan

Static:

  • tsc -b --noEmit clean
  • biome check clean on all changed files
  • vitest run — 752/752 pass

Live (dev server against a running engine + harness; approval-gate toggled via
iii worker remove/add):

  • Gate present — composer shows manual/auto/full; Configuration shows the
    permissions section; a turn ("reply with one word: pong") streams fine.
  • Gate absent — picker hidden in the composer AND the Configuration
    permissions section; a turn still streams ungated; no "function not
    found"
    in the browser console.
  • Restore — on reload with the gate back, the picker returns.

Note on live flip: the mount probe (engine::workers::list) is authoritative and
hides/shows correctly on every load. Adding the gate live flips the picker on via
the same worker add-event mechanism useHarnessStatus uses for iii worker add.
Re-adding by editing the engine config.yaml directly does not emit that event
(the file-watcher path is silent), so that specific path needs a reload — an
engine event-emission detail, not a console regression.

https://claude.ai/code/session_01Cy5KwY8y2NcPPnyo4LVste

The console gated all approval UI and approval::* RPC on harness
availability, but approval-gate is a separate, optional worker that owns
those functions. Running console + harness without it triggered
"function not found" and rendered a non-functional manual/auto/full
permission-mode picker.

Detect the approval-gate worker independently (useApprovalGateStatus,
mirroring useHarnessStatus) and gate on its presence:

- hide the permission-mode picker in the composer and the Configuration
  permissions section when the gate is absent
- short-circuit useApprovalSettings so no approval::* RPC fires
- skip the approval::pending-* subscriptions and approval::list-pending
  catch-up read in the real backend stream
- when the gate is absent, function calls run ungated

Claude-Session: https://claude.ai/code/session_01Cy5KwY8y2NcPPnyo4LVste
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jun 20, 2026 12:42am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ytallo, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 25 minutes and 48 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ec3a1129-042a-4549-b845-7db7a697c3b5

📥 Commits

Reviewing files that changed from the base of the PR and between 5179186 and 8ae22b6.

📒 Files selected for processing (8)
  • console/web/src/components/chat/ChatView.tsx
  • console/web/src/components/chat/Composer.tsx
  • console/web/src/hooks/use-approval-gate-status.ts
  • console/web/src/hooks/use-harness-status.ts
  • console/web/src/lib/backend/real.ts
  • console/web/src/lib/backend/types.ts
  • console/web/src/lib/conversations-context.tsx
  • console/web/src/pages/Configuration/tabs/ConsoleSettingsTab.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/console-optional-approval-gate

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 24 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

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.

1 participant