Skip to content

fix: stabilize pet proactive reminders after restart#257

Closed
hazy-cloudy wants to merge 6 commits into
1024XEngineer:devfrom
hazy-cloudy:cloud/pr-pet-proactive-upstream-merge-20260509
Closed

fix: stabilize pet proactive reminders after restart#257
hazy-cloudy wants to merge 6 commits into
1024XEngineer:devfrom
hazy-cloudy:cloud/pr-pet-proactive-upstream-merge-20260509

Conversation

@hazy-cloudy
Copy link
Copy Markdown
Collaborator

@hazy-cloudy hazy-cloudy commented May 9, 2026

Closes #258

问题

  • 一次性 pet reminder 在重启后会因为旧 session 失效而收不到
  • 一次性 at 任务在应用重启后如果已经过点,会直接失去执行机会
  • progress_nudge 需要和 cron/every 周期任务区分

改动

  • 补齐 weekly_report / progress_nudge 的后端最小闭环
  • 修复一次性 reminder 的 session fallback、deferred retry、过点重启继续执行
  • session_id 定向投递 pet proactive push
  • 增加活动沉淀、debug action 和 scripts/test-pet-proactive.ps1
  • 修复打包后 Electron 启动与 asar 布局兼容性

验证

  • go test ./pkg/cron -run "TestCronService_(ComputeNextRun|ExecutionFlow|ExecuteJobDeferredKeepsOneTimeJobForRetry|StartRunsOverdueOneTimeJobAfterReload|DedupOneTimeJob)"
  • go test ./pkg/tools -run "TestCronTool_ExecuteJob"
  • go test ./pkg/pet -run TestDoesNotExist
  • 本地 win-unpacked 可启动 ClawPet.exe

Copy link
Copy Markdown

@fennoai fennoai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found four issues worth addressing:

  1. pkg/pet/config/loader.go: Load() now prints cfg.Voice.ASRModelList before the later cfg.Voice == nil defaulting block. Older or minimal pet_config.json files can still omit voice, so this path will panic during startup.

  2. pkg/pet/service.go: the new active-session tracking can still go stale. UnregisterSession() only clears activeSessionID when 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.

  3. pkg/pet/service.go / pkg/pet/proactive/snapshot.go: the proactive snapshot wiring does not populate the new runtime session fields such as ActiveSessionID, CurrentSessionBusy, ConsoleVisible, or PetVisible. That leaves the session-aware selection path in ProgressNudgeProvider and part of the interruptibility logic effectively inactive in production even though the tests set those fields manually.

  4. pkg/pet/report/aggregator.go: the summary literals in buildSummary() 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.

Comment thread pkg/pet/config/loader.go
@hazy-cloudy hazy-cloudy changed the title fix: close pet proactive reminder and packaging loop fix: stabilize pet proactive reminders after restart May 9, 2026
@hazy-cloudy
Copy link
Copy Markdown
Collaborator Author

上述问题已解决

@hazy-cloudy hazy-cloudy requested a review from Melon80 May 10, 2026 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(pet): stabilize proactive reminders after restart

1 participant