Skip to content

fix(service): five service install and cli output fixes from the sweep - #33125

Merged
bolichen97 merged 1 commit into
mainfrom
fix/sweep-g1-cli-service
Nov 8, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/sweep-g1-cli-service

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew service install refuses a host systemd did not boot before any sudo prompt, finds the service account when USER is unset, and names the shell variables the service will not inherit; npx MCP servers on Amazon Linux 2 start on a Node that loads; and kirocrew spawn list and subagent errors report a failure plainly and once.

This PR bundles five fixes to kirocrew service install, the gateway it installs, and two CLI outputs. Each one was observed on its own (#33056 lists them with steps):

  • A host systemd did not boot. In a container whose PID 1 is something else, or WSL without systemd, service install asked for sudo, wrote the root-owned unit and the overrides file, and failed only at systemctl daemon-reload. When SUDO_USER, USER and LOGNAME were all unset on a host systemd did boot, it stopped with "Could not determine current user".
  • Amazon Linux 2 and npx servers. The MCP search and runtime PATH put nvm's newest Node first. On glibc 2.26 that Node 22 does not load, so npx MCP servers never started, even with KIROCREW_NODE_BIN_DIR pointing at a Node that does. The installed unit also dropped KIROCREW_NODE_BIN_DIR.
  • Variables the service does not inherit. The AWS container credential variables, the AWS region settings and, under systemd, a fixed-path SSH_AUTH_SOCK from the installing shell never reached the service gateway's MCP servers, cron scripts and agent sessions, and nothing said so.
  • kirocrew spawn list. Every finished run showed the success check mark, failed and stopped runs included.
  • Subagent errors. The KAS engine refusal below its glibc floor showed the same reason and remedy three times in the CLI output, GET /api/spawn and the bell.

Why it matters

  • On a non-systemd host the old install leaves a unit that can never start and gives no hint of what to run instead. An install from an environment that sets neither USER nor LOGNAME failed outright, although it ran as a real account.
  • On Amazon Linux 2 every npx MCP server fails to start, and the operator's own fix (KIROCREW_NODE_BIN_DIR) had no effect on MCP servers.
  • An MCP server that calls AWS or pushes over git ssh works from a shell and fails under the service, with no clue pointing at the service environment.
  • A user reading spawn list takes a failed or stopped subagent for a finished one.
  • A thousand-character error that repeats one sentence three times hides the one thing the reader needs: the remedy.

Not a goal

What changed (motivation → approach → change)

service install refuses a host systemd did not boot before it asks for sudo, instead of leaving a unit that can never start, and takes the service account from the uid when no variable names it. It names the shell variables the service will not inherit, so the operator knows what to copy into .env. On Amazon Linux 2, MCP servers start on a Node chosen for the host (KIROCREW_NODE_BIN_DIR, which the unit now carries, or the glibc-2.17 Node) instead of nvm's newest, which does not load there. kirocrew spawn list shows how each run ended instead of a check mark for every run, and a subagent error states each cause once instead of three times.

Fix Cause Change
Host systemd did not boot systemctl on PATH was the only test, and a container or WSL ships it install() in service/linux_install.py asks sd_booted(3)'s question (/run/systemd/system) first and refuses with nothing written. The marker moves to service/linux_unit.py so install and uninstall read one constant
User= with USER unset _current_user() read only SUDO_USER, USER and LOGNAME It then reads the uid's passwd entry (service/linux_unit.py); uid 0 still resolves to root and is still refused
AL2 npx servers env.augmented_path ranked every version-manager dir newest first and never checked one loads New env_node_pins.py: an executable KIROCREW_NODE_BIN_DIR goes right after this install's own dir, ahead of the inherited PATH too (a copy of it there is dropped, so it never anchors behind nvm's bin), and the glibc-2.17 tree ensure-node.sh unpacks goes just ahead of the version-manager dirs. With the override set, an inherited copy of this install's own dir is dropped too, so a second pass over a PATH augmented_path already built keeps it ahead of the override. service_environment() in service/common.py bakes KIROCREW_NODE_BIN_DIR when env._validated_bin_dir accepts it, the same check the MCP search path applies
Dropped AWS and ssh-agent variables The service starts with service_environment() only New service/inherited_env.py names each variable the shell sets that neither the service environment, ~/.kiro/crew/.env nor, under systemd, /etc/kirocrew/kirocrew.env supplies, leaving out an SSH_AUTH_SOCK at a path agent sessions search themselves; service/controller.py prints it after install, and doctor_checks/services.py prints it in kirocrew doctor, called from cli_doctor.py. That doctor row and the KIRO_API_KEY row beside it build their note before asking for the unit path, so a shell with nothing to report spawns no systemctl --user show
spawn list icon cli_commands_gateway_api.py gave every finished row the check mark _spawn_done_status() reads outcome: completed keeps the check mark, stopped shows a stop icon, anything else a cross with the error on one line. cli_commands.py mirrors the new name
Repeated cause _describe_exception in subagent_parts/run_output.py printed every chain link as Type: message A link whose message (16 characters or more) an earlier link already quotes is named by its class only; a shorter one keeps its text, since it can turn up inside a wrapper by chance

The variable warning prints names only, never values, and its remedy is one && chain: it makes .env mode 0600, ends a last line written without a newline (echo >>), then appends NAME=$NAME lines for the shell to expand, so nothing is appended when the chmod fails. headless_auth_warning prints its KIRO_API_KEY remedy the same way. common._names_defined_in_env_file now reads .env through loader.parse_env_lines, the parser load_credentials() uses, so a later blank NAME= clears an earlier value there as it does at boot; headless_auth_warning reads it too. Neither the warning nor the doctor row can fail an install or a doctor run. Each Node dir counts only when it holds an executable node, and a caller that pins another account's home gets neither, so with no such dir the PATH is unchanged.

The specs and guides describe each change: cli.md and docs/guides/install.md for install, docs/architecture/mcp.md and acp-client.md for the Node order, src/kiro_crew/docs/troubleshooting.md for the variable warning, and subagent.md for the spawn list icons.

Backwards compatibility

Compatible: on a host systemd did not boot the old install could never finish (it failed at daemon-reload after writing the unit), so refusing it first stops nothing that worked. Every other change adds output, adds a PATH entry only when it holds an executable node (an inherited copy of KIROCREW_NODE_BIN_DIR moves to the front instead of staying where it was), or adds an Environment= line only when the installer sets KIROCREW_NODE_BIN_DIR to one absolute dir.

Removes nothing: _SYSTEMD_BOOTED_DIR moves from service/linux_uninstall.py to service/linux_unit.py, and both modules and the service.linux facade still expose it; no function, key or field is removed.

Tests

The full backend and frontend suites run in CI. On a Linux DevSpace (Amazon Linux 2023, not booted by systemd), every other local gate of the profile passed on head b3a4e9f9ab39 (59 gates, plus the flake-pattern ratchet and the diff-scoped semgrep scan, all exit 0). The union of the PR's changed and added test files, the suites of the KIROCREW_HOME change this PR leaves out, and the suites that exercise augmented_path, the doctor rows and the error chain ran on the same head:

PYTHONPATH=src python -m pytest test/test_env_explicit_node_dirs.py test/test_service_environment_node_bin_dir.py test/test_service_inherited_env.py test/test_service.py test/test_linux_facade.py test/test_service_apparmor.py test/test_service_linux_status.py test/test_service_selinux.py test/test_cli_gateway_client.py test/test_subagent_error_detail.py test/test_service_environment.py test/test_service_headless_api_key.py test/e2e/scenarios/test_service_install_dry_run.py test/test_env.py test/test_env_homebrew_keg_node.py test/test_own_kirocrew_link.py test/test_node_toolchain_resolution.py test/test_acp_launch_mcp_path_dirs.py test/test_mcp_gateway_daemon_path.py test/test_cli_doctor_refactor_report.py test/test_cli_doctor_refactor_facade.py test/test_env_file_bom.py test/test_host_isolation_floor.py test/test_subagent_parts_composition_contract.py test/test_acp_client_spawn.py test/test_mcp_resolve_once.py test/test_dev_fleet_node_toolchain.py -n0 -p no:cacheprovider: 1474 passed, 2 skipped, 0 failed. Both skips are the e2e dry-run scenario, which runs only with KIROCREW_E2E_SCENARIOS=1 and needs pods and a systemd user bus.

Rebased onto main after review; git range-diff shows the patch unchanged; related tests re-run on a DevSpace: the same pytest command on the rebased head ed2b35d2df57 exited 0, 1474 passed, 2 skipped, 0 failed.

Determinism, on the same head, for the ten changed and added test files (382 tests; the autouse marker fixture touches every test in the service suites): 20 sequential runs at -n0, 382 passed each time; 10 runs at -n 4 --dist loadgroup --max-worker-restart=2 with the ten files as each other's co-tenants, all green; and one run in a shuffled node-id order (seed 575), 382 passed.

Proof: PROVEN test/test_cli_gateway_client.py::TestSpawnCliAuth::test_spawn_list_failed_run_is_not_shown_as_success, test/test_cli_gateway_client.py::TestSpawnCliAuth::test_spawn_list_stopped_run_is_not_shown_as_success, test/test_cli_gateway_client.py::TestSpawnCliAuth::test_spawn_list_unknown_outcome_is_not_shown_as_success, test/test_cli_gateway_client.py::TestSpawnCliAuth::test_spawn_list_failed_error_prints_no_terminal_controls, test/test_env_explicit_node_dirs.py::TestOverrideLeads::test_every_mcp_composition_inherits_the_override (head 5f36a498a6e6)

With the production hunks reverted, 15 tests fail an assertion, covering all five fixes. The line above names the first five. The others are test_an_override_the_inherited_path_lists_behind_nvm_is_never_an_anchor in test/test_env_explicit_node_dirs.py, test_install_refuses_on_a_host_not_booted_with_systemd and test_current_user_falls_back_to_the_uid_owner in test/test_service.py, test_the_patched_names_are_read_across_the_family in test/test_linux_facade.py, five cases in test/test_service_inherited_env.py, and test_a_cause_its_wrapper_already_quotes_is_named_not_repeated in test/test_subagent_error_detail.py. Five new cases pin a narrower rule inside a fix (the overrides file, an agent socket sessions find again, the socket paths pinned to the resolver, the doctor probe order, a short cause). They pass on pre-PR code, where nothing is reported or deduplicated at all, and each fails with only its own hunk of the fix reverted.

What each test file locks in:

  • test/test_service.py: install refuses a host without /run/systemd/system with no sudo call and nothing written; _current_user() falls back to the uid's passwd entry. test/service_helpers.py and test/test_service_selinux.py point the marker at an existing directory, so the suites that run the real install() keep testing what they test on a runner systemd did not boot; test/test_linux_facade.py covers the moved constant.
  • test/test_env_explicit_node_dirs.py (new): npx resolves to the override, not nvm's newest; every MCP composition inherits it; it leads an nvm dir the inherited PATH lists first; an inherited copy of it behind nvm's bin is never an anchor, so it still leads nvm, appears once, and ~/.local/bin keeps its rank; a pinned home gets none; an unusable override changes nothing; the glibc-2.17 tree ranks ahead of every nvm version; with neither present the PATH is unchanged.
  • test/test_service_environment_node_bin_dir.py (new): an absolute dir is baked; an unset, relative, colon-joined or blank value is not.
  • test/test_service_inherited_env.py (new): install names each dropped variable for systemd and launchd, SSH_AUTH_SOCK under systemd only; a blank value, a name .env supplies, a name the service environment carries and, under systemd only, a name /etc/kirocrew/kirocrew.env sets are not named; an agent socket at a path sessions search is not named, and those paths are pinned equal to the ones _resolve_ssh_auth_sock globs; the inline token is left out when its _FILE form is set; the remedy tightens permissions first, references each variable rather than its value, survives a crew home with spaces, and names an undecodable .env; no dropped variable is baked into the service environment; doctor reports it only for an installed service, and with nothing to report neither doctor row asks for the unit path; a failing check breaks neither install nor doctor.
  • test/test_cli_gateway_client.py: failed, stopped and unknown outcomes are not shown as success, completed is, and a failed run's error prints no terminal controls.
  • test/test_subagent_error_detail.py: a cause its wrapper already quotes is named, not repeated; a short cause that appears in its wrapper by chance keeps its text.

Review round 2 (reviewed locally as 793cbf01b0, then rebased onto origin/main with git range-diff showing the patch unchanged; on the rebased head the ten changed and added test files plus the readers below pass, 437 tests): the printed remedy and both troubleshooting.md examples put echo >> "$P" before the append, and common._names_defined_in_env_file reads the final map. test_remedy_keeps_a_last_line_without_a_newline_whole runs the printed snippet in sh on a .env whose last line has no newline and parses the result; it fails on the previous head and passes here. test_a_name_a_later_blank_assignment_clears_is_still_named fails on the previous head and passes here. inherited_env.py now takes the uid from platform_compat.effective_uid() and splits socket paths with PurePosixPath(...).parts. Run locally: test_service_inherited_env, test_service, test_env_file_bom, test_service_selinux, test_linux_facade, test_service_controller, test_service_headless_api_key and test_flake_pattern_ratchet at -n 2: all passed; flake8, isort, mypy and semgrep exit 0.

Review round 3: test_remedy_appends_nothing_when_the_chmod_fails runs the printed snippet with a chmod that fails and checks .env is unchanged; it fails on the round-2 head and passes here. test_a_second_augmentation_keeps_this_install_ahead_of_the_override augments the PATH twice; it fails on the round-2 head and passes here. Rebased onto main again (patch unchanged by git range-diff); the twelve service, env, cli and subagent test files re-run there: 461 passed.

Review round 4: common._with_home_note is renamed _with_crew_home_caveat. CodeQL's private-data name heuristic read home_no as a home phone number, so every warning joined through it, headless_auth_warning on main included, was flagged as clear-text logging; the text never carried a value. No behavior change; and the service, env, headless, cli and controller suites pass. Round 5: service_environment() validates KIROCREW_NODE_BIN_DIR through env._validated_bin_dir, the same accepted values on POSIX, so test_service_environment_node_bin_dir.py passes unchanged. Reviewed as 5f36a498a6, rebased onto main with the patch unchanged, and the related suites re-run there: 289 passed. Under sudo -E -H both .env warnings name root's file, as headless_auth_warning already does on main: tracked in #33338, not changed here.

End-to-end repro for each fix on the same DevSpace, each from a fresh worktree of head b3a4e9f9ab39:

  • Host systemd did not boot, and User=: exit 0. On this DevSpace, which systemd did not boot, service install refused before any sudo call with "systemd is not running as this host's init system (no /run/systemd/system)" and wrote nothing. With USER and LOGNAME unset, a run inside a rootless namespace that gives the install a /run/systemd/system reached the unit write with User= set to the uid's account.
  • spawn list: exit 0. A subagent the gateway records as outcome='failed' lists as ❌ <id> Reply PONG (failed: kiro_crew.acp.client.AcpAuthRequired: ...).
  • Dropped variables: exit 0. kirocrew doctor and kirocrew service install both name all six variables the unit drops (AWS_CONTAINER_CREDENTIALS_FULL_URI, AWS_CONTAINER_AUTHORIZATION_TOKEN, AWS_REGION, AWS_DEFAULT_REGION, AWS_EC2_METADATA_DISABLED, SSH_AUTH_SOCK), neither report prints a value, and after the printed remedy the repro finds nothing still missing under the service.
  • Repeated cause: exit 0. For a KAS refusal on a host below the engine's glibc floor, the spawn run output, GET /api/spawn and the bell each state the cause sentence once and the remedy once (697 characters in the API, 880 in the bell). An offline engine fetch failure does the same.
  • Amazon Linux 2 Node: not run (ENV_BLOCKED). It needs a glibc 2.26 host; see Manual verification.

Manual verification

The end-to-end runs under Tests are the manual check. The Amazon Linux 2 Node fix was not run end to end: it needs a glibc 2.26 host, and this DevSpace has glibc 2.34, where nvm's Node 22 loads anyway. Its unit tests above pass on this head.

Screenshots / video

N/A: the diff touches no dashboard or website surface. The CLI output is shown under Tests.

Related Issues

Fixes #33056

Sibling sweep

Swept: git grep -nE 'which(\s*"systemctl"' -- src/kiro_crew
Swept: git grep -nE 'environ.get("(USER|LOGNAME)")' -- src/kiro_crew
Swept: git grep -n "_node_all_bin_dirs|def service_path" -- src/kiro_crew
Swept: git grep -n "service_environment(" -- src/kiro_crew
Swept: git grep -n '"✅"' -- 'src/kiro_crew/.py'
Swept: git grep -n "caused by|cause" -- 'src/kiro_crew/
.py'
Swept: git grep -nE 'override_bin_dirs|_own_kirocrew_dirs()' -- src/kiro_crew
Swept: git grep -nE '_names_defined_in_env_file(' -- src/kiro_crew
Swept: git grep -nE 'installed_unit_path()' -- src/kiro_crew/doctor_checks
Sibling: src/kiro_crew/service/linux_install.py -- changed here
Sibling: src/kiro_crew/service/linux_unit.py -- changed here
Sibling: src/kiro_crew/env.py -- changed here
Sibling: src/kiro_crew/service/inherited_env.py -- changed here
Sibling: src/kiro_crew/cli_commands_gateway_api.py -- changed here
Sibling: src/kiro_crew/subagent_parts/run_output.py -- changed here
Sibling: src/kiro_crew/doctor_checks/install.py:378 -- not affected -- the unit path is that check's input, since it reads the program the unit starts
Sibling: src/kiro_crew/service/common.py -- changed here
Sibling: src/kiro_crew/pod/runtime.py -- not affected -- a pod start requires a live user session bus before it writes anything, and its account lookup falls back to the uid
Sibling: src/kiro_crew/doctor_checks/services.py -- not affected -- the pods row probes the user bus next and writes nothing, and its linger check falls back to the uid, which loginctl accepts
Sibling: src/kiro_crew/apps/builtins/dev_fleet/runtime.py:112 -- not affected -- it only marks pods available; a pod start then needs the user bus
Sibling: src/kiro_crew/slack/gateway_runtime/subagent_report.py:131 -- not affected -- it picks the icon from the run's ending, failed and reaped included
Sibling: src/kiro_crew/subagent_manager/monitoring.py:837 -- not affected -- it marks only a run whose result is whole
Sibling: src/kiro_crew/agent_spec_pin_ops.py:335 -- not affected -- it walks the chain only to find one exception type and renders no message
Sibling: src/kiro_crew/browser_harness/chromium.py:402 -- not affected -- it walks the chain only to test for a certificate error and renders no message

Pattern harvest

Rule candidate: review-prompt
Pattern: a status or choice taken from a coarse signal (a run is done, systemctl is on PATH, a version dir is newest) when a precise one is already at hand (its outcome, /run/systemd/system, a Node that loads or that the operator named)

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

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

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision cfa0ad2e93caf10056c20e79b7af1b60a91dbe06 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing blocks: each of the five fixes targets the cause it names, and moving _SYSTEMD_BOOTED_DIR keeps its import path through the service/linux.py facade, so existing readers still work.

Notes

  • Five unrelated fixes ship in one commit. Reverting any one of them (for example the Node PATH reorder in env_node_pins.py, which touches every MCP server's PATH) also reverts the other four. Separate commits would let each be walked back on its own.

[DESIGN-REVIEWED] cfa0ad2

Description read

[DESCRIPTION-READ] 4b900ac67deef293d9b96a93f88863216b463d2b35683776994e39f005d7b1cc

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of cfa0ad2e93caf10056c20e79b7af1b60a91dbe06 — 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

Each fix traces back to a reproduction in #33056. The one second spelling has a stated reason: its re-read skips the cache, which the cached reader cannot do.

Notes

  • Item 3 — duplicate (judgement call): env_node_pins.override_bin_dirs is a second reader of KIROCREW_NODE_BIN_DIR beside env.node_bin_dirs (src/kiro_crew/env.py:494). The grep found 2 readers that both pass the value through _validated_bin_dir and _has_node, and the stated difference is "Read from os.environ on every call rather than through env.node_bin_dirs's process-lifetime cache". Subtraction: if .env loads before the first augmented_path call, use node_bin_dirs()[:1] and delete override_bin_dirs.

What this change ships

Inventory (10 items) — 8 justified

Intent: let an operator install and run the Kiro Crew service on hosts where it now fails silently or misleadingly, and read CLI failures plainly. This is a FIX.

  1. service install refuses a host that systemd did not boot, before any sudo prompt — justified
  2. The service account is taken from the uid's passwd entry when USER and LOGNAME are unset — justified
  3. KIROCREW_NODE_BIN_DIR Node is placed ahead of nvm's newest on the MCP/runtime PATH — duplicate of env.node_bin_dirs override read
  4. The data-home glibc-2.17 Node tree is ranked ahead of the version-manager dirs — justified
  5. The installed unit now carries KIROCREW_NODE_BIN_DIR — justified
  6. Install prints the AWS and ssh-agent variables the service will not inherit — justified
  7. kirocrew doctor prints the same dropped-variable note — justified
  8. spawn list shows a stop or cross icon for stopped or failed runs — justified
  9. A subagent error chain states a repeated cause once — justified
  10. KIRO_API_KEY remedy becomes one && chain; the doctor row skips the unit probe when there is nothing to report; _with_home_note is renamed — rides along, harm-free

[FIRST-PRINCIPLES-REVIEWED] cfa0ad2

Description read

[DESCRIPTION-READ] 871ca8f50fc8102c0d636b0f910c4dd415d226166905af25e0b40cae44719976

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] cfa0ad2

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

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

@github-actions

github-actions Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] cfa0ad2

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

@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 8, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 8, 2026 11:44
@bolichen97
bolichen97 force-pushed the fix/sweep-g1-cli-service branch from ed2b35d to 025a4c7 Compare November 8, 2026 16:42
@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Preserve an unterminated .env assignment when appending span=dd6e5386fd88

fixed in 025a4c7: the printed remedy runs echo >> <file> after the chmod and before the printf, so a last line written without a newline ends before the first copied assignment; a blank line is skipped on read. Both troubleshooting.md examples carry the same line.
Red/green: test_remedy_keeps_a_last_line_without_a_newline_whole runs the printed snippet in sh on a .env ending KEEP=1 with no newline and parses it with parse_env_lines; it fails on ed2b35d (KEEP reads 1AWS_...) and passes on the fix.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 8, 2026
@bolichen97
bolichen97 force-pushed the fix/sweep-g1-cli-service branch from 025a4c7 to db2f18c Compare November 8, 2026 17:10
@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Abort credential copying when permission tightening fails span=dd6e5386fd88

fixed in db2f18c: the printed remedy is one && chain (touch && chmod 600 && echo >> && printf >>), so nothing is appended when the chmod fails; headless_auth_warning and both troubleshooting.md examples are chained the same way.
Red/green: test_remedy_appends_nothing_when_the_chmod_fails runs the printed snippet with a chmod that exits 1 and checks .env is byte-identical; it fails on 025a4c7 and passes on the fix.

@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Repeated augmentation lets the Node override shadow this installation span=6c77ba672fc3

fixed in db2f18c: with KIROCREW_NODE_BIN_DIR set, augmented_path drops inherited copies of this install's own dirs as well as of the override and prepends both in that order, so a second pass over a PATH it already built keeps the own kirocrew ahead of the override's.
Red/green: test_a_second_augmentation_keeps_this_install_ahead_of_the_override augments twice and fails on 025a4c7, passes on the fix.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 8, 2026
@bolichen97

bolichen97 commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Resolve the credential remedy against the service account's home span=dd6e5386fd88

needs-a-decision: under sudo -E -H kirocrew service install the check and the printed remedy name root's .env, while the unit runs as SUDO_USER. common.headless_auth_warning on main resolves .env the same way, so a real fix gives both warnings the unit account's home (linux_unit._current_user / _home_for_user), a new contract between service/common.py and service/linux_unit.py.
Question for a maintainer: fix both warnings here, or track it as a follow-up and accept it on this head. No override is posted.

@bolichen97 bolichen97 added the posix-only-approved Cross-Platform Portability findings reviewed and accepted as intentionally POSIX-only label Nov 8, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: no
resolution: deferred #33338

  • Resolve the credential remedy against the service account's home span=dd6e5386fd88

accepted-and-deferred #33338: common.headless_auth_warning on main already resolves .env with loader.env_path() in the elevated process, so under sudo -E -H both it and this PR's warning name root's file while the unit runs as SUDO_USER. #33338 fixes both warnings together with the unit account's home; this PR keeps main's resolution.

@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] Cross-Platform Portability: added posix-only-approved for the one remaining hit, "/tmp/ssh-*/agent.*" in service/inherited_env.py:_AGENT_SOCKET_GLOBS.

  • It is the Linux ssh-agent socket glob that acp.client._resolve_ssh_auth_sock searches (that function returns early on Windows), and a test pins the two lists equal. A temp-dir helper would make them disagree.
  • It is read only through _found_again, which runs only when the platform is Platform.SYSTEMD; macOS and Windows never check SSH_AUTH_SOCK.
  • The other two hits were fixed in code: the uid now comes from platform_compat.effective_uid(), and paths split with PurePosixPath(...).parts.

@bolichen97
bolichen97 force-pushed the fix/sweep-g1-cli-service branch from db2f18c to ab72d71 Compare November 8, 2026 18:11
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 8, 2026
Five fixes for `kirocrew service install`, the gateway it installs and
two CLI outputs, each found by the sweep and proven on a DevSpace:

- The MCP search and runtime PATH puts KIROCREW_NODE_BIN_DIR first,
  even when the inherited PATH lists it behind nvm's bin, and the
  glibc-2.17 Node ahead of nvm's newest version, and service install
  carries KIROCREW_NODE_BIN_DIR into the unit, so npx servers on Amazon
  Linux 2 run on a Node that loads.
- service install and kirocrew doctor name the AWS container
  credential, region and fixed-path ssh-agent variables the service
  will not inherit, names only, with a 0600 .env remedy, so MCP servers
  and cron scripts no longer fail under the service with no hint.
  doctor builds the note before it asks for the unit path, so a shell
  with nothing to report spawns no systemctl probe.
- service install refuses a Linux host that systemd did not boot (no
  /run/systemd/system) before any sudo or write, and resolves User=
  from the uid when USER and LOGNAME are unset (non-interactive ssh)
  instead of refusing with "Could not determine current user".
- kirocrew spawn list takes a finished run's icon from its outcome: a
  failed run shows a cross with its error and a stopped run a stop
  icon, instead of a success check mark for both.
- A subagent failure names a cause whose text its wrapper already
  quotes by class only, so the KAS engine refusal no longer repeats
  the same remedy three times.
@bolichen97
bolichen97 force-pushed the fix/sweep-g1-cli-service branch from ab72d71 to cfa0ad2 Compare November 8, 2026 18:27
@bolichen97

Copy link
Copy Markdown
Contributor Author

self-added: yes

  • Second check for KIROCREW_NODE_BIN_DIR span=fe3678dcdb55

fixed in cfa0ad2: service_environment() now bakes KIROCREW_NODE_BIN_DIR only when env._validated_bin_dir accepts it, the check augmented_path applies to the same variable, so no second rule remains. The accepted values are the same on POSIX, and test_service_environment_node_bin_dir.py passes unchanged.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 8, 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.

Approving. Review of head cfa0ad2 covered: the systemd check in install() runs before any sudo prompt or write; the passwd fallback still refuses root; augmented_path keeps the override and this install's Node dirs ahead on a second pass; spawn list icons now come from outcome; the first error-chain link keeps Type: message; and the .env name check now uses the same loader.parse_env_lines as the boot load. Mutation runs confirmed the systemd refusal, the uid fallback, the lead ordering and the socket segment check each red their named test.

Security: the new warnings print variable names, the .env path and fixed hint text, never a value. The inline bearer token is left out when its _FILE form is set. The pasted remedy is one && chain that appends nothing if chmod fails, and tests run that chain in sh to prove it. The two clear-text-logging code scanning alerts trace to names only and show as fixed on this PR's merge ref.

Done well: new logic lives in new modules (env_node_pins.py, service/inherited_env.py) instead of growing env.py, and the _booted_with_systemd fixture removes a host dependency from the install suites.

Optional:

  • headless_auth_warning's KIRO_API_KEY remedy chain (service/common.py:296) has no test, so reverting it to the old two-line form reds nothing. Parametrizing the two sh-executing remedy tests over both warnings would pin it.
  • The spawn list fallback for a row with no outcome but an error (cli_commands_gateway_api.py:159) is unpinned. Two small cases would cover it.
  • When service install itself runs under sudo -u, the dropped-variable warning sees the reset environment and prints nothing. This could fold into #33338.

@bolichen97
bolichen97 merged commit df434a0 into main Nov 8, 2026
99 checks passed
@bolichen97
bolichen97 deleted the fix/sweep-g1-cli-service branch November 8, 2026 19:27
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 8, 2026
bolichen97 added a commit that referenced this pull request Nov 9, 2026
#33125)

Five fixes for `kirocrew service install`, the gateway it installs and
two CLI outputs, each found by the sweep and proven on a DevSpace:

- The MCP search and runtime PATH puts KIROCREW_NODE_BIN_DIR first,
  even when the inherited PATH lists it behind nvm's bin, and the
  glibc-2.17 Node ahead of nvm's newest version, and service install
  carries KIROCREW_NODE_BIN_DIR into the unit, so npx servers on Amazon
  Linux 2 run on a Node that loads.
- service install and kirocrew doctor name the AWS container
  credential, region and fixed-path ssh-agent variables the service
  will not inherit, names only, with a 0600 .env remedy, so MCP servers
  and cron scripts no longer fail under the service with no hint.
  doctor builds the note before it asks for the unit path, so a shell
  with nothing to report spawns no systemctl probe.
- service install refuses a Linux host that systemd did not boot (no
  /run/systemd/system) before any sudo or write, and resolves User=
  from the uid when USER and LOGNAME are unset (non-interactive ssh)
  instead of refusing with "Could not determine current user".
- kirocrew spawn list takes a finished run's icon from its outcome: a
  failed run shows a cross with its error and a stopped run a stop
  icon, instead of a success check mark for both.
- A subagent failure names a cause whose text its wrapper already
  quotes by class only, so the KAS engine refusal no longer repeats
  the same remedy three times.

Backport note: release keeps its own longer docstrings and comments,
which main had shortened in docs-only PRs not on release. The new
KIROCREW_NODE_BIN_DIR paragraph and bullet, the systemd-booted refusal
sentence, the one && chain comment, the parse_env_lines docstring and
the KIROCREW_NODE_BIN_DIR clause in acp-client.md are added beside
release's text. Code is as on main.

(cherry picked from commit df434a0)
bolichen97 added a commit that referenced this pull request Nov 9, 2026
#33125)

Five fixes for `kirocrew service install`, the gateway it installs and
two CLI outputs, each found by the sweep and proven on a DevSpace:

- The MCP search and runtime PATH puts KIROCREW_NODE_BIN_DIR first,
  even when the inherited PATH lists it behind nvm's bin, and the
  glibc-2.17 Node ahead of nvm's newest version, and service install
  carries KIROCREW_NODE_BIN_DIR into the unit, so npx servers on Amazon
  Linux 2 run on a Node that loads.
- service install and kirocrew doctor name the AWS container
  credential, region and fixed-path ssh-agent variables the service
  will not inherit, names only, with a 0600 .env remedy, so MCP servers
  and cron scripts no longer fail under the service with no hint.
  doctor builds the note before it asks for the unit path, so a shell
  with nothing to report spawns no systemctl probe.
- service install refuses a Linux host that systemd did not boot (no
  /run/systemd/system) before any sudo or write, and resolves User=
  from the uid when USER and LOGNAME are unset (non-interactive ssh)
  instead of refusing with "Could not determine current user".
- kirocrew spawn list takes a finished run's icon from its outcome: a
  failed run shows a cross with its error and a stopped run a stop
  icon, instead of a success check mark for both.
- A subagent failure names a cause whose text its wrapper already
  quotes by class only, so the KAS engine refusal no longer repeats
  the same remedy three times.

Backport note: release keeps its own longer docstrings and comments,
which main had shortened in docs-only PRs not on release. The new
KIROCREW_NODE_BIN_DIR paragraph and bullet, the systemd-booted refusal
sentence, the one && chain comment, the parse_env_lines docstring and
the KIROCREW_NODE_BIN_DIR clause in acp-client.md are added beside
release's text. Code is as on main.

(cherry picked from commit df434a0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

posix-only-approved Cross-Platform Portability findings reviewed and accepted as intentionally POSIX-only

Projects

None yet

3 participants