Repository navigation
fix(dev-fleet): stamp the revision an artifact was built from - #22686
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
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: |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Every item exists to remove the stale-bundle boot in #10459. The dist check reuses the existing What this change shipsInventory (10 items) — 8 justifiedIntent: make
[FIRST-PRINCIPLES-REVIEWED] f513d59 Description read[DESCRIPTION-READ] a35605b04e247dfde7bab8e4257b9905234adce72f81f11474574c2c08ed6ace 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 stricter Notes
[DESIGN-REVIEWED] f513d59 Description read[DESCRIPTION-READ] 8e2f4b5d918b80eab87b4e3168528dc126221e4fe6eb020aa2f265da530d6106 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: |
38f0613 to
7e5ed1f
Compare
7e5ed1f to
04b2b39
Compare
04b2b39 to
b2578bf
Compare
b2578bf to
6cc62ac
Compare
6cc62ac to
e082370
Compare
e082370 to
a9447ff
Compare
a9447ff to
001c288
Compare
|
Hold at The r136 defect is fixed. What still needs a human: this PR adds two gateway git spawns to the AI findings judged non-blocking:
— crew-pr-reviewer (r141) |
|
@iamwhatever, could you take another look when you have a moment? Your requested change looks addressed at 397b8da: |
397b8da to
bd9829f
Compare
|
|
@iamwhatever — your request-changes review at 95d7ec8 is still answered as below, now on head bd9829f (a rebase onto current main, which had conflicted). fixed (carried unchanged into bd9829f):
Rebase: still one commit, same six files. The only conflict was a comment in |
|
|
|
|
|
|
|
|
|
|
bolichen97
left a comment
There was a problem hiding this comment.
Approved at a4f7f1b.
has_venv / has_dist / _has_node_modules now mean "present and built from the current build input" instead of just "present":
- venv: the inputs are the
pyproject.tomlandsetup.cfgoids. node_modules: the inputs arewebsite/package-lock.jsonandwebsite/package.json. Both are stamped in a per-worktree manifest undergit rev-parse --git-path, sogit statusstays clean. - dist: it gets no manifest key.
has_distcompares the dist's ownbuild-id.json/kirocrew-build-source.txt(read through the now-sharedstale_bundle_guard.read_dist_tree) withHEAD:website. - Build order: inputs are captured before the build, and the old stamp is cleared before the first mutating step. Each build path revalidates after stamping, so a rebase mid-build reads stale instead of certified.
- Fallbacks: a non-git tree, no trusted git, or an untracked input falls back to presence-only. The primary checkout's venv is probed with
require_stamp=False, because Pull + Build rebuilds it without stamping. - Manifest writes: a manifest that exists but can't be read is never overwritten with one that has lost the other stamps.
The open request-changes point from iamwhatever is fixed. _manifest_path now runs git with env=hardened_git_env() like _resolve_oid, and test_inherited_git_dir_cannot_redirect_the_manifest covers it. Both new spawn-audit rows run a trusted absolute git with constant argv under the hardened env. There is no regex.
CI: all 104 checks are green on this head. macOS shard 2 was cancelled on a test timeout and passed on rerun.
… presence
Provisioning checked only whether a venv/node_modules/dist EXISTED, never
which revision it was built from, so any operation that rewrites a worktree's
tracked content (a rebase or sync pulling a package-lock.json bump, an
Advance re-run past its early-return) left the tree reporting itself
provisioned while its artifacts belonged to the prior revision -- and a
`pod up` booted on that stale bundle.
Record each artifact's BUILD INPUT oid in a per-checkout manifest and make
has_venv / has_dist / _has_node_modules mean "present AND built from the
current input". Staleness is keyed on the input, not HEAD, so a commit that
changes neither input (a doc edit) leaves the artifacts current and does not
force a needless multi-minute rebuild:
- venv -> HEAD:pyproject.toml (an editable install only restales
when pyproject moves)
- node_modules -> HEAD:website (the tree the lockfile/deps live in)
- dist -> HEAD:website (the SPA source tree)
The input oid is captured BEFORE each build and stamped afterward, so a
revision that advances during a build leaves the artifact correctly stale
rather than certified against the post-build HEAD. An unresolvable input
(non-git tree, or no trusted git) defers to presence-only, so a tarball
install keeps reporting what it has.
- git is resolved to a trusted absolute executable
(platform_compat.trusted_system_bin_quiet), never the service PATH, which
leads with agent-writable dirs; an untrusted/absent git makes the input
unresolvable rather than spawning a possibly-planted shim.
- The manifest lives inside the git directory (git rev-parse --git-path),
not the working tree, so it never dirties a rebase/prune and needs no
ignore rule -- a worktree whose revision predates this change is not
dirtied by a provision.
This closes the rebase/sync invalidation gap and the Advance re-entry gap
without a hand-maintained input map. The _BUILD_INPUTS map the original
issue proposed retiring is not present on main (it lived only on the
closed-not-merged #10066), so there is nothing to remove.
Fixes #10459
|
|
|
|
|
|
@iamwhatever — your request-changes review at 95d7ec8 is still answered as below, now on head f513d59 (a rebase onto current main). fixed (carried unchanged into f513d59):
Rebase: still one commit, same six files. The only conflict was a comment in |
bolichen97
left a comment
There was a problem hiding this comment.
Approving f513d59 with auto-merge. I re-read the whole diff on this head, tests and docs included. iamwhatever approved this head at 05:35, so the points from the 10-30 review are settled.
has_venv/has_dist/_has_node_modulesnow mean "present and built from the current build input":pyproject.toml+setup.cfgfor the venv,website/package-lock.json+package.jsonfornode_modules, andHEAD:websiteagainst the dist's ownbuild-id.jsonread throughstale_bundle_guard.read_dist_tree.- The input oid is captured before the build and the old stamp is cleared before the first mutating step, so a mid-build rebase or an interrupted install cannot certify a stale tree. Both are tested.
- The manifest lives in the git dir,
gitis resolved only throughtrusted_git_binunderhardened_git_env, and a non-git tree or missing trusted git falls back to presence-only. The main checkout's venv usesrequire_stamp=False, since Pull + Build never stamps it. - No regex in product code. All 98 checks on this head are green and the PR is clean to merge.
Problem / Motivation
Goal: make Dev Fleet provisioning report an artifact as provisioned only when it was built from the revision now checked out, so
pod upnever boots on a stale venv /node_modules/ dist.Provisioning reported whether an artifact EXISTS, never which revision it was
built from:
has_distwasdist_dir(checkout).is_dir(),has_venva barebinary-presence check. So any operation that rewrites a worktree's tracked
content (a rebase or sync pulling a
package-lock.jsonbump, anAdvancere-run past its early-return) left the tree reporting itself provisioned while
its artifacts belonged to the prior revision — and a
pod upbooted on thatstale bundle.
Why it matters
A pod booted on a stale bundle serves one revision's frontend against another's
backend (or an editable install /
node_modulesfrom before a dependency bump),which fails silently: the dashboard renders, so the gap only surfaces as a
confusing behavioural mismatch. The existing
_rebase/sync andAdvancere-entry paths all reproduce it.
Not a goal
pod_up/pod_downsurface, or thesystemd unit.
_BUILD_INPUTSmap the original issueproposed retiring is not on main — it lived only on the closed-not-merged
feat(dev-fleet): pin a worktree to the stable release channel #10066 — so there is nothing to remove.)
(
pod upalready tells the user to re-run--provision).What changed
The presence checks now mean present AND built from the artifact's current
build input, keyed on the input (not HEAD), so a commit that changes no input
leaves the artifact current and forces no needless rebuild.
venvpyproject.toml+setup.cfgblob oids (deps are dynamic; the realinstall_requireslive insetup.cfg)node_moduleswebsite/package-lock.json+website/package.jsonblob oids (npm ciinstalls the lockfile and refuses one out of step withpackage.json)distHEAD:websitetree oidbuild-id.jsonthe dist carrieswebsite/vite.config.ts'sbuildIdPluginalready writes theHEAD:websitetree id as
websiteTreeinto the dist'sbuild-id.jsonon everyvite build(provision's own and the Dev Fleet sync's), and
frontend._write_build_source_fingerprintwrites the same id beside a synceddist.
has_distreads that record throughread_dist_treeindashboard/stale_bundle_guard.py— the one reader of those stamps,which takes the dist directory as an argument — and compares it to the current
HEAD:website.A separate manifest key would have drifted — the sync path rebuilds the dist
without touching a manifest.
BEFORE building and stamps it on success into a per-checkout manifest; the
check compares that stamp to the input's current oid. Capturing before the
build means a revision that advances during the build leaves the artifact
correctly stale, not certified against the post-build HEAD.
trusted git) → presence-only, so a tree with no resolvable revision keeps
reporting what it has.
without writing the stamp and pods never run there, so the Fleet poll calls
has_venv(path, require_stamp=False)for theis_mainrow; every otherworktree keeps the stamp requirement.
gitis resolved to a trusted absolute executable(
platform_compat.trusted_git_bin, underhardened_git_env), never theservice PATH, which leads with agent-writable dirs; an untrusted/absent git
makes the input unresolvable rather than spawning a possibly-planted shim.
git rev-parse --git-path kirocrew-provision.json), not the working tree, so it never dirtiesa rebase/prune and needs no ignore rule — a worktree whose revision predates
this change is not dirtied by a provision.
manifest existed carries no stamp, so its venv and
node_modulesread "notbuilt" until its next provision, which rebuilds them once and records the stamp.
This closes the rebase/sync invalidation gap and the
Advancere-entry gap.The checks live in
pod/provision.py; Dev Fleet'sfleet_state.pypicks themain checkout's probe, and its
apps/builtins/dev_fleet/runtime.pycomment anddocs/system-specs/modules/dev-fleet.mddescribe them.
Tests
test/test_pod_provision.py::TestProvisionProvenance(real git repos undertmp_path, hermetic git identity): a doc-only commit does not invalidate venv ordist; venv restales only on a
pyproject.tomlchange; node_modules restales onlyon a
package-lock.jsonchange, not a source edit;has_distreads the vitebuild-id.json/kirocrew-build-source.txtfingerprint through the bundleguard's
read_dist_tree(pinned by a test that swaps the reader) and recognisesa synced dist; the pre-build input oid (not completion HEAD) is what is stamped; the
manifest lives in the git dir and leaves
git statusclean; untrusted/absent git→ presence-only; non-git tree → presence-only; corrupt manifest → not-provisioned;
an unreadable manifest is never rewritten by a stamp or clear;
the uv venv path does not fall through to pip; an unstamped venv reads built only with
require_stamp=False, and the Fleet poll reports an unstamped main venv as built while an unstamped worktree venv reads not built (test/test_dev_fleet_app_context.py::test_unstamped_main_venv_reads_built_but_a_worktree_needs_the_stamp, red with thefleet_state.pychange reverted; 10 repeats green, and green in the xdist-distributed suite run). Fulltest_pod_provision.pypasses; flake8 / isort / mypy / docs-lint clean on the changed files.
Fixes #10459
Pattern harvest
Not generalizable: the defect was a design gap — a presence check standing in for
a provenance check — not a mechanical code smell a grep/semgrep rule could catch.
A
.is_dir()/.exists()probe is correct in most contexts; only "does thisprove the artifact matches the current source?" makes it wrong, which is a
semantic question about intent, not a syntactic pattern. The durable guard is the
behavioural
TestProvisionProvenancesuite, which pins that eachhas_*comparesthe artifact to its build input rather than mere presence.