Repository navigation
Conversation
9f85e22 to
874ef4f
Compare
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the per-user task with a repeating trigger and Notes
[DESIGN-REVIEWED] 0198bcc Description read[DESCRIPTION-READ] 058df02fce368fb7cbea3ea6b921ddbf7b1a650b43775c31678b5b47784f16ef 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, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks: the backend is an opt-in fix for #6590, which was reported and reproduced on a live host. Three small parts of it could be deleted. Notes
What this change shipsInventory (9 items) — 6 justifiedIntent: bring a Windows gateway back after the watchdog ends it, without a human noticing first — FIX.
[FIRST-PRINCIPLES-REVIEWED] d1c6b10 Description read[DESCRIPTION-READ] 634c5c5ef036ec27c6a49893faa27381f061deeab74512a644c3c023568a170a That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review (fork) — 🔴 changes requested (blocking)Reviewed Adjudication upheld 2 of 2 blocking finding(s); those must be resolved before merging. BLOCKING -- src/kiro_crew/service/windows.py:839 -- Probe the configured listener instead of assuming IPv4 loopback
BLOCKING -- test/test_service_windows.py:498 -- Isolate the user-script lookup in the fallback test
[BLOCK-MERGE] 0198bcc Adjudication (Opus 5.5) — is blocking on each finding proportionate?F1 — MEDIUM: an operator who sets F2 — LOW: a false test failure on Windows developer hosts that have a |
Opus 5.5 Review (fork) — 🔴 changes requested (blocking)Reviewed
BLOCKING — src/kiro_crew/service/controller.py:304 Trigger: The operator runs |
12e009b to
4e83fcf
Compare
4e83fcf to
e303e07
Compare
e303e07 to
9118db8
Compare
9118db8 to
bb4a13a
Compare
4a1d532 to
e6a8de3
Compare
|
self-added: no
|
|
|
|
|
e6a8de3 to
ddbe30b
Compare
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
self-added: no
|
|
The reds on d1c6b10 are not caused by this change:
A new head is pushed with the review fixes, so all of these run again. |
|
Validated the Windows log fallback at the current PR head (0198bcc) against upstream/main 341d05c. |
Problem / Motivation
Goal: On Windows,
kirocrew service installregisters a per-user Task Scheduler task that brings the gateway back after the loop-stall watchdog terminates it, as systemd and launchd already do.The loop-stall watchdog is designed to terminate the gateway:
faulthandler.dump_traceback_later(..., exit=True)calls_exit(1)afterwriting its dump. On Linux systemd brings it back, on macOS launchd does, and
on Windows nothing did.
kirocrew service installanswered "only supported onLinux (systemd) and macOS (launchd)".
So on Windows a process designed to exit was paired with no supervised
lifetime. The gateway did not crash-loop; it stopped and stayed stopped until a
human noticed, with channels silent and cron not firing. Reported as
#6590.
Why it matters
This is the failure mode with no symptom. A crash loop is visible. A gateway
that exited cleanly at 3am and was never restarted looks, from every surface an
operator checks, like a quiet night.
Not a goal
installed_unit_path()still answersNonehere.What changed (motivation → approach → change)
Windows gets a third service backend beside systemd and launchd.
kirocrew service install,start,stop,restart,statusanduninstallnow work there, with no elevation, through a per-user task at\KiroCrew\gateway.The task supervises through its triggers, not through
RestartOnFailure. A live Task Scheduler showed that a task whose action exits 1 is never restarted byRestartOnFailure; a trigger that repeats every minute with no end, plusIgnoreNew, starts a fresh gateway within the minute and never doubles a healthy one. A time trigger starting at install arms that repetition at once, and the logon trigger re-arms it after each sign-in.service/windows.pyschtasksprose: absence is confirmed by the task's own path missing from an answered task list.stopdisables the task so the next tick cannot undo it.restartleaves alone a gateway that still serves the port after/End, since that one is not the task's.stopasks whether anything still holds the port the client resolver names;statusandrestartask a stricter question, whether this install's gateway is serving: its run marker names a live pid and/api/readyanswers 200. The task runs thekirocrewconsole script (next to the interpreter, else in the per-user Scripts dir apip install --userfills) withgateway --no-open, as the systemd unit and launchd plist do. Install refuses a relativeKIROCREW_HOME, which the task would resolve again from inside the data home, and refuses whenKIROCREW_HOME,KIROCREW_PORTorKIROCREW_KIRO_BINdiffer between this shell and the persistent environment a logon would build (the user value, else the machine value, withREG_EXPAND_SZexpanded). The prior readback copy is read without following a link, hardlink or oversized file; such a copy stops the install before anything is written.service/common.pycurrent_platform()answersSCHTASKSon Windows only whenschtasks.exeresolves through the trusted system path, never PATH.RestartReportgainsunmanaged_gateway.service/controller.pyunmanaged_gateway. A restart counts only once the relaunched gateway reports ready within 60 seconds, else it reportsRESTART_NOT_UPpointing atkirocrew logs, as the systemd path does for a unit that does not stay up.service statusexits 0 only with the task installed and this install's gateway serving.cli_server_restart.pyunmanaged_gateway, so a foreground gateway beside a stopped task is restarted instead of exiting 1.cli_server.pykirocrew logskeeps its built-in reader on a Windows host with the service backend, instead of runningtail, which Windows does not have.docs/guides/windows-install.mdgains a row forkirocrew service install/status/uninstallandkirocrew stop/restart. The newschtaskschokepoint is listed in the spawn audit table, andservice/common.pyleaves.github/black-baseline.txtbecause it is now black-clean.Backwards compatibility
Compatible: Linux and macOS paths are unchanged; on Windows,
kirocrew serviceverbs that used to exit 2 as unsupported now run.Removes nothing: the diff only adds a backend, a platform value and a report field that defaults to off.
Tests
test/test_service_windows.py: the rendered document (both triggers repeat with noDuration, the time trigger starts at install,PT0Stime limit, battery settings off,IgnoreNew, a hostile username cannot break the XML), the--no-openlaunch arguments, the probe followingKIROCREW_PORT, every verb's exit-code handling, confirmed absence (an answered list without the task, a refused list, a listed task whose query was refused, a similarly named task), restart leaving a foreground gateway alone, the trusted-path staging, the environment refusal, the persistent lookup (expansion, machine fallback, user precedence, an unreadable key failing closed), a relativeKIROCREW_HOMErefused even when persisted, the per-user Scripts console script chosen over the-Ifallback, a linked, hardlinked or oversized readback copy refusing before anything runs,is_servingneeding a live recorded pid and a 200 from/api/ready, and that a failed readback or staging write registers nothing and leaves no stale readback copy.test/test_service_controller.py: scheduler refusals degrade to the foreground fallback, a refused restart reportsRESTART_REFUSED, a restart whose gateway never reports ready reportsRESTART_NOT_UP, status exits 1 when only another program holds the port, a gateway the task does not own goes to the foreground path withunmanaged_gatewayset,service statusexits 1 without a task, and a stop that did not reach the gateway is not claimed.test/test_cli_restart.py: a report withunmanaged_gatewayset takes the foreground restart path even while an installed service reads active.test/test_service.py: platform detection with and without a trustedschtasks.exe.test/test_windows_logs_and_diagnostics.py: the log-reader tests run for bothUNSUPPORTEDandSCHTASKS, sokirocrew logson either never reachestail.Determinism: the port-release wait runs on a
ManualClock, and no test reaches a real socket orschtasks.exe.Manual verification
From the original author, against a live Task Scheduler on Windows 10 Pro 19045, using the module's own render and
_schtaskspath with a stub in place of the gateway. The UTF-16 definition was accepted by/Create /XML, and every setting above survived a/Query /XMLround trip.RestartOnFailurePT1M x3RestartOnFailurePT1M x3RepetitionPT1MIgnoreNewdropped every tick while a stub held the slot, and the next tick after it exited started a fresh instance.stop()silenced a repeating task for the next two ticks.Still unverified on a live host: the install-time
TimeTrigger, the task-list absence check, a second Windows build (11 or Server), andDisallowStartIfOnBatterieson a host with a battery.Related Issues
Part of #6590
Checklist