← Back to Pull requests

feat: Sleep Background Tabs from menus, multi-select, and Command Bar #4937

Open
unknown opened this pull request with 501 lines diff across 6 files
View on GitHub
unknown unknown commented on Nov 29, 2026 23:44 UTC
Author

Problem

Putting tabs to sleep manually today works one tab at a time from a single tab's context menu. When a workspace accumulates dozens of idle tabs, there is no way to sleep all eligible background tabs at once or sleep a multi-selected group from the sidebar menus, the Tab menu, or the Command Bar.

Change

  • Added sleepableBackgroundTabIds and sleepBackgroundTabs in apps/browser/src/state/tabs/manualSleep.ts to find and sleep eligible background tabs in the active window/workspace while skipping active, pinned, playing-audio, or already-sleeping tabs, surfacing a toast with slept and kept-awake counts.

  • Wired the sleepBackgroundTabs command through commandCatalog.ts, browserCommand.ts, CommandTable.swift, MainMenu.swift, appMenu.ts, commandInteraction.ts, automationCommands.ts, barActions.ts, and sidebar/commands.ts.

  • Added "Sleep Background Tabs" to the sidebar menu and overflow menu, "Sleep Other Tabs" to the single-tab context menu, and "Sleep N Tabs" to the multi-tab selection menu.

  • Recorded background_sleeps_from_menu and selection_sleeps_from_menu counters in tabSleepCounts.ts behind telemetry consent, and updated copy.ts and consent-reach-baseline.json.
  • Verification (screenshots and videos)

  • pnpm typecheck: 11/11 packages passed (@ardia/browser, @ardia/desktop linux/win/mac, @ardia/demo).

  • Targeted @ardia/browser tests (sleepAsks.test.mjs, menus.test.mjs, barActions.test.mjs, commandCatalog.test.mjs, automationCommands.test.mjs, menuState.test.mjs, conventions.test.mjs, consentConventions.test.mjs, consentReach.test.mjs, pluginMarkdown.test.mjs, elementPicker.test.mjs): all passed.

  • @ardia/desktop host tests: appMenu.test.mjs and hostSync.test.mjs 42/42 passed; test:host linux 1415/1416 (1 pre-existing todo, 0 fail), win 1350/1351 (1 pre-existing todo, 0 fail).
  • AI was used for assistance.

    Demo


    !demo
    <video src="https://mvanhorn.github.io/pr-demo-assets/ardia/2026-11-29-110-feat-sleep-background-tabs/out.mp4" controls width="720"></video>

    <!-- codesmith:footer -->
    ---
    <a href="https://dashboardbackend.blacksmith.sh/track/run-proof?expires=1798587879&installation_model_id=450067&pr_number=4937&ref=codesmith_pr_footer&repository=ardia-browser%2Fardia&return_to=https%3A%2F%2Fgithub.com%2Fardia-browser%2Fardia%2Fpull%2F4937&variant=run_proof_on_this_pr&signature=b7952061519290ebf8e8e05ef801cdcaf7d9b621124a8963c980059d4a6aac8e"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-run-proof-on-this-pr-v2-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/proof-run-proof-on-this-pr-v2-light.svg"><img alt="Run Proof on this PR" src="https://pr-comments-assets.blacksmith.sh/codesmith/proof-run-proof-on-this-pr-v2-dark-3x.png" width="168" height="28"></picture></a>
    <sup><a href="https://app.blacksmith.sh/ardia-browser/codesmith/ardia/pr/4937?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup>

    <!-- codesmith:autofix:disabled -->
    <!-- /codesmith:footer -->

    <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    New Features
    Added “Sleep Background Tabs” to browser commands and File menus.
    Added options to sleep eligible background tabs from the command bar, sidebar, and overflow menu, or sleep other and selected tabs from tab menus.
    Sleep actions show how many tabs slept or stayed awake, with updated usage counts.
    Documentation
    Updated tab-discarding guidance with sleep behavior, settings, and bulk-sleep details.
    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 501 lines (+375 / -126) across 6 files Reviewer: mvanhorn Review duration: 910m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.48) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 501 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.372
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #4937"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.5% (MEDIUM) · Higher = larger blast radius
    47.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.1% · Safe to merge
    27.1%