Repository navigation
fix(computer-use): stop permission rows timing out on cli start-up - #32218
Conversation
UX Review (Opus 5.5) — ✅ PASSUX-level review of UX-Verdict: PASS Nothing to check. The only [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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of 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
What this change shipsInventory (6 items) — 5 justifiedIntent: 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).
[FIRST-PRINCIPLES-REVIEWED] 91ddaf8 Description read[DESCRIPTION-READ] b7e51c0cd17fce5b1db3b9c68384d84e9bb5c8199a16ef36912153e22157f14f That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the fix goes after the real cause (CLI start-up time eating the 5s budget). It keeps the same Notes
[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 |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
The red on this head belongs to
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. |
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
8160e0b to
91ddaf8
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on 91ddaf8, no conflict, no open change request.
…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)
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 --jsonfrom the same install reports both asgranted.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
kirocrew computer doctorreports, or making it faster.unknown.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.
kirocrew computer doctor --json<gateway python> -P -m kiro_crew.computer_use.permission_probeprobe_permissions()probe_permissions()Symptom.
GET /api/computer-use/configreportsunknownfor both grants, which the panel renders as "Could not check".Cause. The handler ran
kirocrew computer doctor --jsonwith a 5s timeout. A profile of one run spent 4.5s of 5.0s importing modules (kiro_crew.clialone 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 tounknown.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 throughplatform_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 sameprobe_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 inComputerUsePanel.tsxand its test) describe the new child.Backwards compatibility
Compatible: the
GET /api/computer-use/configpayload, the 5s budget andkirocrew computer doctorbehave 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 answersunknown, nevermissing; a real child run, with all three real driver modules imported, never loadskiro_crew.cli,kiro_crew.agentorkiro_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-mthe probe module, never thekirocrewCLI.test_internal_python_isolation.py: the handler's spawn is in the inventory that must route throughisolated_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 loadgroupbesidetest_computer_use_api.pyandtest_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")returnedgranted/grantedin 0.29 to 0.49s at load average 27, where the doctor child took 2.0 to 2.7s on the same tree.granted/granted.Not done: a rendered check of the Settings page in a running gateway. The panel's mapping from
grantedto "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-onlyruns under a 30s budget during an update, off the request pathSibling: 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
-mmodule insteadChecklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributions are accepted under the project's Apache-2.0 license; see the Licensing section of CONTRIBUTING.md.