250adf5e (#3185) has Keep, turned off, wait on filememo.Written for
the setting, but it took the channel after the look (level, which is
settings.Load in the gateway), not before it. A save in between, the
user turning Keep awake on, had Forget close the channel from before
the look, and Keep waited on the one made after it until its beat,
filememo.OthersEvery(): 5s polled, a minute while Watch runs (where
the watch's event for the same save still woke it, if that came after
Written). A write from the CLI or a second magpie, which only the
watch's wake tells of, had the same window. The window is narrow, from
Load's read of settings.json (its unlock, for a save in this process,
which waits for that) to Written, and wider only while let() lets go
of a hold. It came up in review of #3632.
Keep now takes Written before the look, as middleware's observer,
OTel's session watch, pluginrt.KeepFresh and the agent's Codex daemon
check do, and waits on that channel when the look found it off. On,
it waits for its tick alone, as before: the channel is taken on every
pass but waited on only after a look that found it off.
What was run (tree e8e23dae, on origin/main ef0a03e1, go1.26.8,
linux/amd64):
- TestKeepOffSeesAWriteDuringTheLook (new): the level func turns the
setting on and writes it (filememo.Forget) right after its read, at
least 2s before the next beat, and Keep must ask it again before that
beat. It times its own level func's second call, not a hold: a Keep
that another test's failure leaves running holds through the same
stand-in. ok at -count=5, 0.00s each.
- Broken by hand, each put back after, -count=3 of the new test alone
and of the whole package:
- ef0a03e1's awake.go (Written taken after the look): red 3 of 3
and 3 of 3, the new test only, "turned on during the look, the
setting was looked at again 4.999540055s after it was written, at
the beat (00:22:45), not at once", 4.46s to 5.00s across the six.
- Written taken right after level(): the same, 4.44s to 5.00s.
- Written taken before the look but not waited on when off: the
new test red 3 of 3 and 3 of 3, 4.43s to 5.00s; in the whole
package TestKeep and TestKeepOffWaitsForTheSetting go red beside
it.
- Written taken once, above the loop: every test passes, the new
one too. After the first write Keep would spin while off, and no
test writes and leaves it off; noted on #3687, with the other test
fixes this file needs.
- The new test started 1.5s before a beat, so that it waits that beat
out before the write (a scratch wrapper, not committed): ok 3 of 3,
and red 3 of 3 with ef0a03e1's awake.go, 5.00s each.
- Outside graftcp, ./internal/awake with -race -count=20, -count=20,
and -race -shuffle=on -count=20: 100 of 100 ok each. The new test
took 0.00s in 19 of each 20, and 1.87s, 1.91s and 1.90s in the one
that started under 2s before a beat. TestKeepOffWaitsForTheSetting,
unchanged here, is red about once in 100 runs on 098ac969 (4 of 400)
when a 5s beat lands in its 50ms window: #3687. It didn't come up in
these runs.
- gofmt -l clean; GOOS=linux and darwin go vet -tags nogui ./...,
GOOS=windows go vet ./..., GOOS=linux and darwin go build -tags
nogui ./... and GOOS=windows go build ./...: exit 0 each. go vet and
go build ./... without the tag on linux stop at pkg-config here (no
libsoup-3.0 or gio-unix-2.0), exit 1.
- Full suite outside graftcp (systemd-run, umask 077, Bun 1.4.2 first
on PATH as on CI, -timeout 45m, log kept): 66 ok, awake, beat,
filememo and settings among them, and 6 red, none in what this
changes:
- agent TestInstalledVersion, TestHowInstalled,
TestCursorFolderFromTheEditorIsNotTheCLI,
TestCopilotFolderFromAnIDEPluginIsNotTheCLI,
TestQoderSettingsFromAnIDEPluginIsNotTheCLI and
TestOmpDetectedWithPiDir: #3141;
TestReasonixCLIRequiresSupportedNativeVersion and
TestReasonixCLIRecoversAfterProbeTimeout: #3641.
- edit TestWriteAtomicReadOnlyHardLink and testenv TestProgram: this
box's umask 077, #3640.
- gateway TestPluginToldWhereTheAgentWorks: this box's /tmp/.git,
#3675.
- gui TestGatewayHeldByAContainer and TestGatewayFixQuitsOnlyAMagpie:
#3649.
- provider: "fatal error: close of synctest channel from outside
bubble", main's CI red, #3632.
Not tried: a real gateway with Keep awake turned on inside the window
(it is too narrow to hit by hand; the test puts the write there), and
macOS and Windows, vet and build only (nothing here depends on the OS).
Reviewed on macOS arm64, go1.26.8: internal/awake -race -count=20 ok.
Broken by hand: main's awake.go turned TestKeepOffSeesAWriteDuringTheLook
red twice of two ("looked at again 4.09s / 5.00s after it was written,
at the beat"). The other loops waiting on filememo.Written (middleware
points, otlp sessions, pluginrt config, codex daemon) already take it
before their look. gofmt clean; vet ok for linux nogui, windows, darwin.