Repository navigation
feat: show selected-versus-running version skew in kirocrew status - #31331
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item traces to #13086 or to a test that fails on base. The doctor-row and proxy changes ride along but are declared, and the status fallback needs them. What this change shipsInventory (7 items) — 7 justifiedIntent: let an operator see from
[FIRST-PRINCIPLES-REVIEWED] e33ec90 Description read[DESCRIPTION-READ] 22c425b847ce3f5798f6da679f01285d6f1bb0dd7e60c2277b398636629dbaa0 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 version check is additive, Notes
[DESIGN-REVIEWED] e33ec90 Description read[DESCRIPTION-READ] f0824fe382920cc86da441fc79f7c8d1e682d56fded249b91aa46612ad257be8 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: |
3ff7fde to
72aba5e
Compare
|
self-added: no
|
72aba5e to
75965ad
Compare
|
self-added: no
|
75965ad to
45a0f8a
Compare
|
self-added: yes
|
|
self-added: no
|
45a0f8a to
db62a79
Compare
A gateway can keep serving an earlier package after a newer one is selected (an in-place upgrade, a desktop update, a Dev Fleet cutover not yet restarted into), and kirocrew status looked the same either way. status now ends with a Version line comparing the gateway's reported version with the selected package's version read from disk: aligned, or version_skew with both strings and a lower bound on how long they have differed.
db62a79 to
e33ec90
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved for the on-call. Review lanes pass on e33ec90, no conflict, no open change request.
/api/status accepts only a dashboard token, and kirocrew status sent none, so on a default gateway it never printed its stats or the Memory line. On a 401/403 it now mints a one-minute owner token from /api/token/local, as kirocrew token does, and reads /api/status with it, both through the peer-proven transport. When that sign-in is refused it prints the existing token-auth line. Backport note: release's kirocrew status has no Version line (#31331, not on release), so the owner read and _owner_status are added without it: a refused sign-in prints release's two token-auth lines and returns. cli.md takes the new sign-in paragraph without its Version wording and leaves out the Version paragraph edit. (cherry picked from commit 3f3f80f)
Problem / Motivation
Goal:
kirocrew statustells an operator whether the running gateway serves the package selected to run, and if not, which two versions differ and for how long.A gateway can keep serving an earlier package after a newer one is selected: an in-place upgrade under a running gateway, a desktop update that has not restarted it, or a Dev Fleet cutover not yet restarted into. The gateway still answers, so
kirocrew statuslooks the same in both states.kirocrew doctor'srunning:row already compared the gateway with the code the doctor itself imported, but the reporter of #13086 read the status surface and needed a manual process census to see the mismatch.Builds on #17746 by @chenmingwei23.
Why it matters
The two states need different action. When the gateway runs the selected package there is nothing to do; when it does not, the operator has to finish the update or restart the gateway before blaming the selected build for anything they see. Without a signal they cannot tell a finished update from a half-applied one.
Not a goal
kirocrew statuscan read today.kirocrew doctor --bundlehas no running gateway version. Both need their own design, so this PR isPart ofSurface selected-versus-running component version skew #13086, not its close.service.version.What changed (motivation → approach → change)
kirocrew statusends with a newVersion:line:aligned (0.13.0)version_skew for at least 2h 0m: the gateway runs 0.13.0.1, 0.13.0.2 is selected; restart the gateway to run itunknown (the gateway did not report its version; try `kirocrew doctor`)unknown (could not read the selected package's version; check the install)The identity is the string
kirocrew --versionprints,__version__plus anyBUILD_VERSIONstamp, as the reporter proposed: it separates two builds of one release, and it reads the same way in packaged and source installs. Two source checkouts at one version read as aligned; that is the accepted tradeoff.The running side is
/api/status'sversion. When token auth answers that request with 401 or 403, the line still prints: it reads the token-exempt/api/healthversion thatkirocrew doctorreads, through the proxy-freeloopback_urlopen(so a configuredhttp_proxycannot divert it, for either command), with no age, because that reply carries nostart_time. No token is read or sent. The selected side comes from a newlive_target.selected_version()inservice/live_target.py: the pinned Dev Fleet checkout when one is set, else the package thiskirocrewruns. Either way it is read from disk, not taken from the process's own__version__, so an in-place upgrade under a running gateway shows. The age counts from the later of the gateway's start and the newest change time of the pointer and the version files, so it is a lower bound and never overstates. One known limit, written into the spec: after a git auto-update the gateway re-imports its package, so until its restart lands it reports the new version and the line reads aligned.kirocrew doctor'srunning:row now reads the sameselected_version()instead of the version the doctor imported, so the two commands share one definition of "selected" and cannot disagree; before, a pinned checkout at another version made doctor sayrestart neededwhile the gateway already ran the pin. An unreadable selected version printson disk unknownand is not an issue.cli_server.pyprints the line,doctor_checks/services.pyreads the shared value, anddocs/system-specs/modules/cli.mddocuments both.Backwards compatibility
Compatible:
kirocrew statusgains one line at the end; no existing line, key or exit code changes.kirocrew doctor'srunning:row keeps its wording; with a Dev Fleet checkout pinned it now compares against the pin, so it no longer reports a restart that would change nothing.Removes nothing: the diff only adds output.
Tests
test/test_cli_server_version_alignment.py:selected_version()reads a pinned checkout's literal plus itsBUILD_VERSIONstamp; unpinned, it reads the installed package's file rather than the imported__version__; it returns(None, None)for a checkout with no version literal; and an unpin moves its change time.kirocrew statusprintsaligned (0.13.0)when the gateway runs the selected build.0.13.0.1running,0.13.0.2selected) printversion_skewnaming both, aged from the selection's change (persistent skew).unknown, neveraligned._running_gateway_versionreaches a real loopback gateway withhttp_proxyset andno_proxy=localhost, and the proxy sees no request (10/10 repeats).unknownline names the side that could not be read./api/status),kirocrew statusstill prints theVersion:line from/api/health, skew or aligned, with no age.kirocrew doctorreads the pinned checkout's version, the same valuestatuscompares, and reports no restart for a gateway that runs it (red on the parent, which compared the imported__version__); an unreadable selected version printson disk unknownwith no issue.test/test_cli_doctor_gateway_row.pyand the frozen report intest/test_cli_doctor_refactor_report.pypinselected_version()instead of_mc_version.Determinism: 20/20 runs at
-n0; 10/10 at-n 4 --dist loadgroup --max-worker-restart=2withtest/test_live_target.pyandtest/test_live_target_pointer_visibility.pyas co-tenants; a shuffled order (seed 20465) green. The age assertions leave a 60-second margin, and the unpin test stamps the pointer an hour ahead withos.utimerather than racing the filesystem clock.Manual verification
Ran
cli_server._statusfrom this branch on an isolated data home with the realselected_version()and a stubbed/api/statuspayload. A gateway reporting the installed0.13.0printedVersion: aligned (0.13.0); one reporting0.12.0printedVersion: version_skew for at least 1h 18m: the gateway runs 0.12.0, 0.13.0 is selected; restart the gateway to run it(the age is the checkout's own__init__.pychange time). No live gateway was started.Screenshots / video
N/A — no frontend change; the CLI output is shown above.
Related Issues
Part of #13086
Sibling sweep
N/A — not a fix PR.
Pattern harvest
N/A — not a fix PR.
Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.