Artifact a01e182f9cf0495e492af91210da7972dde3d40241e58cf4660b0878aec9e862:
- File docs/manual/doctor.md — part of check-in [aa138020d8] at 2026-11-24 10:06:45 on branch migrate-block — Let older pics step aside when a journal needs migrating, and add pic doctor (user: dmestas, size: 1999) [annotate] [blame] [check-ins using] [more...]
Updating a journal: pic doctor
Each workspace keeps its conversations in a journal, .pic/journal.sqlite. A newer pic sometimes
changes how the journal is laid out, and updates it the first time it opens it. It can only do that
while no other pic has the journal open, so an older pic still running in the workspace, a
pic remote started before you installed the newer pic, or a terminal pic left open, is in the
way.
Most of the time nothing needs doing. pic remote and a terminal pic's follower of a conversation
let go of the journal when a newer pic asks, and the update goes ahead. When something else keeps
it, the error names each process: its pid, what it is and since when, and the command that ends
it.
pic doctor fixes it in one step. Run in the workspace, it:
- says the journal is up to date when it is, and changes nothing;
- updates a journal an older pic last used, first letting the pics that step aside do so, then stopping the older pics that keep it open (a polite signal, then a forceful one after five seconds), and says which it stopped;
- finds older pics that do not say they hold the journal, with
lsofwhere the system has it, and stops them too when they are pics; anything else holding the file is named and left alone; - reports a journal written by a newer pic than this one, which it cannot read: update pic.
It never stops itself or the process that started it. pic doctor --json prints one line,
{"type":"doctor","ok":BOOL,"state":STATE,"message":TEXT}, with STATE one of none, current,
updated, newer, blocked and damaged.
From a phone, a workspace an older pic last used shows "it was last used with an older pic" with
Fix it, which runs pic doctor for that workspace on the computer; see
remote control.
If pic remote was one of the processes stopped, it starts again by itself when it was installed
to start at login (pic remote install); otherwise turn it on again with /rc or pic remote.