fix: stabilize pet proactive reminders after restart#257
Conversation
There was a problem hiding this comment.
I found four issues worth addressing:
-
pkg/pet/config/loader.go:Load()now printscfg.Voice.ASRModelListbefore the latercfg.Voice == nildefaulting block. Older or minimalpet_config.jsonfiles can still omitvoice, so this path will panic during startup. -
pkg/pet/service.go: the new active-session tracking can still go stale.UnregisterSession()only clearsactiveSessionIDwhen all connections are gone, so if the last active pet websocket closes while another session stays connected, reminder delivery can still resolve to the dead session instead of deferring. -
pkg/pet/service.go/pkg/pet/proactive/snapshot.go: the proactive snapshot wiring does not populate the new runtime session fields such asActiveSessionID,CurrentSessionBusy,ConsoleVisible, orPetVisible. That leaves the session-aware selection path inProgressNudgeProviderand part of the interruptibility logic effectively inactive in production even though the tests set those fields manually. -
pkg/pet/report/aggregator.go: the summary literals inbuildSummary()are mojibake, so generated weekly reports will contain garbled Chinese text.
I also ran go test ./pkg/pet/proactive ./pkg/cron ./pkg/tools; the first two passed, while pkg/tools still has existing web-tool test failures unrelated to this PR.
|
上述问题已解决 |
Closes #258
问题
petreminder 在重启后会因为旧 session 失效而收不到at任务在应用重启后如果已经过点,会直接失去执行机会progress_nudge需要和cron/every周期任务区分改动
weekly_report/progress_nudge的后端最小闭环session_id定向投递 pet proactive pushscripts/test-pet-proactive.ps1asar布局兼容性验证
go test ./pkg/cron -run "TestCronService_(ComputeNextRun|ExecutionFlow|ExecuteJobDeferredKeepsOneTimeJobForRetry|StartRunsOverdueOneTimeJobAfterReload|DedupOneTimeJob)"go test ./pkg/tools -run "TestCronTool_ExecuteJob"go test ./pkg/pet -run TestDoesNotExistwin-unpacked可启动ClawPet.exe