Repository navigation
fix(agent): ignore per-launch MCP env nonces in the worker spec fingerprint - #16879
paigebelliveau wants to merge 2 commits into
Conversation
a1e85fe to
2acbbc7
Compare
Design Review (Opus 5.5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The worker mirror now keeps a stale Watch
Suggestions
[DESIGN-REVIEWED] 33c0a5b Description read[DESCRIPTION-READ] 25c14d52de6b2993c04c3f668482562361b9d15790b3980b9c97b8e61b5a2dc3 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) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The fix moves the volatile-key list but not the normalizer, so Not justified as shipped
What this change shipsInventory (3 items) — 1 justifiedIntent: a worker spawn should survive another session re-stamping a launcher nonce at the same moment. This is a FIX.
[FIRST-PRINCIPLES-REVIEWED] 33c0a5b Description read[DESCRIPTION-READ] 4ac2e62013e8d30b3c74490173a091803092ef012eaf61f434c918db94920e38 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ human override accepted@buluoray overrode this lane for [GPT-OVERRIDE] 33c0a5b |
2acbbc7 to
a51f1dc
Compare
|
Rebased: main moved in src/kiro_crew/acp/skill_projection.py (and siblings this PR imports) since this head went green (595ad42 -> f481b88); CI re-running. The previous head's Backend Lint & Type Check shard hit its 25-minute job timeout before mypy finished (runner stall, not a type error); the new head re-runs it. |
|
self-added: no
|
a51f1dc to
f70ddd2
Compare
|
Rebased: main moved in sibling modules this PR imports (src/kiro_crew/sandbox*.py, cron_script.py, slack/gateway.py) since this head went green (f481b88 -> 161f731); CI re-running. Note for maintainers: Backend Lint & Type Check has now hit its 25-minute job timeout twice on this PR with the Check formatting (black) step alone taking ~15 minutes on the fork runner; mypy itself never finished. The diff does not touch formatting or the lint configuration, and the same job passed on main at f481b88 in 18.5 minutes. If it times out again on this head a maintainer rerun of that job is the only lever; a fork contributor cannot rerun it. |
|
Maintainer ask: the Backend Lint & Type Check (3.12) job has hit its 25-minute timeout on three consecutive heads of this PR (2acbbc7, a51f1dc, f70ddd2), each time at the Type check (mypy) step after the Check formatting (black) step consumed roughly 15 minutes. Every other check is green (87 pass, 0 fail on f70ddd2). The same job passes on main in about 18 minutes (f481b88), and this diff touches no formatting or lint configuration, so this looks like fork-runner slowness rather than a defect. A fork contributor cannot rerun the job; could a maintainer rerun just that job on f70ddd2 (run 37258560676)? I am holding off on further rebases so the rerun lands on a stable head. |
|
self-added: no
|
|
self-added: no
|
Human judgment recorded@buluoray marked the gpt AI finding as false positive, not applicable, or explicitly accepted for
This decision applies only to this commit. A new push requires a new judgment. |
|
Verified this live on Linux under a sandbox launcher that stamps a fresh env value into every agent spec on each start: on head 33c0a5b, one kirocrew-worker and three concurrent ones all reached a tool call with no DerivedSpecStale (main fails both). Since this now needs a rebase and it's blocking kirocrew-worker for several people, I've opened #17895 carrying your commit unchanged plus the rebase and the test-determinism fix, with you as co-author. Happy to close mine if you'd rather land this one. |
|
Hey Peter! Thank you so much for carrying it forward and for the live verification 😊 Please land #17895, no need to close yours. Closing this one in its favor. |
Problem / Motivation
Goal: A
kirocrew-workerspawn survives another session launching at the same moment.On a host where a launcher re-stamps a per-launch nonce into every agent spec it manages (
AIM_CREDS_AGENT_INJECTIONin thecreds-agententry of~/.kiro/agents/kirocrew.json, rewritten each time a session starts), akirocrew-workerspawn that overlaps any other session launch dies before its first turn with:Nothing runs, nothing is written. With a dozen dashboard sessions open, a launch lands every few minutes, so most worker dispatches die.
Why it matters
Conductors cannot dispatch workers on a host with such a launcher installed: three of three
kirocrew-workerspawns died this way on one host in one evening, each time with the user's task undone and reported as a runtime error. The gate is right to end a worker when a server is revoked under it; it is wrong to read a nonce as a revocation.Not a goal
tools,allowedTools,excludedTools,mcpServers,model).What changed (motivation → approach → change)
The worker gate takes a content fingerprint of the default spec before the spawn and again after kiro-cli's
initialize, and ends the session when they differ. The fingerprint inagent_materialization/worker_agent.pyhashed everymcpServersentry whole, env values included, so the nonce moved the hash on every launch. The repo already knew that key is a nonce:acp/skill_projection.pyleftvolatile_env_keys()out of its skill-view identity digests. The gate simply was not using that list.The fix hashes
mcpServerswith each volatile env value replaced by a fixed marker. The key itself stays in the hash, so a default that drops the key is still a changed spec; only the per-launch value is ignored. The volatile list (VOLATILE_ENV_KEYS_DEFAULT, theKIROCREW_SKILL_VIEW_VOLATILE_ENVextension andvolatile_env_keys()) moves toagent_spec_format.py, beside the spec parser, because the gate may not import the ACP layer (check_agent_sdk_boundary).skill_projection.pyre-exports the same names it had, so its callers and tests are unchanged.Backwards compatibility
Compatible: fingerprints of specs with no volatile env key are unchanged; a spec with one hashes differently once, which the gate answers with a single re-derive of the worker mirror on the next spawn, exactly as it does after any default-spec edit.
Removes nothing: no key, path, symbol or kind is removed;
skill_projection._VOLATILE_ENV_KEYS_DEFAULT,_VOLATILE_ENV_VARandvolatile_env_keyskeep their names.Tests
test_a_per_launch_env_nonce_does_not_move_the_fingerprintlocks in that a changedAIM_CREDS_AGENT_INJECTIONvalue leavesdefault_spec_fingerprint()unchanged, while any other env value in the same entry still moves it, and so does removing the key.test_a_nonce_restamp_during_the_load_does_not_end_the_sessionreproduces the production shape: capture, a re-stamp that changes the file identity, thenrequire_unchanged_derived_specreturns instead of raising.Both fail on
mainand pass with this change.Manual verification
Reproduced on the affected host: two captures of
~/.kiro/agents/kirocrew.jsonseven minutes apart differed only in the nonce and fingerprinted differently onmain; with this change both fingerprint the same, a removed key still changes the hash, and so does an edited non-volatile env value.Related Issues
no linked issue: found on a host, not filed first.
Pattern harvest
Rule candidate: review-prompt
Pattern: two digests of the same structure (skill-view identity and worker-spec fingerprint) with different exclusion lists; any new hash over
mcpServersmust consumevolatile_env_keys().Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)