You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaky: test_a_second_boot_touches_only_known_module_globals: governance._CONFIRM_PATTERNS_MEMO (from #22511) is not reset between boots #22676
test/integration/test_boot_smoke.py::test_a_second_boot_touches_only_known_module_globals failed on #9750 (head 1f7dbad2c4, CI merge ref including #22511):
AssertionError: a boot changed module globals the harness neither restores nor documents; add each to conftest._reset_home_bound_globals or, with its reason, to _KNOWN_SECOND_BOOT_CHANGES: [('kiro_crew.platform.governance', '_CONFIRM_PATTERNS_MEMO')]
#22511 (merged 2026-10-21 04:53 UTC) added governance._CONFIRM_PATTERNS_MEMO, a process-wide memo of the confirm_tools patterns keyed on the config files' fingerprint and the loader cache generation. That is home-derived data, so a second boot on a new home can replace it. It is in neither conftest._reset_home_bound_globals nor _KNOWN_SECOND_BOOT_CHANGES.
It depends on test order: on main41987ae89b the test passes alone (2 of 2 runs) and in a full local -n 2 --dist loadgroup run of test/integration, so it fails only when an earlier test in the same worker has already filled the memo.
Likely fix: reset it to None in conftest._reset_home_bound_globals, beside the other config-derived caches. Same class as #19150 (atomic_write._default_mode).
The test is timing-dependent on main itself, not only through this memo. Running it alone with KIROCREW_INTEGRATION=1, 3 times each on fresh worktrees: main41987ae89b passed 2 of 3, and the third run failed on a different global, [('kiro_crew._facade_mirror', '_INSTALLED')]. #9750b768d68d53 gave the same pattern (2 of 3, the same _facade_mirror._INSTALLED failure). Both globals look like work a boot's background tasks may or may not finish before the second snapshot is taken.
This hits fork PRs, not #9750's code. Fork PRs run CI on GitHub-hosted ubuntu-latest: ci.yml (the runner step's ELIGIBLE expression) sends only same-repo PRs, pushes and merge groups to CodeBuild. Since #22511 merged at 04:53 UTC:
Same-repo PR Integration jobs over the same window: 75 of 75 passed.
How it happens: before the config watcher holds a snapshot, governance._confirm_tool_patterns() rewrites the memo on every read. At boot those reads come from rebuild_agent_config, through auto_approve to may_skip_gate_now and _operator_requires_confirmation. The memo key carries config.json's stat (dev, ino, ctime, mtime, size). conftest._reset_home_bound_globals never clears it, so whenever that stat moves between the two boots' last reads, the witness flags it. Locally the change hides behind _module_globals()'s repr(value)[:200] cut when the tmp path is long. With a CI-length --basetemp, a scratch repro that bumps config.json's mtime inside boot 2 failed 3 of 3 runs. It passed 3 of 3 with this in test/integration/conftest.py:
Activity
amadsalmon commentedon Oct 21, 2026
Again on #9750 head b768d68 (same
_CONFIRM_PATTERNS_MEMOline): https://github.com/kirodotdev/KiroCrew/actions/runs/39552568866/job/119066769570The test is timing-dependent on
mainitself, not only through this memo. Running it alone withKIROCREW_INTEGRATION=1, 3 times each on fresh worktrees:main41987ae89bpassed 2 of 3, and the third run failed on a different global,[('kiro_crew._facade_mirror', '_INSTALLED')]. #9750b768d68d53gave the same pattern (2 of 3, the same_facade_mirror._INSTALLEDfailure). Both globals look like work a boot's background tasks may or may not finish before the second snapshot is taken.Sent by an AI agent on behalf of Amad
KiroCrewCaptain commentedon Oct 21, 2026
Thanks for the report. This issue has been triaged by Crew Captain and will be assigned to a maintainer, who will follow up here.
amadsalmon commentedon Oct 21, 2026
This hits fork PRs, not #9750's code. Fork PRs run CI on GitHub-hosted
ubuntu-latest:ci.yml(therunnerstep'sELIGIBLEexpression) sends only same-repo PRs, pushes and merge groups to CodeBuild. Since #22511 merged at 04:53 UTC:assert not [('kiro_crew.platform.governance', '_CONFIRM_PATTERNS_MEMO')], across 14 PRs (feat(subagents): add remote executor placement #12821 fix(security): keep a quoted newline inside its word on the push path #15438 feat(subagents): per-chat agent-queue priority (low/medium/high) #15543 feat(apps): let an app run its own cron job now, off schedule #15661 feat(chat): backend to merge a fork back into its parent chat #17165 docs(rfc): peer-sent turns may reset their own conversation #18338 docs(rfc): propose remote crew file hand-off #19460 docs(rfc): accept rfc-question-card-auto-submit on maintainer approval #19831 feat(chat): resume interrupted turns on their own, within a budget #20750 fix(security): delimit a quoted $( body from a fresh quote context #20851 fix(security): allow an env-prefixed push after a multi-line message #20854 fix(update): always install the newest build, never a superseded download #21979 feat(chat): one owner for the delivery-warning strip both chat surfaces render #22478 feat(session): let a user keep an ephemeral chat as persistent #9750). feat(subagents): per-chat agent-queue priority (low/medium/high) #15543 and feat(chat): backend to merge a fork back into its parent chat #17165 each have a passing and a failing run on the same code. Examples: job 119086675810, job 119053557934.How it happens: before the config watcher holds a snapshot,
governance._confirm_tool_patterns()rewrites the memo on every read. At boot those reads come fromrebuild_agent_config, throughauto_approvetomay_skip_gate_nowand_operator_requires_confirmation. The memo key carriesconfig.json's stat (dev, ino, ctime, mtime, size).conftest._reset_home_bound_globalsnever clears it, so whenever that stat moves between the two boots' last reads, the witness flags it. Locally the change hides behind_module_globals()'srepr(value)[:200]cut when the tmp path is long. With a CI-length--basetemp, a scratch repro that bumpsconfig.json's mtime inside boot 2 failed 3 of 3 runs. It passed 3 of 3 with this intest/integration/conftest.py:Sent by an AI agent on behalf of Amad