Skip to content

Open the thread's simulator tab when its agent starts driving (opt-in) - #4

Open
dhiyaancnirmal wants to merge 1 commit into
vburojevic:mainfrom
dhiyaancnirmal:feat/auto-open-simulator-panel
Open

Open the thread's simulator tab when its agent starts driving (opt-in)#4
dhiyaancnirmal wants to merge 1 commit into
vburojevic:mainfrom
dhiyaancnirmal:feat/auto-open-simulator-panel

Conversation

@dhiyaancnirmal

@dhiyaancnirmal dhiyaancnirmal commented Sep 2, 2026

Copy link
Copy Markdown

What

A new boolean setting, openSimulatorOnDrive, off by default. When it is on and a thread takes the simulator lease through the agent tools or the CLI, its simulator tab opens in that thread's side panel — so you watch what the agent does without going looking for it.

Also offered in the panel's gear menu, since it is presentation only: the worst a same-user caller can do by flipping it is open a panel. allowAgentCapture stays where it is.

How

  • Server (src/sim/wire.ts): the leases.acquire wrapper already knows the invoking thread. On a successful acquisition by a thread (not the panel's null), with a live device and the setting on, it publishes { threadId, deviceUdid } on a new simulator-driven channel. Separate from simulator-changed so the panels that refetch on every state signal do not pay for one that is not about state.
  • Session, not lease (src/sim/announce.ts): every tool call takes and releases the lease, so announcing per acquisition would reopen the tab on every gesture — including a tab the person had just closed. DriveAnnouncer collapses acquisitions by one thread with no gap longer than 90s (the lease TTL) into one announcement at the start. A closed tab stays closed until the agent has been quiet and comes back.
  • Client (app/sim/useOpenOnDrive.ts): a hook on the composer banner, which is the one per-thread surface with the thread id and navigation in scope. On a signal naming its thread it calls openThreadPanel({ actionId: "simulator" }). Opening the same action twice focuses the existing tab. No params: the thread panel already mirrors the live device, which is the one being driven.

Tests

  • test/sim/announce.test.ts — session window semantics (first touch, sliding window, exact boundary, per-thread independence, forget).
  • test/sim/options.test.ts — the new key is in both the allowlist and the presentation enumeration.
  • npm run check passes.

I did not add a server-level test for the publish itself: the wrapper only announces with a live device, and the server harness has no way to fake one. The wrapper is six lines; happy to add a seam if you'd like one.

Verified

On bb 0.41.0 / macOS 26.5 / Xcode 27 beta: with the setting on, bb xcode sim drive "tap 0.5,0.5" from a thread opens that thread's simulator tab. With it off, nothing changes.

Note: on a git install this needs #3 to get past the doctor at all; the branches are independent.

A new boolean setting, openSimulatorOnDrive, off by default and also offered
in the panel's gear menu. When it is on and a thread takes the simulator
lease through the agent tools or the CLI, the server publishes a
simulator-driven signal naming that thread, and the thread's composer opens
the simulator threadPanelAction in its own side panel.

A driving session, not a lease, is what gets announced: every tool call takes
and releases the lease, so DriveAnnouncer collapses acquisitions by one thread
with no gap longer than 90s into one announcement at the start. A tab the
person closes therefore stays closed until the agent has been quiet and comes
back, rather than reopening on the next gesture.

The signal rides its own channel so the panels that refetch on every
simulator-changed signal do not pay for one that is not about state.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-02T00:05:22.822488Z f9de340 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f9de3404c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/sim/wire.ts
Comment on lines +617 to +618
if (outcome.ok && threadId !== null && device !== null && drives.touch(threadId)) {
if (settings.openSimulatorOnDrive) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reset session tracking when enabling auto-open

When openSimulatorOnDrive is disabled, every successful acquisition still calls drives.touch(threadId) and advances the session window. If a user enables the option within 90 seconds of such an acquisition, the agent's next drive returns false from touch, so no signal is published and the newly enabled setting appears ineffective until the thread has been quiet for the full window. Only record touches while the option is enabled, or forget existing sessions when it transitions from off to on.

Useful? React with 👍 / 👎.

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