Skip to content

improvement(desktop): ship the background executor without a flag, close its QA gaps - #8782

Merged
waleedlatif1 merged 7 commits into
stagingfrom
improvement/desktop-executor-always-on
Oct 8, 2026
Merged

waleedlatif1 merged 7 commits into
stagingfrom
improvement/desktop-executor-always-on

Conversation

@waleedlatif1

@waleedlatif1 waleedlatif1 commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Ship the desktop background executor without the mothership-desktop-background-executor flag. The executor now runs wherever Sim can track desktop presence, which means wherever Redis is configured. Installs without Redis keep running desktop tools in the chat window. Organization surfaces never show desktop activity, and runs that are already bound are unaffected.
  • The flag gate becomes isDesktopBackgroundExecutorAvailable(). The client learns availability from a server-computed desktopExecutorAvailable prop on the workspace sidebar instead of the feature-flag map. I removed the registry entry, the MSHIP_DESKTOP_BACKGROUND_EXECUTOR fallback and the CI env export.
  • Fix a background terminal run that was refused when the shell's startup files stopped to wait for input, such as an update prompt. The app waited a flat 8 s for the first prompt and then blamed shell integration. The generated zsh/bash startup files now emit a startup marker before the user's rc runs:
    • With no marker within 8 s, the run is refused as before.
    • With the marker, the shell gets 30 s from the marker to reach a prompt. Past that, the run is refused with the screen the shell is stuck on.
    • Stop ends the wait.
  • Close the executor's QA gaps:
    • E2E reports are written per check, so a Playwright worker restart can no longer wipe a failure.
    • The fixture shells run with an empty ZDOTDIR.
    • The fixture Sim cuts the network at the socket level.
    • A new test shows that a call declined in a background chat is never claimed or run.
  • Update the live desktop suite for the executor being on. Its Sim has Redis, so every turn now binds to the app.
    • The chat-view tests run against a registration answered the way an install without Redis answers it.
    • Two new tests let Sim's real answer through: a call issued after the user switches chats runs on the desktop, and a result reported across a network cut reaches the agent exactly once. In that test the first report lands late and the retry is deduplicated.

After deploy: the mothership-desktop-background-executor entry in the staging AppConfig feature-flags document is unused. An operator should remove it. The infra validator only checks the document's shape, so it needs no change.

Type of Change

  • Feature
  • Bug fix

Testing

  • Type checks for apps/sim and apps/desktop pass, as do biome, check:comment-hygiene, check:api-validation, check:client-boundary, check:application-graph and check:unused-exports.
  • Sim unit tests pass: 49 files, 381 tests across the sidebar, workspace and org layouts, lib/desktop and the feature-flag config. A new layout test checks that the sidebar receives presence availability.
  • Integration tests for the executor, bound turns and activity pass, 51 of 51, with no flag mock. Each case where presence is unavailable is checked to write nothing and leave turns unbound.
  • Red runs: the layout tests fail on the old layout, and the presence-unavailable integration cases fail when the gate is forced on.
  • Desktop vitest: 1068 tests pass. These include a regression test for a startup marker that arrives late, which checks that the 30 s bound runs from the marker.
  • Playwright, run locally:
    • background-executor, terminal-cancel and check-report: 25 of 25 pass.
    • desktop-tools-live-sim against a local Sim with Redis: 12 of 12 pass. Before the suite update, it failed from the first test.

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)

…a run

A background terminal run on a fresh shell waited a flat 8 s for the first
prompt and then failed with NO_SHELL_INTEGRATION. A startup file that stops
at a question (oh-my-zsh's update prompt) holds the prompt indefinitely, so
the run failed with a message blaming the shell's integration.

The generated startup files now send a SimStartup marker before any of the
user's files run. A shell that never sends it within 8 s of spawning is not
instrumented and is refused as before (an unsupported shell at once). One
that did gets 30 s to reach its prompt, which tolerates slow startup files
on a busy machine; past that the run is refused with the screen it is stuck
on, so the agent can ask the user to answer it. Stop now ends the wait, and
a shell that exits mid-wait reports SESSION_CLOSED.
…rk cut

- background-executor and terminal-cancel record each check through one
  shared helper as it finishes. The background-executor report was written
  from module state in afterAll, so a worker restart after a failure wiped
  it and the report could read green. Reports from an earlier run are
  replaced, not appended to. check-report.spec.ts forces a worker restart in
  a nested Playwright run and asserts the failure stays.
- The executor fixture launches the app with zsh and an empty ZDOTDIR, so a
  developer's .zshrc (an unanswered oh-my-zsh update prompt) cannot hold the
  first prompt and fail unrelated scenarios.
- Scenario B now cuts the network at the socket level: every open
  connection, the doorbell stream included, drops and new ones are reset.
  It asserts the result lands exactly once, the doorbell reopens, and new
  work is picked up after reconnecting.
…or run

The fixture Sim can now decline a held call the way Sim settles it, and the
executor suite checks the device never claims it and its command never runs
after the approval notification.
…r on

The live suite's Sim has Redis, so with the executor shipped always-on every
turn now binds to the app and runs in the background. The proxy answers the
app's registration as an install without Redis would, so the chat-view tests
keep covering that path, and the round trip asserts the app stays dormant.
Two tests let Sim's own answer through: a call issued after the user switched
chats runs on the desktop, and a result reported across a network cut (every
connection dropped, the first report landing late) reaches the agent exactly
once.
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Oct 8, 2026 4:15am UTC

Request Review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 8, 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.

All reported issues were addressed across 38 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/desktop/src/main/terminal/session.ts Outdated

@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.

All reported issues were addressed across 38 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread apps/desktop/src/main/terminal/session.ts Outdated
Comment thread apps/sim/lib/api/contracts/desktop-executor.ts Outdated
…iles began

The 30 s bound ran from spawn, so a shell whose startup marker arrived late
on a busy machine got less than the promised time for its startup files.
The deadline now starts at the marker.
@greptile-apps

greptile-apps Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Removes a feature flag for the background executor.

The PR appears safe to merge, with the previous helper finding fixed and no new actionable issues.

What we checked:

  • Startup waits still end safely: startupBegunAt is set only once. The wait has a fixed deadline, and Stop ends it before the command runs.

Summary

The PR enables the desktop background executor wherever Redis supports presence tracking, improves shell-startup waits, and strengthens end-to-end checks.

  • Since the last review, shells receive their full startup allowance from the first startup marker.
  • The previous helper finding is fixed: check-report.spec.ts now uses omit, as waleedlatif1 reported.
  • No new actionable issues or mounted-rule violations were found.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  Spawn[Shell starts] --> Marker{Startup marker within 8 seconds?}
  Marker -->|No| Refuse[Refuse command]
  Marker -->|Yes| Wait[Wait up to 30 seconds from marker]
  Wait --> Prompt{Prompt arrives?}
  Prompt -->|Yes| Run[Run command]
  Prompt -->|No| Screen[Refuse and show startup screen]
  Wait -->|Stop| Cancel[Cancel without running]
Loading

Reviews (2) · Last reviewed commit: "test(desktop): drop the outer runner's v..." · Reviewed by Greptile

Comment thread apps/desktop/e2e/check-report.spec.ts Outdated
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 8, 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 38 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

@waleedlatif1
waleedlatif1 merged commit 31a911d into staging Oct 8, 2026
41 checks passed
@waleedlatif1
waleedlatif1 deleted the improvement/desktop-executor-always-on branch October 8, 2026 04:20

This branch was previously deployed

1 inactive deployment
Preview — 405f729b Deployed Oct 8, 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