From 0deddaa58427f628f0afefa68bc6bedd6149275e Mon Sep 17 00:00:00 2001 From: ZeroPoint95 <329227198+ZeroPoint95@users.noreply.github.com> Date: Wed, 14 Oct 2026 01:36:33 -0400 Subject: [PATCH 1/2] test: drain learned-quirk writers before simulating a restart --- internal/provider/quirks_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/provider/quirks_test.go b/internal/provider/quirks_test.go index 1818b6b390..e7ffdfd7c3 100644 --- a/internal/provider/quirks_test.go +++ b/internal/provider/quirks_test.go @@ -143,8 +143,14 @@ func TestLearnedQuirksSurviveTheProcessThatLearnedThem(t *testing.T) { t.Fatalf("memo = %s, want the model that refused", raw) } - // A fresh process reads it and never sends the refused shape at all. + // A fresh process reads it and never sends the refused shape at all. The + // synchronous save above does not join the separately scheduled writer; + // drain that writer before discarding the old process's memory, or it can + // overwrite the verified file with the deliberately emptied map. + quirks.settle() + quirks.mutex.Lock() quirks.mandatory = map[string]time.Time{} + quirks.mutex.Unlock() LoadQuirks(dir) if !ReasoningMandatory("strict/persisted") { t.Fatal("a memo on disk must be believed at startup") @@ -176,6 +182,9 @@ func TestASilentlyIgnoredDisableSurvivesTheProcessThatLearnedIt(t *testing.T) { t.Fatalf("memo = %s, want the model that ignored the disable", raw) } + // The old process's scheduled save must finish before its memory is + // discarded, for the same reason as the mandatory-reasoning restart above. + quirks.settle() quirks.mutex.Lock() quirks.disableIgnored = map[string]time.Time{} quirks.mutex.Unlock() From 430d3508e4e33086e34eaabf2639ebe564f5335d Mon Sep 17 00:00:00 2001 From: ZeroPoint95 <329227198+ZeroPoint95@users.noreply.github.com> Date: Wed, 14 Oct 2026 01:45:59 -0400 Subject: [PATCH 2/2] changelog: record the restart fixture ownership repair --- docs/changes/unreleased/1823-quirks-restart-fixtures.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/changes/unreleased/1823-quirks-restart-fixtures.md diff --git a/docs/changes/unreleased/1823-quirks-restart-fixtures.md b/docs/changes/unreleased/1823-quirks-restart-fixtures.md new file mode 100644 index 0000000000..69fae3d93d --- /dev/null +++ b/docs/changes/unreleased/1823-quirks-restart-fixtures.md @@ -0,0 +1,8 @@ +--- +kind: internal +title: provider restart fixtures drain learned-memo writers before resetting memory +pr: 1823 +surface: [build] +invalidates: + - "The restart fixtures forced a synchronous save but left a scheduled save running while they discarded process memory. They now drain the owned writer before resetting memory and reloading the memo, preserving the original startup and request-count assertions." +---