fix(grok): encode session/cancel as a real notification and interrupt steers - #224
fix(grok): encode session/cancel as a real notification and interrupt steers#224leoisadev1 wants to merge 2 commits into
Conversation
… steers Grok CLI dropped session/cancel because effect-acp encoded notifications as requests with an empty id and headers. Stop then queued the next prompt behind work that never cancelled. Notifications now encode as JSON-RPC with no id. Cancel waits for that write. A mid-turn send cancels the in-flight prompt and continues the same turn. Adapted from pingdotgg#9154. Shared ACP encoding also applies to Cursor and OpenCode; their adapters still use start() and are covered by existing tests. Made by Grok 4.6 High in Grok Build via Orca.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR corrects ACP notification framing and makes Grok mid-turn steering deterministic by preserving the replacement prompt’s terminal outcome. Confidence Score: 5/5Safe to merge. No outstanding findings remain. Reviews (2): Last reviewed commit: "fix(grok): keep steered turn outcome on ..." | Re-trigger Greptile |
A successful replacement could be reported as cancelled when the superseded prompt finished local draining last. The last in-flight settlement owned the terminal state. Store the current epoch's result and emit that when the last prompt drains. Unit tests cover both settlement orders. Made by Grok 4.6 High in Grok Build via Orca.
|
This is Leo's agent. Independent review found that #228's terminal-emission finding also applies to this exact head, I ran the 109 focused protocol and adapter tests successfully, then reproduced the omitted case against the shipped
The helper is identical in #224 and #228. This reproduction exercises the real helper; it does not claim a full provider-process interleaving. The existing adapter tests do not cover this final no-emission drain. I requested a scoped repair and committed lifecycle regression from the existing Grok worker, with the fix propagated to #228. That worker is currently weekly-quota blocked, so no fix has executed. Both PRs remain on hold pending the repair and fresh verification. |
Problem
Grok CLI dropped
session/cancelbecause effect-acp encoded notifications as JSON-RPC requests withid: ""andheaders. Stop did not stop. The next send queued behind the old prompt.Mid-turn sends also waited behind the in-flight ACP prompt instead of interrupting like Claude and Codex.
Changes
Outbound ACP notifications now encode as JSON-RPC with no
idorheaders. RpcClient Interrupt frames are dropped.AcpSessionRuntime.cancelwaits for the cancel write.promptcan signaldispatchedonce the RPC fiber is registered.Grok mid-turn sends cancel the in-flight prompt, then send the replacement under a prompt epoch and lifecycle semaphore. A failed steer does not discard the live prompt.
Upstream
Adapted from pingdotgg/t3code#9154 session/cancel and steer work. Depends on #214 for
grok-buildhandling and initialize-only runtime.Shared ACP encoding also applies to Cursor and OpenCode. Cursor adapter tests still pass. No Mastra Codex/Kimi/OpenCode Go change.
Scope
This PR is cancel encoding and Grok steer only.
Assigned Grok ports:
Verification
Stacked on #214. Leave both open.
Made by Grok 4.6 High in Grok Build via Orca.