Skip to content

Pause a Claude seat's Kindex status call until Dash approves it - #173

Open
shanebarakat wants to merge 2 commits into
mainfrom
dash-permission-gate
Open

shanebarakat wants to merge 2 commits into
mainfrom
dash-permission-gate

Conversation

@shanebarakat

@shanebarakat shanebarakat commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

First Dash-owned permission decision, as Jeremy asked: a Claude seat's read-only Kindex status call pauses, the exact request shows in Dash, and the call runs once after a passkey approval.

What changes

  • harness/dash_gate.py (new, stdlib only): a PreToolUse hook. It asks Dash for an approval bound to the run, seat and exact call (tool_use_id as intent, sha256 of tool name + input as the effect digest), waits for the decision, redeems it for this seat's session, then allows. A repeat of the same call, a stale session, a denial, an expiry, or Dash being unreachable all deny.
  • harness/native_session.py: when the host sets FACTORY_DASH_URL at lane launch, the Claude lane's settings get that one hook, matched only to mcp__.*kindex__status. Unset (the default), settings are byte-for-byte unchanged.

Checks

  • tests/test_dash_gate.py (7 tests): flag off gives exactly today's settings bytes; flag on gates only the Kindex status call; approve runs once and a repeat is denied; denied or undecided never runs; a stale session can't redeem; an unreachable Dash denies. Two negative controls (allow without Dash; gate always on) both fail the suite.
  • Full suite: every failure is in 9 files that fail the same way on clean origin/main on this machine (direnv blocks the tests' bash subprocesses). Side by side in the same clean env: base 75 failing ids, this branch 74, none only on this branch.
  • End to end against the real Dash approval code (wandercom/dash PR Clarify license terms explicitly. #1 plus a local demo server): pause, exact request in Dash, passkey approve, resume, one call; repeat denied; denied never runs; old session refused after reassignment. A real Claude Code client also paused on its real mcp__kindex__status call until approval, then got the result, and Dash recorded the approval redeemed once.

Not covered

  • A real phone on cellular, a staging host, and real Dash identity (the gate uses the local demo's dev header). Those wait on Devon's staging check and Dash's authenticated routes.
  • Antigravity's own "Allow calling this tool?" prompt. Claude seats come first because they have a working hook.

Show it working
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

When the host sets FACTORY_DASH_URL at lane launch, a Claude lane's settings get
one PreToolUse hook for the read-only Kindex status tool. The hook asks Dash for
an approval bound to the run, seat and exact call, waits for a passkey decision,
redeems it for this seat's session, and only then allows the call. A repeat of
the same call, a stale session, a denial, an expiry or Dash being unreachable all
deny. Unset, lane settings are byte-for-byte unchanged.

@adaptcom adaptcom Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confidence Score: 4/5

Summary

Opt-in PreToolUse hook that pauses a Claude seat's Kindex status call until Dash approves and redeems it once. Flag-off path is byte-identical, tests and all repo gates pass; remaining items are fail-closed hardening gaps.

Important Files Changed

File Overview
harness/dash_gate.py New stdlib hook: request, poll, redeem against Dash; any exception denies
harness/native_session.py Merges the gate hook into Claude lane settings when FACTORY_DASH_URL is set
tests/test_dash_gate.py FakeDash server covers flag off/on, once-only redeem, deny, stale, unreachable

Findings

  • harness/dash_gate.py is absent from the Makefile lint and typecheck file lists, so CI never runs ruff or mypy on the hook; add it (both are clean today).
  • wandercom/dash PR #1's worker returns 404 for /approvals*, so the paths, x-dash-actor header and 409 semantics the gate depends on exist only in an unversioned local demo; check that contract in somewhere testable.

Reviewed c5d2499...516aabe · ↻ Re-run review · View in Adapt

Comment thread harness/dash_gate.py Resolved
Comment thread harness/dash_gate.py Resolved
Comment thread harness/dash_gate.py Resolved
Comment thread harness/dash_gate.py Resolved
Comment thread harness/dash_gate.py Resolved
Comment thread harness/dash_gate.py Resolved
Comment thread harness/native_session.py Resolved
- PreToolUse entry sets onFailure: block, so a crashing or stalled gate blocks.
- One deadline starts before the first request and bounds every request and
  poll, so the gate always answers before Claude Code's hook timeout.
- Run and seat names are checked at launch; an invalid name refuses to enable
  gating with a clear message.
- The call is allowed only when Dash confirms the approval was redeemed.
- A refused redemption (stale lease or expiry) gets its own deny reason.
- A call without a tool_use_id gets a nonce so identical calls stay distinct.
- docs/HARNESS.md describes FACTORY_DASH_URL and its demo-only identity.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant