ReviewOS

stacks/uplink

fix: a text that arrived while the Mac was asleep is dropped without a reply

#16
Closed glennmichael123 opened this 9 days ago ·
9 days ago

Part of #5.

Sleep is the most likely real-world failure, and the current handling is to discard the text and say nothing. Over a satellite link, where the person may have waited minutes for the send, silence is the worst possible answer.

What is there today

  • Both launchers hold off idle sleep with caffeinate -i (app/Uplink/launcher.ts#L48, app/Desktop/launcher.ts#L73). That does not stop a laptop sleeping on lid close, and the homepage FAQ admits it: a lid-closed laptop "still sleeps unless it is on power with a display attached" (resources/views/index.stx#L82).
  • On waking, consider() drops any text older than catchUpMs, 30 minutes by default, with a log line and no reply (app/Uplink/uplink.ts#L220).
  • The reason for the cutoff is good and stated at app/Uplink/config.ts#L12: a Mac waking up must not replay a day of texts.

The cutoff is right. The silence is not.

Proposal

  1. Keep the rule, change the response. Answer a stale text with what happened: that the Mac was asleep, how long ago the text arrived, and that it was not run.
  2. Let the person act on it. A stale task the person still wants is one text away if the reply says how, and "text it again to run it now" is one sentence.
  3. Collapse a backlog. Waking after a long sleep with eight queued texts should produce one reply naming the count, not eight.
  4. Say it once per wake, not once per text.

Requirements

  • Never run a stale task automatically. The cutoff exists because a replayed day of texts could do real work nobody wants now.
  • One reply per wake, however many texts were skipped. The inbound link is thin and a wall of texts is worse than none.
  • A control word that was skipped (status, stop) needs no reply; those are answered live or not at all.
  • Do not reply to texts older than a generous ceiling. Waking a Mac that slept a week should not text about Tuesday.

Acceptance

  • A text that arrived during sleep produces exactly one reply saying it was not run.
  • Eight skipped texts produce one reply, not eight.
  • The existing behaviour for fresh texts is unchanged, and the test at tests/unit/uplink/ covering the stale path is extended rather than replaced.

Sign in to comment on this issue.