Repository navigation
cmux NEXT spaces: hidden-space hibernation follow-ups (exports, re-armed deadline, agent policy) #30815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
teamleaderleo
merged 6 commits into
feat-cmux-next
from
lane/spaces-hidden-hibernation-followup
Nov 1, 2026
Merged
cmux NEXT spaces: hidden-space hibernation follow-ups (exports, re-armed deadline, agent policy) #30815
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
e7a52d9
test(cmux-next): a switch that hides a space re-arms a later pending …
teamleaderleo 5e69276
fix(cmux-next): hidden-space hibernation follow-ups to #30666
teamleaderleo 094c93a
chore(cmux-next): regenerate settings exports for hiddenSpaceMinutes …
teamleaderleo f0211b7
test(cmux-next): repeated switches never postpone an armed hibernatio…
teamleaderleo fbf44f9
fix(cmux-next): re-plan hidden spaces without postponing an armed pass
teamleaderleo 5f8e273
Merge remote-tracking branch 'origin/feat-cmux-next' into lane/spaces…
teamleaderleo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,10 @@ | |||||||||
|
|
||||||||||
| --hidden-spaces K (leo-workspace design/spaces.md, "Hibernation and the perf plan") measures | ||||||||||
| hidden-space hibernation instead: K new spaces of --workspaces workspaces each (the same terminal | ||||||||||
| and page), then the window goes back to the default space, so the K spaces are hidden. Nothing asks | ||||||||||
| and page; K is 1 to 7, as `space.selectByNumber` reaches spaces 2 to 8), then the window goes back | ||||||||||
| to the default space, so the K spaces are hidden. A new space's own first workspace stays empty and is | ||||||||||
| not counted. Space k's hidden clock starts when the window leaves it, so --hidden-minutes must exceed | ||||||||||
| the setup time: shown-settled records how many were already hibernated (app_counts). Nothing asks | ||||||||||
| for hibernation: cmux.json sets `workspaces.hibernation.idleMinutes` to a week and | ||||||||||
| `hiddenSpaceMinutes` to --hidden-minutes (default 5, the setting's minimum). Phases, each with | ||||||||||
| --idle-seconds of idle CPU and wakeups: | ||||||||||
|
|
@@ -172,7 +175,8 @@ def marker_shown(): | |||||||||
|
|
||||||||||
|
|
||||||||||
| def build_workspace(app: bm.App, sock: str, port: int, index: int) -> dict | None: | ||||||||||
| """One bench workspace in the window's current space: a terminal with a marker and a scrolled page.""" | ||||||||||
| """One bench workspace in the window's current space: a terminal with a marker and a scrolled page. | ||||||||||
| The typed command does not contain the marker (printf builds it), so only its output shows it.""" | ||||||||||
| created = app.run("workspace.newAtBottom") | ||||||||||
| workspace = next((str(i) for i in created.get("created", []) if str(i).startswith("ws_")), None) | ||||||||||
| if workspace is None: | ||||||||||
|
|
@@ -323,6 +327,8 @@ def run(argv: list[str]) -> int: | |||||||||
| args, _ignored = parser.parse_known_args(argv) # tab-hibernation.sh's own flags (--tabs, --pressure...) do not apply | ||||||||||
| if sys.platform != "darwin": | ||||||||||
| raise SystemExit("bench-workspace-hibernation: macOS only (a fleet or capture mini)") | ||||||||||
| if args.hidden_spaces > 7: | ||||||||||
| raise SystemExit("bench-workspace-hibernation: --hidden-spaces is at most 7 (space.selectByNumber reaches spaces 2 to 8)") | ||||||||||
|
Comment on lines
+330
to
+331
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P3: A negative Prompt for AI agents
Suggested change
|
||||||||||
| if args.hidden_spaces > 0: | ||||||||||
| return run_hidden_spaces(args) | ||||||||||
| port = serve(args.heap_mb) | ||||||||||
|
|
@@ -337,26 +343,9 @@ def run(argv: list[str]) -> int: | |||||||||
| made: list[dict] = [] | ||||||||||
| try: | ||||||||||
| for index in range(args.workspaces): | ||||||||||
| created = app.run("workspace.newAtBottom") | ||||||||||
| workspace = next((str(i) for i in created.get("created", []) if str(i).startswith("ws_")), None) | ||||||||||
| if workspace is None: | ||||||||||
| print(f" workspace {index}: {created}", file=sys.stderr) | ||||||||||
| continue | ||||||||||
| app.action("goToWorkspace", workspace=workspace) | ||||||||||
| terminal = created_tab(app.run("newSurface")) | ||||||||||
| # The typed command does not contain the marker (printf builds it), so only its output shows it. | ||||||||||
| marker = f"WSHIB-{index}-DONE" | ||||||||||
| if terminal: | ||||||||||
| bp.rpc(sock, "action.run", {"action": "terminal.sendText", "target": f"tab:{terminal}", | ||||||||||
| "args": {"text": f"seq 1 400; printf 'WSHIB-%s-DONE\\n' {index}\r"}}) | ||||||||||
| url = f"http://s{index}.localhost:{port}/?w={index}" | ||||||||||
| page = created_tab(app.run("openBrowser.chromium", url=url)) | ||||||||||
| if page is None or terminal is None: | ||||||||||
| print(f" workspace {index}: terminal={terminal} page={page}", file=sys.stderr) | ||||||||||
| continue | ||||||||||
| if evaluate(sock, page, SET_SCROLL) is None: | ||||||||||
| print(f" {page}: page did not answer", file=sys.stderr) | ||||||||||
| made.append({"workspace": workspace, "terminal": terminal, "page": page, "url": url, "marker": marker}) | ||||||||||
| entry = build_workspace(app, sock, port, index) | ||||||||||
| if entry: | ||||||||||
| made.append(entry) | ||||||||||
| front = app.run("workspace.newAtBottom") | ||||||||||
| front_ws = next((str(i) for i in front.get("created", []) if str(i).startswith("ws_")), None) | ||||||||||
| if front_ws: | ||||||||||
|
|
||||||||||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Closing the last window in a space does not invalidate this observation because
WindowManager.controllersis not observable. The hidden-space deadline can therefore remain based on the old shown-space set; make window lifecycle changes trigger the hibernation re-plan.Prompt for AI agents