Recover missing CommandFinished hooks from Precmd completion metadata#12858
Draft
vorporeal wants to merge 2 commits into
Draft
Recover missing CommandFinished hooks from Precmd completion metadata#12858vorporeal wants to merge 2 commits into
vorporeal wants to merge 2 commits into
Conversation
This was referenced Jun 20, 2026
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Jun 20, 2026
Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
da9c6a2 to
c12ed03
Compare
8ea8d92 to
2a89b87
Compare
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 7/8; depends on #12857.
Context
A dropped
CommandFinishedis the key recoverable failure this stack targets. The shell can finish a command and emitPrecmd, while Warp still believes the old block is submitted or executing. Without trustworthy completion evidence, advancing would require inventing an exit code or next-block identity; not advancing leaves the controller and block model stuck and risks applying the new prompt to the old command block.The earlier stack PRs make recovery safe: #12853 gives
Precmdthe real completion identity, #12854 distinguishesPrecmdhooks with completion metadata from prompt-onlyPrecmdhooks, #12855 provides one completion pipeline, #12856 gates every transition, and #12857 makes prompt application and refresh safe.Approach
When a
Precmdwith completion metadata carries a novel next block ID, the coordinator now treats it as completion evidence. It runs the same completion pipeline used byCommandFinishedwith the shell-provided exit code and exact next block ID, then applies the received prompt metadata only to the fresh block. If the active block was already finished, the model advances without finishing or emitting completion again; if Warp missed earlier start/pre-execution evidence, it performs the minimal transition needed to preserve truthful completed-block state.All non-normal state-mutating recovery remains behind
TerminalLifecycleRecovery. Duplicate, stale, or colliding completion metadata, partial payloads, and prompt-only evidence still cannot trigger completion. Shared-session and version-skew paths preserve the same conservative rules.Review guidance
Testing
CommandFinished; confirmed it fails on the preceding PR and passes here.cargo check -p warp --tests,./script/format, andgit diff --check.