docs(ghostty): a ghost surface is detectable in one property read

The measurement identified realized surfaces by counting shell processes, which
is what was available while probing. morning-driver, building against this
document, found a cheaper and stronger test in the sdef: `working directory` is
readable on a terminal, and a surface with no shell process reports it EMPTY -
exactly the ghost signature the broken creation API produces.

That turns "has this surface been realized" from an inference into a
machine-checkable question, which is the guard anything driving Ghostty needs
before it types into a pane.

The same property answers one of the document's own open questions: it goes
empty when a shell exits and returns when the prompt is back, so "has this pane
returned to a prompt" can be polled rather than guessed at with a delay.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011eKRzhD1RqY2MxvDEkrJAM
This commit is contained in:
Kjell Tore Guttormsen 2026-08-02 15:57:27 +02:00
commit 4080e22abd

View file

@ -58,6 +58,21 @@ initialized the shell.
`environment variables` - all ride the broken creation path. None of them had
any measurable effect: no process, no file written, no directory set.
**A ghost surface can be detected in one property read, and this is the cheapest
guard against the whole failure class.** `working directory` is readable on a
terminal, and a surface with no shell process reports it EMPTY - that is exactly
the ghost signature. So "has this surface been realized" is a machine-checkable
question, not something to infer from counting `login ... exec -l /bin/zsh`
processes as this measurement did. Anything driving Ghostty should wait for a
new surface to report a working directory before typing into it, and refuse to
type into one that never does.
Contributed by `morning-driver` (2026-08-02) from the sdef plus its own
measurement, after building against this document. The same property answers a
question left open below: it goes empty when a shell process exits and returns
when the prompt is back, so "has this pane finished and returned to a prompt"
can be polled rather than guessed at with a delay.
### 2. `open -na` works and is still the wrong tool
`open -na Ghostty.app --args --working-directory=...` produced 26 live shells in