# Handover, stopping, and results

1. The student's live local connection registers a waiting session.
2. Existing foreground work finishes normally. Pending script control prevents
   the scheduler from starting a fresh automatic job after that work finishes.
3. Once camera acquisition, slewing, sequencer/focus work and existing pointing
   work have settled, the foreground loop enters manual mode and records the
   controlling session's name and userid.
4. Session entry returns to student Python. Each structured operation is
   journalled and executed in the same OBS control loop as existing commands.
5. Normal session exit waits for owned work to finish, releases ownership and
   restores the preceding/latest externally requested mode. An operator mode
   change takes precedence. Existing Stop/fault state is not cleared by cleanup.

OBS prints acquisition/release of script control and publishes `student_script`
in local status. A second live session waits for the current owner; old command
history does not establish ownership. Operator controls remain available through
their existing paths. A deliberate mode-change command relinquishes script
ownership instead of letting the script undo that operator choice.

The live HTTP response has transport heartbeats, not an inactivity deadline.
Disconnect or Ctrl+C requests session cancellation. Interruptible exposures and
rotator moves use the existing Stop machinery. Ordinary blocking operations
finish before ownership is released. Pending commands from the departed session
are cancelled. A stop or connection loss never automatically repeats a physical
operation. Client processes and scripts are never executed inside OBS.

Temperature targets and equipment positions requested by the script remain as
requested. Normal OBS thermal/operator controls can subsequently change them.
Existing weather, enclosure, device faults, and protective workers remain active.

Student image saving uses the normal raw FITS writer directly on acquisition
data, with standard OBS headers and naming. Its successful return acknowledges
the write; the downstream duplicate primary raw write is suppressed. Existing
alternate-path writes and later science processing remain in their usual paths.
There is no image readback, content hashing, or new image-quality acceptance gate.
Errors from the actual writer are returned without turning them into another
camera exposure. Opening a returned image for student analysis is an explicit
subsequent read.
