cmux NEXT spaces: hidden-space hibernation follow-ups (exports, re-armed deadline, agent policy)

TE
4d ago
+142-32

Follow-up to #30666 (hidden-space hibernation, leo-workspace design/spaces.md "Hibernation and the perf plan").

Leo, 2026-10-29: "...new windows being like new spaces, incognito spaces, etc... this could legit make our thing more useful than chrome by having windows be switchable in this way. think of the potential perf savings~"

#30666 was merged at 01e8059 before two of its own pieces landed:

  • its regenerated settings exports;
  • an independent review.

This PR finishes it.

What changes

  1. Settings exports regenerated (schemas/settings/settings-schema.json, docs/mdm/*, the docs settings reference) for workspaces.hibernation.hiddenSpaceMinutes. They come from scripts/cmux-next/regenerate-settings-exports.sh on the fleet (step 222a3938c3f94afd8319a3c0). Without them, SettingsSchemaExportTests and the export checks are red on base from #30666. That red is ours.
  2. A newly hidden space is re-planned (cubic P1 on #30666, then the BLOCK at 094c93a). The pending deadline was planned on the old shown set at the normal 60-minute clock. A window that switched space could then hide a space whose workspaces should come due at 15 minutes, and the pass waited out the later deadline instead. Now a workspace leaving the shown set, or a space leaving the shown spaces, arms a pass a minute out, but never postpones a pass already due sooner, so switching back and forth cannot starve it. The existing shown-set follow also reads hibernationShownSpaces(), so a switch that hides a space without changing the shown workspaces is caught. There is no new timer: it is the same DemandTimer deadline, stop() still cancels it, and the plan still cancels it when nothing will come due.
  3. hiddenSpaceMinutes is .userOnly for agents, like the other two hibernation rows (cubic P2).
  4. Test cleanup: the coordinator tests remove their UserDefaults domain (cubic P2).
  5. Bench (bench_workspace_hibernation.py --hidden-spaces K):
    • one setup path for both modes (cubic P3);
    • at most 7 hidden spaces, since space.selectByNumber reaches spaces 2 to 8 (cubic P2);
    • the doc names the uncounted first workspace of a new space, and the requirement that --hidden-minutes exceed the setup time (cubic P2).

Commits:

  1. Failing test.
  2. Fix.
  3. Exports.
  4. Failing tests for the review's starvation and same-workspace cases.
  5. Their fix.
  6. A base merge.

Open follow-ups:

  • #30854: window open and close are not observed.
  • #30855: the measurement.

Tested on the fleet at fbf44f9 (step 8899f6c5f0650e1c421d8c11), with SettingsSchemaExportTests also passing: HiddenSpaceHibernationTests, HiddenSpaceHibernationCoordinatorTests, WorkspaceHibernationPlannerTests and WorkspaceHibernationTests pass.

Performance

Not measured. Neither the before nor the after harness run could start: scripts/measure/tab-hibernation.sh builds the app with the same-tree cmux-tui, and no feat-cmux-next commit in the last 15 has published one. Fleet step 27ba501588647a5bb865b20c reported "no cmux-tui artifacts run will publish tree 590d14ee…"; the base cmux-tui clippy and ratchet reds are being fixed in #30555, #30630 and #30661. The harness is ready:

cmux-ci run --class exclusive --label measure --script scripts/measure/tab-hibernation.sh --ref <sha> --arg=--workspaces=6 --arg=--hidden-spaces=3 --arg=--hidden-minutes=5 --arg=--config=bench

The run measures:

  • before vs after: 1 window, 3 hidden spaces of 6 workspaces each, past the threshold;
  • footprint, RSS, renderer RSS, idle CPU and wakeups/s;
  • switch-back time to the first usable page.

#30855 tracks the run and the threshold check for the shipped 15 minutes.

metricbeforeafterdeltaharness or run link
total footprint, 3 hidden spaces past thresholdnot runnot runn/astep 27ba501588647a5bb865b20c (blocked: cmux-tui tree unpublished)

Agent session: agent session

🤖 Generated with Claude Code