Skip to content
C.W.K.
Stream
Lesson 04 of 10 · published

Reconnect as the Same Surface

~11 min · reconnect, incarnation, lifecycle, replay, phone

Level 0Spark
0 XP0/48 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Come Back as What You Were

Under the lease, coming back after a lock had to mean coming back as a spectator, because the world might have handed the keyboard to someone else while you were gone. Under the shared contract there is nothing to hand over. So a phone that lost its connection — a tunnel, a lock, the app sent to the background — reconnects as the same kind of surface it was: a device approved for control comes back as an input surface beside whoever is there, and an observer comes back as an observer. You do not have to press anything to type again, and nobody else has to give anything up.

The Address Has Not Changed

What makes coming back safe is the same address as before: the daemon's incarnation plus the session's identity. If both still match, it is the same fire, and the phone attaches to it. If the incarnation changed — the owner was restarted, the Mac rebooted — process identity is gone, and the phone does not pretend otherwise; on the Mac those panes rematerialize from their declarations as new sessions. Titles are not addresses, and neither are process numbers. A changed incarnation also clears the phone's old panes rather than dressing new sessions in old names.

Nothing Comes Back With You

Coming back as the same kind of surface does not mean coming back with your past intentions. Moving to the background or losing the network discards pending input on the spot. A reconnect never replays queued keystrokes, never resends a create whose answer never arrived, never restores a hold, and never repeats an Anvil action. Input is accepted again only after the reconnected pane has received its replay completely — a phone does not type into a screen it has not finished painting — and a test proves that guard with the keyboard open the whole time.

Which Interruptions Count

The phone is precise about what an interruption is. Only moving to the background pauses its connections. A momentary inactive state — pulling down Control Center, opening the app switcher, a system alert — keeps every connection and every hold, and returning to the foreground connects each paused link once, not in a storm. An explicit Disconnect on a Mac's row, or that Mac's gateway refusing or revoking the device, stops automatic reconnection for that Mac until Connect is pressed; becoming active again never overrides that choice.

Reconnect by incarnation and session, as the same kind of surface you were. An input surface types again without asking; an observer stays an observer; no keystroke, create, hold or Anvil action is ever replayed; input waits for a complete replay.

Code

What a reconnect keeps, and what it never brings back·text
pause
  app moves to the background     -> pause links, DISCARD pending input
  network loss                    -> link drops, DISCARD pending input
  Control Center / switcher / alert (inactive) -> keep links and holds

return to the foreground          -> connect each paused link ONCE
  same incarnation + same session -> attach as the SAME kind of surface
       control device             -> input surface beside whoever is there
       observer                   -> observer
  incarnation changed             -> not back: old panes cleared on the phone
                                     (the Mac rematerializes its declarations)

never replayed
  queued keystrokes | a create with no answer | a hold | an Anvil action

input accepted again only after a COMPLETE replay

explicit Disconnect, or the gateway refusing/revoking the device
  -> no automatic reconnect for that Mac until Connect

External links

Exercise

Write three reconnect stories: (1) you pull down Control Center mid-paste while holding; (2) you lock the phone for ten minutes while the Mac keeps typing; (3) the Mac's owner was restarted while the phone was locked. For each, write what the phone attaches as, whether a hold survives, and what is discarded.
Hint
Story 1 never disconnected. Story 2 comes back as an input surface with nothing replayed. Story 3 is not "back" at all — the incarnation changed.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign in — Please sign in to comment.

No comments yet — be the first.