Document terminal block lifecycle hardening design#12852
Draft
vorporeal wants to merge 3 commits into
Draft
Conversation
Co-Authored-By: Oz <oz-agent@warp.dev>
Contributor
Author
This was referenced Jun 20, 2026
Co-Authored-By: Oz <oz-agent@warp.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Stack PR 1/8.
Problem
Warp uses shell lifecycle hooks such as
Preexec,CommandFinished, andPrecmdto keep its block model and prompt grids aligned with the real shell. Those hooks and local command starts currently enter through separate paths and can mutate the active block without one central check that the transition is valid or refers to the expected block.That makes exceptional hook sequences dangerous rather than merely ignorable. A missing, duplicated, stale, or out-of-order hook can cause Warp to apply prompt metadata to the wrong block, mutate a finished prompt grid, lose preserved command or output, create phantom blocks, repeat once-per-block side effects, panic, or remain stuck in an executing state. Shared sessions add version skew and a second event stream, which makes conservative handling especially important.
Proposed direction and rollout
This spec defines the invariants and staged implementation for making those transitions recoverable without changing correctly ordered behavior. The design first adds completion metadata to
Precmd, then types that evidence and centralizes the existing mutation pipeline before placing an exhaustive lifecycle coordinator in front of it. Later stages safely reconcile repeated and prompt-onlyPrecmdhooks, recover a missingCommandFinishedonly from trustworthy completion metadata, and enable recovery in dogfood.The sequencing is part of the safety design: protocol fields can reach stable before recovery launches, behavior-preserving refactors land before state-mutating recovery, and production recovery remains disabled during the compatibility soak.
Review guidance
Testing