turns.jsonl was opened with O_APPEND. On Windows Go opens such a file
with FILE_APPEND_DATA and without write access, so the Truncate that
drops a cut-off last line was refused ("Access is denied"), and
SaveGatewayTurn failed for every later turn of that session. The file
is now opened read-write without O_APPEND and the line is written with
WriteAt at the end found (gatewayMu already keeps another save from
writing in between). No other file in the repo is both opened with
O_APPEND and truncated.
Run:
- Windows box (xiaomi-gpu), GOOS=windows test binaries of
internal/sessions under a scratch USERPROFILE/APPDATA/TEMP:
origin/main (f9113626): TestGatewayConversation* -count=20 fails
TestGatewayConversationInterruptedAppend every time with "truncate
...turns.jsonl: Access is denied"; this commit: -count=20 PASS, whole
package PASS.
- macOS: go test -race -count=5 ./internal/sessions/ ok.
- gofmt -l clean; go vet darwin/linux/windows ./internal/sessions/ ok.