Repository navigation
fix(cloud): name a refused session manager plugin instead of offering a reinstall - #24863
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS No design-level concerns. The change only alters messages and adds one early return before reinstalling; the provenance check is unchanged. Notes
[DESIGN-REVIEWED] 7ef349b Description read[DESCRIPTION-READ] d9cfd437abfd21adafca382b2d45738d809c37f2274c0d69e555676493b2c080 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS The fix is aimed at the cause: the connect-time paths were missing the refused-versus-missing split. One copy duplication rides along. Notes
What this change shipsInventory (6 items) — 6 justifiedIntent: a user whose Session Manager plugin is refused by the ownership check is told why and how to fix it, not sent into a reinstall loop. FIX (#24781).
[FIRST-PRINCIPLES-REVIEWED] 7ef349b Description read[DESCRIPTION-READ] 901d575aa35e18e23060b95aaca0e01aa48dee3ff264891fa6a676067d4ea8af That sha256 names the PR description this verdict read. 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: |
|
Backend Tests (Windows) (2) is red on test/test_crew_log_fullscan_guard.py::test_a_warm_session_read_that_earns_a_savepoint_reads_only_the_gap ([XPASS(strict)]). This is main's known red, tracked in #24765 with the fix in #24774; this PR does not touch that code. No rerun or new issue; I will rebase once the fix lands. 🤖 AI-assisted comment 🤖 |
876e699 to
6588026
Compare
…tead of offering a reinstall
6588026 to
7ef349b
Compare
|
self-added: yes
🤖 AI-assisted comment 🤖 |
|
self-added: yes
🤖 AI-assisted comment 🤖 |
buluoray
left a comment
There was a problem hiding this comment.
Approving 7ef349b.
A missing plugin cannot be misread as refused: _tool_refusal still returns None both when the resolver accepted a plugin and when it found no candidate at all, and session_manager_plugin_unavailable_message() falls back to the exact old install hint in that case. The new reinstall gate is narrow: it fires only when the refusal carries a remedy command, which _plugin_ownership_remedy produces only for a third-account-owned file inside AWS's own /usr/local/sessionmanagerplugin tree, so a refused copy elsewhere still gets the install offer. The CLI and wizard check installed() first, and the tunnel manager does the filesystem walk off the event loop. The messages are plain sentences naming the file, the reason and the fix, with no traceback, which is what the error-handling spec asks for at a CLI boundary.
Verified locally: the touched cloud and instances tests pass (282), plus 285 in sibling cloud/deploy suites. Making the gate always true, ignoring the remedy, dropping the refusal-None fallback, or reverting require_session_manager_plugin to the install hint each turns a test red. CI is green on this head (91 pass, 16 skipped).
Non-blocking:
- The post-install "still refused" branch in
install_session_manager_pluginisn't covered; removing it keeps the suite green. - The Remote Crew tunnel error is still English prose. The cloud handler already exposes refusal codes, so carrying the code on the tunnel status would let the dashboard render it localized later.
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (8 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: names a found-but-refused session manager plugin and its reason instead of offering a reinstall that rewrites the same file; acceptance unchanged; with tests.
Problem / Motivation
Goal: When Remote Crew or
kirocrew cloudcannot use an installed Session Manager plugin because its file ownership fails the safety check, it says so and names the fix, instead of saying "not installed" and offering a reinstall.On macOS, a plugin file owned by a leftover account (uid 1501 in the report) is refused by the gateway's provenance check. Starting a Remote Crew SSM tunnel then fails with "session-manager-plugin is not installed locally. Install the AWS Session Manager plugin...". The CLI connect/launch flow offers to install it again. Reinstalling and restarting do not help, because the AWS package does not reset the ownership.
Why it matters
Anyone whose plugin tree carries stale ownership (an older, imaged, migrated or MDM-pushed install) cannot connect to Remote Crew, and the product points them at a reinstall loop that can never fix it. The user has to find the ownership cause alone.
Not a goal
kirocrew cloud doctor; both already name a refusal on main.What changed (motivation → approach → change)
Symptom: a found-but-refused plugin is reported as missing when a tunnel starts.
Root cause: the pre-flight and doctor rows were taught to tell "refused" from "missing" (
session_manager_plugin_refusal()), but the paths that run at connect time still only askedsession_manager_plugin_installed()and printed the install hint.Decision: keep the refusal, and make every connect-time path explain it. This is the most conservative fix; it changes what the user reads, never what the gateway trusts.
ssh_tunnel_manager_lifecycle.py)require_session_manager_plugin()(cloud connect)install_session_manager_plugin(), refused in AWS's tree_ensure_session_manager_plugin()incli_cloud.pyandwizard.py, refused in AWS's treeA new helper,
session_manager_plugin_unavailable_message()incloud/ssm.py, builds that message. When the refused file sits in AWS's own install tree it adds the knownsudo chown -R root:<group> /usr/local/sessionmanagerplugincommand, after the same "reinstall it from AWS first if you are not sure" warning the doctor shows. With no fix command, it adds the next step for that refusal code fromREFUSAL_NEXT_STEP. That per-code table moved fromcli_cloud.pyintocloud/ssm.py, so the doctor and this message read the same one. With no refusal it returns the old install hint. The tunnel manager builds it in a worker thread, like the probe before it.The reinstall offer is skipped only when
reinstall_cannot_clear_refusal()is true: the refused file is in AWS's own tree with a known ownership fix, so the installer would rewrite that same file. A refused copy elsewhere (for example a second account's Homebrew) still gets the install offer, because a fresh AWS install in/usr/local/bincan be accepted after it.Backwards compatibility
Compatible: a plugin that is absent still gets the same install hint, and an accepted plugin takes the same path as before; only the refused case reads differently.
Removes nothing: the change adds a message helper and an early return; no key, function, or accepted input is removed.
Tests
test_cloud_ssm.py: a really refused plugin (real resolver walk, refusing validator) makesrequire_session_manager_plugin()name the path and reason. A plugin refused in AWS's tree is not reinstalled; a refusal with no known fix still runs the installer. The helper adds a known remedy and falls back to the install hint.test_unavailable_message_without_a_remedy_takes_the_per_code_next_step: a file another account owns, with no fix command, gets the table'sother_ownerstep; it fails with the old hard-coded sentence put back.test_cloud_cli.py/test_cloud_wizard.py: with a refusal in AWS's tree,_ensure_session_manager_plugin()names it and never prompts or installs.test_instances_ssm.py: a Remote Crew SSM connect with a refused plugin errors with the refusal, not "not installed", and spawns no tunnel.session_manager_plugin_refusaltoNone, so they no longer depend on what the host has installed.Proof: PROVEN test/test_cloud_cli.py::TestEnsurePlugin::test_a_refused_plugin_is_named_not_offered_an_install, test/test_cloud_ssm.py::TestSessionManagerPluginProbe::test_a_refused_plugin_is_not_reported_as_not_installed_at_tunnel_start, test/test_cloud_wizard.py::TestSessionManagerPluginPrereq::test_ensure_session_manager_plugin_names_a_refusal_instead_of_offering_install, test/test_instances_ssm.py::TestSsmTransportSelection::test_ssm_connect_names_a_refused_plugin_not_missing (head 651d26c96140)
test_a_plugin_refused_in_aws_install_tree_is_not_reinstalledcalls a function that is new in this PR, soprove.py's full revert fails it on a missing name and does not count it. Proved by hand instead: withreinstall_cannot_clear_refusal()kept but returningFalse, it fails onassert False is True; on the fix it passes (head 76b84fdae88e). Both proofs ran before the last rebase onto main; the diff is unchanged since.Self-review (local Opus/GPT reviewers could not start: host memory stayed under 1 GB): the provenance check and
resolve_aws_tool_binare untouched, so nothing new is accepted or run. The reinstall offer is dropped only for a refusal inside AWS's own tree, where the installer cannot change ownership; a refused copy elsewhere keeps the offer. Thechownremedy is only printed, never run, behind the same "reinstall from AWS first" warning the doctor uses. The tunnel manager builds the message off the event loop. CI's GPT and Opus lanes are the review of record.Determinism: the new tests passed 20/20 repeats, and in reversed file order. They use
tmp_path, monkeypatched module state and no clocks, sockets or sleeps.Scoped suites run:
test_cloud_ssm.py,test_cloud_ssm_cov80.py,test_cloud_cli.py,test_cloud_wizard.py,test_cloud_connect.py,test_cloud_handlers.py,test_instances_ssm.py(468 passed). isort, flake8, black, mypy and the repo's semgrep rules are clean on the diff.Manual verification
N/A: the refusal is driven by file ownership that unit tests reproduce through the real resolver; no UI was changed.
Related Issues
Closes #24781
Sibling sweep
Swept: git grep -nE "session_manager_plugin_install_hint|session_manager_plugin_installed(" -- src/
Sibling: src/kiro_crew/instances/ssh_tunnel_manager_lifecycle.py -- changed here
Sibling: src/kiro_crew/cloud/ssm.py:566 -- changed here
Sibling: src/kiro_crew/cloud/ssm.py:522 -- changed here
Sibling: src/kiro_crew/cli_cloud.py:635 -- changed here
Sibling: src/kiro_crew/cloud/wizard.py:798 -- changed here
Sibling: src/kiro_crew/cloud/connect.py -- not affected -- calls require_session_manager_plugin, fixed above
Sibling: src/kiro_crew/cli_cloud.py:576 -- not affected -- already names the refusal before the install hint
Sibling: src/kiro_crew/dashboard/handlers_cloud.py:395 -- not affected -- already returns the refusal fields
Pattern harvest
Rule candidate: review-prompt
Pattern: "a probe that has a refused-vs-missing variant, called somewhere that still reports only missing"
Checklist