Skip to content

v3.4.5: quieter background work, stable Remote Control, and Keychain-free Cursor usage - #193

Open
aashutoshrathi wants to merge 14 commits into
mainfrom
release/v3.4.5
Open

aashutoshrathi wants to merge 14 commits into
mainfrom
release/v3.4.5

Conversation

@aashutoshrathi

Copy link
Copy Markdown
Owner

v3.4.5

Less background work, a Remote Control server that restarts cleanly, and Cursor usage without a Keychain prompt.

Changed

  • Quieter background work. Toki scans agents once a minute while the popover is closed and idle. While the popover is open, an agent needs input, or Remote Control is running, it scans every 15 seconds. Opening the popover still scans immediately, and repeated manual refreshes share one follow-up scan instead of overlapping.
  • Fewer menu-bar redraws. The menu bar redraws only when a quota readout, input count, Remote Control indicator, or display density actually changes.
  • Tailscale checks only when they matter. Toki polls Tailscale while Settings is visible and Remote Control uses Tailscale or the hosted companion app. Concurrent status requests share one check, and unchanged values no longer trigger UI updates. Opening Settings rechecks a stopped or LAN setup, and a successful HTTPS setup re-reads the status instead of reusing the pre-setup result.
  • Cursor usage without a Keychain prompt. Toki reads Cursor usage from a plaintext desktop sign-in or an existing CLI session in ~/.cursor/auth.json. If neither is available, the card shows local activity. The Connect Cursor Usage action is gone, so a refresh never opens a macOS permission dialog.

Fixed

  • Remote Control survives a closed pipe. If the companion closes its input, Toki reports a write error instead of terminating with SIGPIPE.
  • Remote Control restarts cleanly. A restart waits for the old server to release port 8765 before starting the replacement, so it no longer fails with "address in use". Stop stays available while the replacement waits, and output or exit from the replaced server can no longer change the new server's state or stop its tunnel.
  • Remote Control snapshots stay fresh. Replacing the snapshot pipe invalidates the old heartbeat timer, so only the current pipe receives heartbeats.

Verification

  • swift test -Xswiftc -strict-concurrency=complete: 778 tests, 0 failures.
  • Focused Remote Control, Tailscale, and agent suites: 93 tests, 0 failures.
  • git diff --check: clean.

thepushkarp and others added 14 commits November 25, 2026 09:50
🪷 Generated with Sarvam Code

Co-authored-by: Sarvam Code <code@sarvam.ai>
Keep Cursor usage refreshes free of sign-in prompts
Suppress SIGPIPE on the companion input descriptor before initial snapshots or heartbeat writes. A closed child reader now produces a catchable write error instead of terminating the menu-bar app.

Add a closed-reader regression covering initial descriptor setup, heartbeat writes, snapshot updates, and timer shutdown. Verified with the 71-test RemoteControlServer suite.
A successful serve command could join an in-flight status read that captured the previous configuration. Queue one trailing read for explicit post-setup requests while ordinary polls continue to share the current task.

Keep stale results from publishing and preserve cancellation generation guards. Cover coalescing, completed-task cleanup, and replacement rechecks with explicit reader handshakes instead of Task.yield assumptions.
Refresh setup details once when Settings becomes visible, including when Remote Control is stopped or using LAN. Keep periodic polling restricted to visible, relevant settings and suppress duplicate entry refreshes.

Defer the popover-show visibility check until its delegate has updated the store. Test entry, reopen, relevance transitions, and cancellation using an injected tick publisher.
Allow UsageStore construction without automatic startup while preserving the production default. Agent tests explicitly start only the injected scanner and timer, avoiding user configuration, provider discovery, and connectivity work.

Clean up test timers and guard controlled continuations. Exercise timer wiring separately from synchronous in-flight coalescing to remove scheduler-order assumptions. All five agent energy tests pass.
Use SwiftUI object ownership to construct the polling controller lazily once per Settings view lifetime, avoiding unused controller and publisher allocations on parent updates. Polling visibility and relevance behavior is unchanged.
Make snapshot publishing own exactly one repeating timer when its pipe is replaced. Add a two-pipe regression proving the old timer cannot emit and stopping invalidates the current timer.
stop() now retains the retiring process and launches a queued start only after that exact process exits, so a restart cannot race the old server for port 8765. Start intent is published as isStarting, which keeps Stop reachable while the replacement waits.

Companion and tunnel callbacks capture their owning server and originating process weakly and ignore anything that is no longer the active instance, so queued output or termination from a replaced process cannot mutate the new server state or stop its tunnel. An unexpected companion exit now stops its tunnel too. Tunnel output is parsed on the reader queue, so repeated cloudflared log chunks no longer dispatch main-actor work once the URL is known.

Add lifecycle regressions with fake processes, injected exit waiters, and an injectable callback dispatcher covering restart serialization, cancelled relaunches, latest host mode, stale output and termination, tunnel ownership, and failed launches. Manual handler calls use a closed pipe and bounded reads so they cannot block the runner.
Cover the Cursor Keychain-free usage path and the Remote Control pipe, restart, and heartbeat fixes alongside the existing background-work changes.
@vercel

vercel Bot commented Nov 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
toki Ready Ready Preview Nov 26, 2026 12:49pm UTC

This branch was successfully deployed

1 active deployment
Preview — 5dd1670f Deployed Nov 26, 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.

2 participants