Skip to content

Skip command history when stopping ordinary chat replies - #34320

Merged
brennanb2025 merged 2 commits into
mainfrom
brennanb2025/sta-11949-stop-read
Oct 27, 2026
Merged

brennanb2025 merged 2 commits into
mainfrom
brennanb2025/sta-11949-stop-read

Conversation

@brennanb2025

@brennanb2025 brennanb2025 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​48 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​4 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​3

The problem

When you press Stop on a native chat while the agent is writing an ordinary reply, Orca first looked through the chat's entire message history before stopping it. That lookup only matters when the running thing is a command such as Claude's /compact (which summarizes the conversation), where Orca needs to know whether you already pressed Stop on that command once. For an ordinary reply it could never change the answer, so it was wasted work that grew with the length of the chat.

What this PR changes

  • Pressing Stop on an ordinary chat reply no longer reads through the chat's history first. It stops the reply exactly as before.
  • Pressing Stop on a running command (like /compact) still checks whether it was already stopped, at the same moment as before: before the stop is accepted and before Orca adds its new "stopped" note to the chat.

How it works: before doing the history lookup, Stop now asks whether the running turn is a command, using the same check Orca already uses elsewhere to tell commands apart from ordinary replies. If it is not a command, the lookup is skipped.

What stays the same

  • What Stop actually stops, the "Interrupted" result, how the agent process is closed, what is saved, and what phones and other connected apps see are all unchanged.
  • This PR does not claim Stop as a whole feels faster. It removes one unneeded read, and only that read was measured.

How it was tested

  • A new test stops an ordinary reply and checks that the history lookup is never called. It failed before the change and passes after.
  • The existing /compact Stop tests now also check that the lookup still runs exactly once for a command, with the right command, before the new stop note.
  • A benchmark on realistic saved chats of 1,000 and 10,000 items showed the ordinary-reply Stop going from reading every item to reading none, while /compact Stops kept the same reads and results.
  • 64 related chat Stop tests pass; CI is green.
  • No run in the real app was needed: nothing a user sees changes, so the automated tests cover it.

Tracked in STA-11949.

@brennanb2025
brennanb2025 marked this pull request as ready for review October 27, 2026 08:10
@coderabbitai

coderabbitai Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent 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: 8abb7239-468e-460f-8c93-598dcd1873ea
Commits

Reviewing files that changed from the base of the PR and between d1f3532 and e0365a8.

Files selected for processing: 2
  • src/main/native-chat/agent-session-wire/structured-agent-session-chat-stop.ts
  • src/main/native-chat/agent-session-wire/structured-agent-session-claude-compact-stop.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

Walkthrough

The cancellation path now checks prior-stop history only when the target turn ID identifies a structured-agent-session command turn. Tests verify that cancelling an ordinary reply skips this check and that a hung /compact command checks its history once.

Priority: Low

Merge Risk: Minimal · up to e0365

Ordinary reply cancellation avoids the unnecessary history lookup while compact-command cancellation retains it. No actionable merge risk remains after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: skipping command-history checks for ordinary chat replies.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The pull request description clearly explains the problem, change, rationale, scope, testing, and tracked work. It does not use all template headings, does not provide the required issue-link format (…
Full details: Description check

Explanation

The pull request description clearly explains the problem, change, rationale, scope, testing, and tracked work. It does not use all template headings, does not provide the required issue-link format (Fixes #...), and does not state N/A for visual proof, but the description is substantially complete and on-topic.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@brennanb2025

Copy link
Copy Markdown
Contributor Author

Ordinary native-chat Stop scanned command history even though an ordinary reply could not use that evidence. The change skips that read using the existing command-turn identity check, while preserving compact first/repeated Stop behavior and the lookup before acceptance/new note.

Full review: correctness and architecture reviews found no defects; the dedicated performance pass found no added scaling work or resources. No production fix was needed. Kept the single regression and compact positive-path assertion; deferred only optional fixture shortening.

Verified: 64 selected host/renderer tests passed. The new regression failed before the patch, and the compact case invokes the real history reader once with the original ID and returns false before its new Stop note. A bounded production-journal benchmark at 1,000 and 10,000 representative items verified ordinary history visits fall from N to zero, for warm and cold snapshots; first/prior compact controls keep the same counts and results. This measures the history-check seam, not complete Stop latency.

The changed flow is performance/tests-row: no lifecycle/ownership, agent adapter, client protocol, or screen appearance change. Real-agent app QA and screenshots were not run. No whole-Stop latency claim is made. The final mechanism review confirmed current-work identity, refusal rules, compact ordering and the existing saved/remote contracts. CI is green on e0365a8, including lint/typecheck, all five unit shards, selection evidence, Linux/Windows packaging, WSL, mobile and persistence checks. The initially cancelled PR-check workflow was completed with a failed-jobs-only retry; completed workflows were retained. The final head includes the no-conflict main merge e0365a8; the two-file branch change is identical to the reviewed production commit.

For Brennan’s review: the command-only history capture and the ordinary/compact regression contracts.

@brennanb2025
brennanb2025 merged commit 32a9b3b into main Oct 27, 2026
81 of 94 checks passed
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