Skip to content

fix(plain): record and verify spawned windows - #1186

Closed
fujibee wants to merge 2 commits into
feat/1152-self-writefrom
fix/1149-owner-witness
Closed

fujibee wants to merge 2 commits into
feat/1152-self-writefrom
fix/1149-owner-witness

Conversation

@fujibee

@fujibee fujibee commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Closes #1149.

Plain spawns now use a one-shot child-to-parent handshake because the new window is the first process that can observe its emulator, controlling tty, and owner. A successful launch returns plain:<emulator>:<tty> and writes a four-column placement record with a boot/boot_start process witness; a missing, malformed, or timed-out handshake is a named failure and never falls back to the legacy - sentinel. terminal_detect likewise produces an emulator-qualified tty when the current measured macOS emulator and controlling tty are observable.

Forced despawn reads the record fence, checks that its emulator and tty match the locator, and revalidates every known complete process pair before asking the emulator adapter to close exactly that session. Spawn-time boot keys remain distinct from self-write's pid keys for the CLI process. A stale or incomplete witness fails loudly and keeps the placement record for retry. Unknown future anchor keys are ignored, while known keys are the only accepted evidence.

This PR is intentionally based on #1157 (feat/1152-self-write) because that change defines the four-column fence schema and reader compatibility.

Tests: bats tests/test_terminal_registry.bats (169/169); bats tests/test_despawn.bats (21/21, followed by focused coverage after the final witness-key split); bats tests/test_spawn.bats (108/108); bash -n scripts/drivers/terminals/plain/ops.sh; bash -n scripts/spawn.sh; bash -n scripts/despawn.sh.

@fujibee
fujibee force-pushed the fix/1149-owner-witness branch 2 times, most recently from 232690b to e2ffca0 Compare September 13, 2026 09:24
@fujibee
fujibee force-pushed the feat/1152-self-write branch from 2258273 to 75285fa Compare September 13, 2026 10:23
@fujibee
fujibee force-pushed the fix/1149-owner-witness branch from e2ffca0 to 837216c Compare September 13, 2026 10:38
@fujibee
fujibee deleted the branch feat/1152-self-write September 13, 2026 18:23
@fujibee fujibee closed this Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant