Skip to content

fix(computer-use): stop permission rows timing out on cli start-up - #32218

Merged
KiroCrewCaptain merged 1 commit into
mainfrom
fix/computer-use-permission-check
Nov 7, 2026
Merged

KiroCrewCaptain merged 1 commit into
mainfrom
fix/computer-use-permission-check

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Settings > Computer Use shows Granted for the Accessibility and Screen Recording grants a Mac holds, instead of "Could not check".

On a Mac where both grants are held, both permission rows read Could not check. The panel treats that as final, so it stays wrong until the page reloads. Running kirocrew computer doctor --json from the same install reports both as granted.

Why it matters

Every macOS operator who turns on computer use opens this panel to confirm the two grants. "Could not check" tells them nothing, so they cannot tell whether the feature will work, and some go to System Settings to fix a grant that is already there. It shows up most on a busy host and right after the app starts, which is when people are setting the feature up.

Not a goal

  • Changing what kirocrew computer doctor reports, or making it faster.
  • Changing the 5s probe budget, or making the panel poll again after unknown.
  • Gating computer use on the probe: the rows stay advisory.
  • Slimming the macOS driver's own imports.

What changed (motivation → approach → change)

The rows were timing out, not failing. The permission check itself takes milliseconds; starting the whole CLI to run it took most of the 5s the gateway allows.

Before After
Child the Settings GET spawns kirocrew computer doctor --json <gateway python> -P -m kiro_crew.computer_use.permission_probe
What the child loads the whole CLI (about 1,700 modules), plus the chat backend's agent-spec projection the computer-use driver (about 400 modules)
Time on this Mac, warm / cold cache 2.9 to 4.6s / 11.6s 0.3 to 0.5s / 1.8s
Question it asks probe_permissions() the same probe_permissions()

Symptom. GET /api/computer-use/config reports unknown for both grants, which the panel renders as "Could not check".

Cause. The handler ran kirocrew computer doctor --json with a 5s timeout. A profile of one run spent 4.5s of 5.0s importing modules (kiro_crew.cli alone was 3.5s) before the probe ran, and with the feature on the doctor projects the agent spec as well, which the rows never read. On a loaded host or a cold file cache that crosses 5s, the child is killed, and the handler degrades to unknown.

Change. A new module, computer_use/permission_probe.py, prints the driver's permission block as one JSON line. The handler (dashboard/handlers/computer_use.py) spawns it with its own interpreter through platform_compat.isolated_python_argv, so it runs the same install with no PATH lookup. It stays a separate process, so a native fault still costs one row and not the gateway. Both the doctor and the new module ask the same probe_permissions(), so they cannot disagree about a host. The 5s budget, the timeout kill and the payload shape are unchanged.

The computer-use spec, the spawn-audit and Python-isolation inventories, and every comment or help line that said the dashboard runs doctor --json (two of them in ComputerUsePanel.tsx and its test) describe the new child.

Backwards compatibility

Compatible: the GET /api/computer-use/config payload, the 5s budget and kirocrew computer doctor behave as before; only the child the handler spawns differs.

Removes nothing: the only names dropped are the handler's internal DOCTOR_* constants, and their one other reader, test/test_computer_use_api.py, is changed in this diff.

Tests

  • test/test_computer_use_permission_probe.py (new): the child's output parses with the handler's own parser; a driver that cannot be built or probed answers unknown, never missing; a real child run, with all three real driver modules imported, never loads kiro_crew.cli, kiro_crew.agent or kiro_crew.computer_use.cli. The child registers the suite's fake backend before probing, so no test makes a native call.
  • test_computer_use_api.py::TestPermissionProbe::test_a_successful_probe_is_parsed: the spawned argv is this interpreter running -m the probe module, never the kirocrew CLI.
  • test_internal_python_isolation.py: the handler's spawn is in the inventory that must route through isolated_python_argv.

Proof: PROVEN test/test_computer_use_api.py::TestPermissionProbe::test_a_successful_probe_is_parsed, test/test_internal_python_isolation.py::test_every_internal_python_spawn_site_uses_the_shared_isolator (head 91ddaf8)

Determinism: at head 0dc018448235 the new and changed tests passed 20/20 at -n0, 10/10 at -n 4 --dist loadgroup beside test_computer_use_api.py and test_computer_use_unsupported.py, and in a shuffled order (seed 11187). The head since then adds one import line to the child-process test, which passes; the repeats were not re-run locally.

Manual verification

On macOS 26 with both grants held, through the real handler function and the real child (no fake backend):

  • _probe_permissions("macos") returned granted / granted in 0.29 to 0.49s at load average 27, where the doctor child took 2.0 to 2.7s on the same tree.
  • In the installed Nightly bundle, the doctor took 2.9 to 4.6s warm; the driver-only imports this module makes took 1.25 to 1.8s and returned granted / granted.

Not done: a rendered check of the Settings page in a running gateway. The panel's mapping from granted to "Granted" is existing, tested code.

Screenshots / video

Why no screenshot: the two website/ files change only comments; the rows' text comes from the backend payload this PR fixes, verified above.

Related Issues

Closes #32193

Sibling sweep

Swept: git grep -n -E 'isolated_python_argv([^)]"kiro_crew"' -- 'src/kiro_crew/.py'
Swept: git grep -n "_kirocrew_mcp_invocation(" -- src/kiro_crew
Sibling: src/kiro_crew/cli_server_update.py:720 -- not affected -- setup --agent-only runs under a 30s budget during an update, off the request path
Sibling: src/kiro_crew/apps/builtins/dev_fleet/runtime.py:162 -- not affected -- pod verbs are long-running CLI operations, not a fixed-budget probe
Sibling: src/kiro_crew/agent.py:598 -- not affected -- these are long-lived MCP servers started once per session, not a per-request probe

Pattern harvest

Rule candidate: review-prompt
Pattern: a fixed-timeout child that starts a whole CLI verb to read one value; spawn a narrow -m module instead

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|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

Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 7, 2026 08:25
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ✅ PASS

UX-level review of 91ddaf855836d28d32b387936df32225c56b6112 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

UX-Verdict: PASS

Nothing to check. The only website/ changes are comments in ComputerUsePanel.tsx and its test, and the change adds no new user-facing strings or controls. A missing screenshot or blind read leaves no evidence gap here.

[UX-REVIEWED] 91ddaf8

Description read

[DESCRIPTION-READ] db869ac89093ac68c1681333c2b1ddff8301ec2c2bc6fbee59ffbd264a10cf0c

That sha256 names everything this verdict read: the PR description, plus the 3 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 Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 91ddaf855836d28d32b387936df32225c56b6112 — 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 does not.

First-Principles-Verdict: PASS

Nothing blocks. The fix replaces the slow child at the cause (whole-CLI start-up overran the 5s budget) and leaves the probe it asks unchanged. One second spelling of the wire-key mapping rides along.

Notes

  • Item 2 — duplicate of src/kiro_crew/computer_use/permissions.py:119 (probe_dict): probe_payload rebuilds the PermissionProbe→{KEY_ACCESSIBILITY, KEY_SCREEN_RECORDING, KEY_RESPONSIBLE_HINT} mapping. probe_dict's own docstring says that mapping lives in one place, "so the wire key names are stated once, here". A grep for probe_dict\( under src/ finds 0 callers, so after this PR the old spelling has nothing using it and the new one has a single caller. Subtraction: delete probe_dict, or have probe_payload reuse one shared PermissionProbe→dict function, so the keys are written in one place only.

What this change ships

Inventory (6 items) — 5 justified

Intent: a macOS operator wants Settings > Computer Use to show Granted for grants the host holds, not "Could not check". This is a FIX (Closes #32193).

  1. The Settings permission probe spawns python -P -m kiro_crew.computer_use.permission_probe in place of kirocrew computer doctor --json — justified
  2. New permission_probe.probe_payload() maps the backend's probe result to the JSON block — duplicate of permissions.probe_dict key mapping
  3. The probe child is launched through platform_compat.isolated_python_argv and listed in the isolation inventory — justified
  4. DOCTOR_* constants renamed to PERMISSION_PROBE_MODULE / PROBE_TIMEOUT_SECS, with the timeout still 5s — justified
  5. A test pins that the probe child never imports the CLI or the agent-spec writer — justified
  6. Comments, the spec, the spawn audit and the doctor --json help line no longer say the dashboard uses the doctor — justified

[FIRST-PRINCIPLES-REVIEWED] 91ddaf8

Description read

[DESCRIPTION-READ] b7e51c0cd17fce5b1db3b9c68384d84e9bb5c8199a16ef36912153e22157f14f

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 commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 91ddaf855836d28d32b387936df32225c56b6112 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: the fix goes after the real cause (CLI start-up time eating the 5s budget). It keeps the same probe_permissions() question, the out-of-process isolation and the payload shape.

Notes

  • Windows also takes this path, but the timings were only measured on macOS. The spawn goes through the same isolated_python_argv("-P", "-m", …) that embeddings_child.py already uses, so it is unlikely to regress there. A one-line Windows timing in the PR would still close that gap.

[DESIGN-REVIEWED] 91ddaf8

Description read

[DESCRIPTION-READ] 6c79025becfddc5d1f827ebd3f9fba6f1485df250572be24064349d0a1bc286d

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 Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 91ddaf8

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable 91ddaf855836d28d32b387936df32225c56b6112 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 91ddaf855836d28d32b387936df32225c56b6112 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 91ddaf8

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 91ddaf855836d28d32b387936df32225c56b6112 false-positive: <reason, 20 to 500 characters>

@bolichen97
bolichen97 enabled auto-merge (squash) November 7, 2026 08:43
@bolichen97

Copy link
Copy Markdown
Contributor Author

The red on this head belongs to main, not to this PR.

  • Backend Tests (3.12, 2) and Backend Tests (Windows) (2) fail one test: test/test_security_gate_liveness.py::test_the_package_stays_within_its_line_budget (the kiro_crew/security package is 34,855 lines against a 34,845 budget).
  • This PR does not touch src/kiro_crew/security/, and the same test fails on the base commit's own tree (0795ebc479).
  • Coverage Gate fails closed because of that backend red.

The fix is in flight in #32183, which sets the budget to 34,855. This PR waits for it to merge, then rebases onto it.

@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 Nov 7, 2026
Settings > Computer Use read Accessibility and Screen Recording by
running `kirocrew computer doctor --json` in a child with a 5s budget.
The two TCC calls take milliseconds, but the child first imports the
whole CLI (about 1,700 modules) and, with the feature on, projects the
chat backend's agent spec. That measured 2.9 to 4.6s warm and over 11s
on a cold cache, so on a busy host the probe timed out and both rows
read "Could not check" while both grants were held.

The handler now spawns `python -P -m
kiro_crew.computer_use.permission_probe` under the gateway's own
interpreter. The module asks the same `probe_permissions()` the doctor
asks and prints one JSON object, importing only the driver seam (about
0.5s warm). It stays out of process, so a native fault still costs one
row and not the gateway. A test fails if the module loads
`kiro_crew.cli` or `kiro_crew.agent`.

Closes #32193
@bolichen97
bolichen97 force-pushed the fix/computer-use-permission-check branch from 8160e0b to 91ddaf8 Compare November 7, 2026 11:37
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased onto main @ bab2387339, which carries #32252: that PR raised the security package line budget to 34,894 and superseded #32183. The diff is unchanged, and CI is re-running on head 91ddaf8558.

@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 readiness: checking Automated validation is still running labels Nov 7, 2026

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approved for the on-call. Review lanes pass on 91ddaf8, no conflict, no open change request.

@KiroCrewCaptain
KiroCrewCaptain merged commit 1ef44e7 into main Nov 7, 2026
97 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/computer-use-permission-check branch November 7, 2026 12:50
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 7, 2026
bolichen97 added a commit that referenced this pull request Nov 9, 2026
…32218)

Settings > Computer Use read Accessibility and Screen Recording by
running `kirocrew computer doctor --json` in a child with a 5s budget.
The two TCC calls take milliseconds, but the child first imports the
whole CLI (about 1,700 modules) and, with the feature on, projects the
chat backend's agent spec. That measured 2.9 to 4.6s warm and over 11s
on a cold cache, so on a busy host the probe timed out and both rows
read "Could not check" while both grants were held.

The handler now spawns `python -P -m
kiro_crew.computer_use.permission_probe` under the gateway's own
interpreter. The module asks the same `probe_permissions()` the doctor
asks and prints one JSON object, importing only the driver seam (about
0.5s warm). It stays out of process, so a native fault still costs one
row and not the gateway. A test fails if the module loads
`kiro_crew.cli` or `kiro_crew.agent`.

Closes #32193

(cherry picked from commit 1ef44e7)
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.

Computer Use settings show "Could not check" for permissions that are granted

2 participants