Skip to content

fix(desktop): linear path trim, prompt Stop between keystrokes, clear a closed session's input marker - #8753

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/desktop-review-findings
Oct 7, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/desktop-review-findings

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

Fixes three review findings from #8748 in the desktop app and bridge.

  • Polynomial path trim (CodeQL 516): /\/+$/ is quadratic on a long run of / that stops short of the end. Moved the backward-scan stripTrailingSlashes from sim-cli into @sim/utils/string and used it in the bridge's grep, plus the two sibling sites in the desktop's local filesystem service (grep authorization and glob pathPrefix), which run the same model-supplied path on the main process.
  • Stop between keystrokes: settleBetweenKeystrokes() ignored the Stop signal, so pressKeys/type against a program that redraws constantly could hold Stop for ~1.15 s. It now takes the signal, sleeps with interruptibleSleep, and leaves the loop on abort. The existing post-settle guard still keeps any further input from being sent.
  • Stale input marker: closeLiveTabs() didn't clear userIntervention, so after closeSession() reset tab ids, a new tab "1" inherited the old marker and the agent waited up to 4 s. Cleared alongside the other per-tab flags.

Type of Change

  • Bug fix

Testing

Each fix has a regression test, checked red against the original source:

  • bridge: 200k slashes + x grep path takes 23.6 s before, <1 s after; trailing-slash path still resolves to the same folder
  • desktop local filesystem: the same input through grep authorization and glob pathPrefix takes 40.9 s before, <1 s after
  • terminal: Stop mid-settle while output keeps flowing resolves within 1 ms and only the first chunk is written (before: still pending)
  • browser agent: note an intervention, close the session, reopen tab "1": msSinceUserIntervention() is null (before: 1)

apps/desktop: tsc, biome, vitest (1052) green. desktop-bridge: type-check, tests, biome green. Root: check:comment-hygiene, check:desktop-bridge, check:desktop-ipc green.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@vercel

vercel Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 7, 2026 6:12pm UTC

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 11 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 11 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@greptile-apps

greptile-apps Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Fixes terminal keystroke handling and path trimming edge cases.

The PR appears safe to merge.

What we checked:

  • Stop sends no further input: Both input methods check the aborted signal after the wait and return before sending another key or text chunk.
  • Closed tabs lose old activity: closeLiveTabs removes every live tab before clearing userIntervention. The marker describes activity in those closed tabs, not a surviving page.

Summary

Fixes three desktop delays without changing public APIs.

  • Shares a backward-scan stripTrailingSlashes helper across filesystem searches and CLI endpoint cleanup.
  • Makes waits between terminal keystrokes end on Stop.
  • Clears old user activity when browser sessions close.
  • Adds regression tests for each fix. No actionable issues were found. Tests were inspected, not run during this review.

Reviews (1) · Last reviewed commit: "fix(desktop): linear path trim, prompt S..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit 1a4a156 into staging Oct 7, 2026
38 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/desktop-review-findings branch October 7, 2026 19:19

This branch was successfully deployed

1 active deployment
Preview — ca722517 Deployed Oct 7, 2026 by vercel[bot]
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