Skip to content

fix: update a source checkout by git when no project dir is set - #35607

Merged
bolichen97 merged 1 commit into
mainfrom
fix/34953-update-source-checkout
Nov 12, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
fix/34953-update-source-checkout

Conversation

@bolichen97

@bolichen97 bolichen97 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: kirocrew update on a source checkout updates that checkout from git, even when it is run outside the clone and no project directory was saved.

Run from another directory on a source checkout, kirocrew update printed Install type: source (channel: stable), compared 0.13.0 with the stable feed's 0.12.1 and said Already on the latest version!, while git status in the clone showed ## main...origin/main [behind 2847].

Why it matters

A person running a source install is told they are up to date while their clone is thousands of commits behind, so they never get fixes and have no reason to look. It hits every source install whose shell has no KIROCREW_PROJECT_DIR and whose data home has no saved project_dir file (an install not made by install.sh, or one run under a different KIROCREW_HOME), whenever kirocrew update is run outside the clone.

Not a goal

What changed (motivation → approach → change)

A source checkout updated from outside its clone was checked against the stable release feed and reported as current.

_update picks its path with derive_capability(install_root=KIROCREW_PROJECT_DIR). That variable comes from the shell, the saved project_dir file, or a walk up from the current directory. With none of them it is empty, so the checkout was never probed and the update fell to the release-feed path.

When the variable is unset, kirocrew update now uses the checkout the running package loads from (_bootstrap._source_checkout_root(), the root running_from_checkout already compares against). derive_capability still makes the call: a desktop or container stamp still defers, and a wheel install has no such checkout, so it keeps the feed path. The cli_server.py facade gains the matching TYPE_CHECKING binding, and the CLI spec's Update Command section names the fallback.

Backwards compatibility

Compatible: a set KIROCREW_PROJECT_DIR is used exactly as before; only an unset one on a source checkout now reaches the git path, and a wheel, desktop or container install takes the path it took before.

Removes nothing: the change only adds a fallback for an empty variable.

Tests

  • test_update_wheel_dispatch.py::TestUpdateDispatch::test_a_source_checkout_with_no_project_dir_takes_the_git_path: with KIROCREW_PROJECT_DIR unset and the package's checkout a git tree, _update fetches in that checkout and never calls _update_wheel.
  • test_cli_server_more_coverage.py::TestUpdateWheelDispatch: both tests now state their precondition (no source checkout), because the suite itself runs from one.

Proof: PROVEN test/test_update_wheel_dispatch.py::TestUpdateDispatch::test_a_source_checkout_with_no_project_dir_takes_the_git_path (head d77c5ff)

Manual verification

Ran this branch's kirocrew update from a directory outside the clone, with KIROCREW_PROJECT_DIR unset and an empty isolated KIROCREW_HOME: it printed the checkout's path and started git fetch (which then failed on purpose, because the branch has no upstream yet), where the base printed Install type: source (channel: stable) and checked the feed.

Related Issues

Closes #34953

Sibling sweep

Swept: git grep -nE 'environ.get("KIROCREW_PROJECT_DIR"|derive_capability)|derive_capability()' -- src/kiro_crew/cli_server_update.py src/kiro_crew/cli_doctor.py src/kiro_crew/dashboard/handlers src/kiro_crew/platform src/kiro_crew/doctor_checks
Sibling: src/kiro_crew/cli_server_update.py:256 -- changed here
Sibling: src/kiro_crew/dashboard/handlers/updates_check.py:468 -- tracked in #35472
Sibling: src/kiro_crew/dashboard/handlers/updates_apply.py:393 -- tracked in #35472
Sibling: src/kiro_crew/dashboard/handlers/updates_step_up.py:230 -- tracked in #35472
Sibling: src/kiro_crew/platform/update_layout.py:271 -- tracked in #35472
Sibling: src/kiro_crew/platform/update_capability.py:415 -- tracked in #35472
Sibling: src/kiro_crew/cli_doctor.py:731 -- tracked in #35472
Sibling: src/kiro_crew/doctor_checks/install.py:622 -- not affected -- the Project row only displays a directory; it chooses no update path
Sibling: src/kiro_crew/dashboard/handlers/updates_channel.py:200 -- not affected -- it only looks for CHANGELOG.md and falls back to the bundled copy
Sibling: src/kiro_crew/dashboard/handlers/core_stt_settings.py:593 -- not affected -- it only looks for the ffmpeg build script

Pattern harvest

Not generalizable: one dispatch read an optional environment variable as the only way to find its own checkout, and the checkout already has a single resolver it now falls back to.

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 11, 2026 21:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 11, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) November 11, 2026 21:47
@bolichen97
bolichen97 force-pushed the fix/34953-update-source-checkout branch from 0063e62 to 2fe8abd Compare November 11, 2026 23:26
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in src/kiro_crew/cli_server.py, which conflicted with this head after #35088 merged (ee7a026 -> bb7048c); CI re-running.

[operator: bolichen97]

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision d77c5ffca2890885ad7db72b530b7cc8437733f4 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 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Narrow fallback to the existing checkout resolver; derive_capability still decides the path, so desktop, container and wheel installs route exactly as before.

Notes

[DESIGN-REVIEWED] d77c5ff

Description read

[DESCRIPTION-READ] e48e0566823f28070806b3183450236b48aee1776b0d052a4bb8f4a5503c0fd4

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

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

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

Nothing blocks. The fix reuses the existing checkout resolver, and the six sibling readers it leaves alone are declared and deferred to #35472.

Notes

What this change ships

Inventory (5 items) — 4 justified

Intent: a person on a source install runs kirocrew update from outside the clone and gets a git update instead of a false "Already on the latest version!" — FIX (#34953).

  1. kirocrew update run outside the clone with no saved project dir now updates the running checkout by git — symptom-level (6 siblings deferred to On a source install, the gateway's update check and Update read only KIROCREW_PROJECT_DIR to find the checkout #35472)
  2. The CLI spec's Update Command section names the fallback to the running package's checkout — justified
  3. cli_server facade gains a type-checking binding for _source_checkout_root — justified
  4. _update_wheel docstring now says the path is chosen by derive_capability — justified
  5. Two wheel-dispatch tests now state that no source checkout is present — justified

[FIRST-PRINCIPLES-REVIEWED] d77c5ff

Description read

[DESCRIPTION-READ] 6930d18b5a17739bfd53a9b68679ecca21464b4f9f19ddc53cbe24380715b93f

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

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] d77c5ff

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

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

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] d77c5ff

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

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 11, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

[operator: bolichen97] The red Backend Tests shards (3.12, 5), (3.12, 6), (Windows) (2), (Windows) (4) and the Coverage Gate on 2fe8abd are main's, not this PR's: the same two tests fail on main's own push run at d80dd05 (run 43117490567), and this diff touches neither file.

  • test/test_wait_discipline_ratchet.py::test_the_scan_matches_known_sites (test/test_update_boot_apply.py:335 wait_for(10s))
  • test/test_updates_handlers_facade.py::test_every_name_served_from_outside_the_family_is_visible_to_type_checkers

Tracked in #35660; fixes in flight: #35625 and #35614. This PR waits for them, then re-syncs onto the main that carries the fix.

@buluoray buluoray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve on 2fe8abd. With no project directory set, kirocrew update on a source checkout now updates the checkout that the running code loads from, instead of checking the release feed and wrongly saying it is current. The fallback path is the same one that running_from_checkout already compares against, so the capability check still decides who owns the update: desktop and container installs still defer, and a wheel install has no such checkout and keeps the feed path. Every existing guard on the git path still runs before the hard reset. These guards refuse a diverged checkout, ask before discarding tracked edits, refuse when untracked files would be overwritten, and check the source pin and the repo's exec config. The new test fails when the fallback is removed. The only red backend shards fail on two tests that already fail on main. Decisive lines: src/kiro_crew/cli_server_update.py:256, src/kiro_crew/platform/update_capability.py:451, src/kiro_crew/platform/update_capability.py:295, src/kiro_crew/cli_server.py:837, test/test_update_wheel_dispatch.py:658

@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 12, 2026
Run outside its clone with no saved project dir, a source install has no
KIROCREW_PROJECT_DIR, so `kirocrew update` treated it as a release
install, compared its version with the stable feed and reported
"Already on the latest version" while the clone was far behind origin.
The update now falls back to the checkout the running package loads
from; derive_capability still decides who owns the update.

Closes #34953
@bolichen97
bolichen97 force-pushed the fix/34953-update-source-checkout branch from 2fe8abd to d77c5ff Compare November 12, 2026 08:59
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in test/test_update_boot_apply.py and src/kiro_crew/dashboard/handlers/updates.py, which carry the fix (#35625) for the red Backend Tests and Coverage Gate on the previous head, and in test/test_cloud_launch_customize.py, which carries the fix (#35746) for a red main gained after this head ran (bb7048c -> 2f7e9f2); CI re-running.

[operator: bolichen97]

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 12, 2026
@bolichen97
bolichen97 merged commit cc2689f into main Nov 12, 2026
97 checks passed
@bolichen97
bolichen97 deleted the fix/34953-update-source-checkout branch November 12, 2026 09:56
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On a source checkout of main, an interactive kirocrew update checks the stable channel and wrongly says it is up to da

2 participants