Computer use: restart detection (parked)

Draft
AD
1mo ago
+649-69

Parked, not for merge: restart detection for computer use, removed from the stack (#11006, #11037–#11040, #11210, #11211, #11670) because it doesn't seem worth it at the moment. This PR puts it back exactly as it was, so it can be picked up later.

What it did:

  • Told the model when the display restarted since its last screenshot (ComputerResult.restarted), and held back actions planned on the old screen.
  • Counted display starts in four places: files in the environment (/tmp/.pydantic-ai-display-*), ManagedDisplay, the durable journal (WorkspaceCallResult.starts, DurableWorkspace.display_starts), and ComputerUse per run. Public surface: SupportsStartCount.

Why it's parked:

  • Most bugs in the last review rounds came from this feature. Each place a backend object, durable unit or process changes loses or double-counts a start; four of those still reproduce.
  • Other computer-use frameworks don't tell the model either: the next screenshot shows the new screen.
  • Adding it later doesn't break anything: an optional protocol, a NotRequired result key, and a journal field left out at its default. Checked on Temporal: a new field on an existing result replays, a new journaled step doesn't.

What stays in the stack: an action whose own call launched a new X server is refused, since the windows it was meant for are gone.

If this comes back, a screen id read from the environment (boot id, X server PID and start time) avoids the counters.