You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(native-chat): infer interrupt after acknowledged Escape on chat Stop - #41285
Send single-Escape chat Stop cancellations through sendRawVerified(ESC) (requireWriteSettlement: true) and trigger createAgentInterruptInference(...).observeInputIntent('plain-escape', statusBeforeEscape) once the write is acknowledged.
Capture statusBeforeEscape before dispatching the Escape so slow remote write settlements cannot clear a turn that began mid-send, and refused writes never trigger interrupt inference.
Add unit tests in use-native-chat-interactive-send.test.tsx.
A chat Stop wrote Escape directly to the runtime PTY, bypassing xterm onData so agents that emit no interrupt hook stayed Working in the sidebar. Send Stop's Escape via sendRawVerified and observe plain-escape against the pre-Escape status baseline only after write settlement.
Fixes#31786
Co-authored-by: Zetao Qi <[email protected]>
The Stop action now uses sendRawVerified to send Escape. After acknowledged delivery, it runs interrupt inference with the captured and current pane statuses. Inference errors are warned and return false. Tests cover accepted and rejected delivery, delayed acceptance after a status change, and the inference settle interval.
Severity of issue fixed: Medium
Merge Risk: Minimal · up to 2f010
Chat Stop should now clear the Working status when the agent emits no interrupt hook. Refused writes do not trigger inference. No actionable merge-blocking risk remains.
Pre-merge checks: 3 · 1
Failed checks: 1 inconclusive
Check name
Status
Explanation
Resolution
Description check
The description covers the core of the change. It states the mechanism (sendRawVerified with requireWriteSettlement, observeInputIntent after acknowledgment), the reason for capturing statusBeforeEsca…
Add the missing template sections: an ELI5 summary; a What Changed section that describes the before and after user experience (Stop on a non-hook agent does not clear the Working status, and the fix clears it); a Visual Proof section with …
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: after an acknowledged Escape on chat Stop, the interrupt inference runs. It matches the raw summary and the PR objectives. It uses a conventional fix(scope) prefix and…
Linked Issues check
Issue #31786 requires that chat Stop in a terminal-backed chat clears the "Working" status when the agent fires no interrupt hook, matching what a typed Escape already does through xterm onData. At th…
Out of Scope Changes check
The whole-PR diff for the source file adds only the createAgentInterruptInference import, the statusBeforeEscape capture, the verified Escape dispatch with acknowledgement gating, and the dependen…
Full details: Title check
Explanation
The title names the main change: after an acknowledged Escape on chat Stop, the interrupt inference runs. It matches the raw summary and the PR objectives. It uses a conventional fix(scope) prefix and is 72 characters, within a normal length.
Full details: Linked Issues check
Explanation
Issue #31786 requires that chat Stop in a terminal-backed chat clears the "Working" status when the agent fires no interrupt hook, matching what a typed Escape already does through xterm onData. At the reviewed head, cancel in use-native-chat-interactive-send.ts sends the single Escape through sendRawVerified(ESC), which calls sendRuntimePtyInputVerified with requireWriteSettlement: true. Before dispatch, it captures statusBeforeEscape from agentStatusByPaneKey[paneKey]. Only when the write resolves as accepted does it call createAgentInterruptInference(...).observeInputIntent('plain-escape', statusBeforeEscape). This restores the inference path the issue says is missing. The change is confined to the non-second-Escape branch of cancel, so agents that use the second-Escape path are unchanged. The issue's phone Stop note is described as likely, not established, so it is not a requirement here. Unverified: the internals of createAgentInterruptInference and the new unit tests were not inspected. The test file summary reports coverage of accepted, rejected, and superseded-status cases.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff for the source file adds only the createAgentInterruptInference import, the statusBeforeEscape capture, the verified Escape dispatch with acknowledgement gating, and the dependency update on paneKey and sendRawVerified. All of these serve the Stop path in issue #31786. The test file (+125 lines, per the summary) tests this same hook behavior. No unrelated code paths were changed in the inspected source. The sendRaw callback remains in the returned API and is used by other callers, so its retention is not a scope change.
Full details: Description check
Explanation
The description covers the core of the change. It states the mechanism (sendRawVerified with requireWriteSettlement, observeInputIntent after acknowledgment), the reason for capturing statusBeforeEscape first, and the test file. It links the issue with 'Fixes #31786'. It omits several template sections: ELI5, a before/after description of user-visible behavior, Visual Proof, the Testing checklist, the Risk level and rollback plan, and the AI Disclosure and Review sections. The Linked Issue section is present. The Notes and Checklist sections are absent. The description is partly complete, so it is not a fail, but it needs these additions.
Resolution
Add the missing template sections: an ELI5 summary; a What Changed section that describes the before and after user experience (Stop on a non-hook agent does not clear the Working status, and the fix clears it); a Visual Proof section with a before and after video or an N/A reason (this is a behavior change, so a before and after is required); a Testing section with the platforms tested and the checklist items; a Risk section with the level (Low, Medium, or High), what could break, and how to revert; and the AI Disclosure section if applicable. Also confirm the Agent skill upstream boundary checkbox and the Checklist items.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The immediately resolved mock does not test whether inference can start before acknowledgment. The delayed test also changes the status, which lets the helper reject premature inference independently of acknowledgment.
Add a deferred-write case that keeps the status unchanged. Advance beyond AGENT_INTERRUPT_SETTLE_MS before resolving the write and assert no inference. Then accept the write, advance the settle interval, and assert one inference.
Based on learnings, use a deferred promise for asynchronous ordering assertions.
Source: Learnings
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b199868a-0d93-4d26-afba-060494f9559e
Commits
Reviewing files that changed from the base of the PR and between f9d5456 and 2f010c2.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
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
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.
Summary
Stopcancellations throughsendRawVerified(ESC)(requireWriteSettlement: true) and triggercreateAgentInterruptInference(...).observeInputIntent('plain-escape', statusBeforeEscape)once the write is acknowledged.statusBeforeEscapebefore dispatching the Escape so slow remote write settlements cannot clear a turn that began mid-send, and refused writes never trigger interrupt inference.use-native-chat-interactive-send.test.tsx.Fixes #31786
Co-authored-by: Zetao Qi [email protected]