Skip to content

fix(cmux-next): await FolderChanges.events() in the machine consent watch (base Release compile red) - #27722

Closed
teamleaderleo wants to merge 1 commit into
feat-cmux-nextfrom
fix/consent-folderchanges-await
Closed

teamleaderleo wants to merge 1 commit into
feat-cmux-nextfrom
fix/consent-folderchanges-await

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the base red on feat-cmux-next: cmux-next/compile (SwiftPM Release, -Onone) has failed on every landing from 00d6d54 (#26517) on, 17 in a row as of 0da5bc3. While it is red, no NEXT nightly can build a newer commit, so the feed falls further behind the tip on every landing (Leo: "it is unacceptable to have nightlies >30min out of date").

Cause

#26517 made FolderChanges.events() async (it returns once its watches are registered). #27223 landed alongside it, and its MachineConsentChanges.events(armed:) in JoinConsent+App.swift calls FolderChanges(...).events() without await. Each PR compiled on its own base. Together they don't compile.

Change

  • MachineConsentChanges.events(armed:) is now async, and it awaits the folder's registration before it arms the files and runs armed. That keeps the documented order (folder, then files, then armed, then the first element) and gets cmux-next: FolderChanges.events() returns once its watches are registered #26517's stronger readiness guarantee.
  • Its one app caller (JoinConsent+App.swift:138) and the two JoinConsentTests call sites add await. The package enables NonisolatedNonsendingByDefault, so the non-escaping armed closure stays on the caller's actor.

5 lines changed. No behaviour change beyond the readiness await.

No capture: a compile fix with no visible change. The consent watch arms the same files in the same order, and no view changes.

Risk

Low. A compile fix on a type-checked call path. The fleet Release compile on this head is the check.

Agent session: agent session

🤖 Generated with Claude Code

…atch

#26517 made FolderChanges.events() async (it now returns once its watches
are registered). #27223 landed alongside it with MachineConsentChanges
calling events() synchronously, so feat-cmux-next stopped compiling in
Release from 00d6d54 on (cmux-next/compile red on every landing since),
and no NEXT nightly can build a newer commit.

MachineConsentChanges.events(armed:) is now async and awaits the folder's
registration before arming the files, which keeps its documented order;
its app caller and the two tests await it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Session: https://cmux.com/deeplink/agent?id=aid-fb75b7af9902231028aa
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Owned by an agent session · session

@blacksmith-sh

blacksmith-sh Bot commented Oct 30, 2026

Copy link
Copy Markdown

Found 1 test failure on Blacksmith runners:

Failure

Test View Logs
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)/
test_the_repository_highlights_validate (main.DigestTests.test_the_repository_highl
ights_validate)
View Logs

Fix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Superseded by #27758 (same fix), merged as cec0a36.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Independent review (Codex gpt-6-astra, high, fast) at 4f7825d: no P1/P2 findings. Swift 6 isolation, the async events() and its callers (every caller in the head tree awaits), task inheritance, arming order and the updated tests are consistent.

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Closing: #27758 (merged as cec0a36) makes the same fix, adding the missing await on MachineConsentChanges.events() and FolderChanges.events() in JoinConsent+App.swift plus both test call sites, and #27722 adds nothing beyond it. Base cmux-next/compile is fixed by #27758.

austinywang added a commit that referenced this pull request Oct 30, 2026
…y duplicates

- settings-schema.json, docs/mdm and the docs settings reference regenerated
  on the fleet (scripts/cmux-next/regenerate-settings-exports.sh, step
  933cf64a50016eb73c0e6fb9 on aws-m4pro-8) over this head plus the base
  compile fix of #27722; the PR autofix could not build them while the base
  fails to compile JoinConsent+App.swift. The merge had kept the PR's older
  schema, which read as reverted base defaults to the defaults guard.
- The release highlight gets the Open Settings action release-notary asks for.
- tests/test-execution.toml: the merge registered test_ci_runs_on_fallback.py
  and test_workflow_file_size.py twice (tooling-tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex-review-box/gpt-6-astra high, lane-place): SHIP at 4f7825d

SHIP

  1. No correctness findings. All FolderChanges.events() and MachineConsentChanges.events() callers are awaited; the folder → files → armed → initial yield order remains intact (JoinConsent+App.swift).

SHIP at 4f7825d

@teamleaderleo

Copy link
Copy Markdown
Collaborator Author

Review (codex gpt-6-astra high, review-job): SHIP at 4f7825d

No blocking findings.

lawrencecchen pushed a commit that referenced this pull request Nov 1, 2026
…s its own Freestyle VM (Fixes #26062) (#26078)

* cmux NEXT Cloud: Run New Workspaces in Cloud gives each new workspace its own machine

A Cloud toggle (cloud.newWorkspacesInCloud, Settings > Machines and the
palette's Toggle Setting, off by default). On, a person's New Workspace
runs the New Cloud Workspace flow with a new Freestyle machine for every
workspace. cloud.newWorkspaceFolder 'inherit' copies the git working copy
around the focused folder there (cmux link sync push, ~/work then
/root/work) and opens the terminal in the person's folder; 'empty' (or a
home folder, never copied) opens in the machine's home. Scripts, the CLI,
MCP and a named --machine keep their behavior.

Fixes #26062

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud: the Cloud toggle's settings text in every app language

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud toggle: Retry keeps the copied folder; signed out stays local; agents can't set it

The creation keeps its own open, so the progress view's Retry copies the
folder again instead of opening a plain workspace. Cmd-N stays on this Mac
while Cloud is signed out or unavailable, and a run with a command stays
local. An app that can't copy a folder (no bundled CLI, app server link)
starts the new machine empty instead of failing after making it. The two
keys are privacy-refused for agents and placed under Accounts on the
Settings page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud toggle: the plan and folder copy live in CmuxNextCloud; Settings' VM host store moves there too

The App takes no new file and no net growth: the toggle's decision and its
copy loop are CloudNewWorkspacePlan in CmuxNextCloud, the App keeps one
handler extension, and CloudVmHostStore (Foundation and CmuxNextCloud only)
moves to its domain package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud: CloudVmHostStore's Observable conformance needs Observation imported publicly

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Regenerate the settings exports for the Cloud toggle's keys

Output of scripts/ci/run-swift-testing-suites.sh in export-settings mode on
the fleet (cmux-ci step 4a65c0d0802f461f1c53afb3, f657bc5): the PR
autofix could not run past the base's red ActionSurfaceParityTests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud toggle: copy only a git working copy; a missing machine socket fails instead of skipping the copy

A plain folder (/Users, ~/Downloads, a disk) could hold anything, the home
folder included: Current Folder now copies only a git working copy's top
folder and starts any other folder empty. The copy no longer skips silently
when the machine's socket is unknown. Drops a vendor keyword from the setting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud toggle: resolve the folder to copy off the main thread

Deciding the plan reads no disk, so Cmd-N's turn does none; the creation's
open resolves the git working copy on BackgroundWork's files lane with the
checked FileManager seam.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud toggle: a creation cancelled while its folder resolves makes nothing more

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Regenerate the settings schema after dropping the vendor keyword

Fleet export-settings step 99a1cecd47d37cfb921f8d87.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Regenerate the defaults snapshot with the Cloud toggle's settings

python3 scripts/ci/defaults_guard.py snapshot after merging feat-cmux-next 750a36c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Test Cloud workspace retry and sidebar creation entrypoints

* Keep Cloud workspace creation scoped and retryable across entrypoints

* cmux NEXT Cloud toggle: the sidebar's + in a remote machine's window stays on that machine

Routing the plain + through Cmd-N's newTab (5d29a6b) made it on this Mac's
daemon even in a window whose machineID is a Cloud machine. Only a local window
takes that route now; a remote window keeps its own machine as before.
Regression test: CloudNewWorkspaceEntryTests.sidebarPlusInARemoteMachinesWindowStaysOnThatMachine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* cmux NEXT Cloud toggle: the sidebar's + in a remote machine's window stays on that machine

Routing the plain + through Cmd-N's newTab (5d29a6b) made it on this Mac's
daemon even in a window whose machineID is a Cloud machine. Only a local window
takes that route now; a remote window keeps its own machine as before.
Regression test: CloudNewWorkspaceEntryTests.sidebarPlusInARemoteMachinesWindowStaysOnThatMachine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Cloud toggle: ask for a machine only where its progress shows, and say when a workspace opens here

Review on bf59563 (teamleaderleo): with no open window, New Workspace
could start a billable Cloud machine with no visible progress, Cancel or
Retry; and when signed out or Cloud was unavailable it fell back to this Mac
silently although the person had turned on Run New Workspaces in Cloud.

CloudNewWorkspacePlan.route decides: Cloud only when Cloud can create a
machine, the person is signed in and a window shows the creation. Otherwise
New Workspace opens here and shows a toast in that workspace's window saying
why (the unavailable reason, sign in first, or no window). With the toggle
off nothing changes. Tests: the route table, and the handler with no window,
signed out and toggle off, each asserting no creation began.

Also removes a duplicate settings.default.neverDiscard entry the merge of
feat-cmux-next left in Localizable.xcstrings (both sides added it).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Cloud toggle: a second Cmd-N reuses the machine on its way; a team switch ends the creation

Subagent review of c544db6: repeated Cmd-N with the toggle on asked for
one paid machine per press. Now a press in a window that already shows the
toggle's creation that has not opened its workspace (requesting, booting,
or failed with Retry) shows that one again.

The toggle's open step threw CancellationError on an account or team
switch without ending the creation, leaving its row at ready with no
buttons; it now ends the creation, as checkCreationScope does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Cloud toggle: regenerated settings exports, highlight action, registry duplicates

- settings-schema.json, docs/mdm and the docs settings reference regenerated
  on the fleet (scripts/cmux-next/regenerate-settings-exports.sh, step
  933cf64a50016eb73c0e6fb9 on aws-m4pro-8) over this head plus the base
  compile fix of #27722; the PR autofix could not build them while the base
  fails to compile JoinConsent+App.swift. The merge had kept the PR's older
  schema, which read as reverted base defaults to the defaults guard.
- The release highlight gets the Open Settings action release-notary asks for.
- tests/test-execution.toml: the merge registered test_ci_runs_on_fallback.py
  and test_workflow_file_size.py twice (tooling-tests).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Regenerate cloud workspace settings exports on the current base

Regenerated on cmux-ci step 12c196b9dd4874c2783fdf38. Preserves the current base settings alongside both Cloud workspace options. Excludes the bot-owned defaults snapshot.

* Regenerate Cloud workspace settings exports on merged base

Generated by fleet step 5224f2ed1cf2b2d6c3a76721; the web reference was generated with Bun on the task Freestyle VM. All 600 base schema rows are preserved and only the two Cloud settings are added. ManagedPreferencesManifestTests and the freshness export pass; the base tabs.nativeNewTabPage agent-policy assertion remains red.

* Regenerate Cloud settings exports after Settings sections merge

Fleet step d49063ff136e67ab71afd386 compiled all package tests and passed ManagedPreferencesManifestTests (4 tests) and SettingsSchemaExportTests (6 tests) at 63c98f0. Canonical Bun follower ran on the task Freestyle VM. Preserve all 601 base settings and add exactly the two Cloud keys; schema digest matches the fleet artifact. No defaults snapshot included.

* Regenerate Cloud workspace settings exports on the merged base

Canonical Swift export tests passed on a2f47d6 (fleet step 6300c749ba81b5e7b8809be7). Preserve all 602 base schema rows and 595 MDM keys, adding only the two Cloud settings. Generate the web reference with Bun on a task-owned Freestyle VM; all 532 base rows remain unchanged. All seven focused Cloud and Settings suites passed on the same source head (step 7d01603ea44eab02e2d1ece5).

* Regenerate settings exports after base merge

Use the canonical fleet Swift exporters and Bun follower to retain the base auto-archive manual default and new workspace chooser setting alongside the Cloud settings.

Verification: fleet c7f3784d68864be416296dd6 passed all 10 export tests. The settings freshness assertion failed before regeneration and passed afterward on a task-owned Freestyle VM (bun test settings-freshness.test.ts). No Swift feature source changed.

* test: cover late first terminal in Cloud workspace toggle

Exercise the stored production toggle opener with isolated offline auth and a scripted daemon that holds its first terminal reply until a keyed replay arrives. The assertion requires successful completion, one workspace and terminal, and no cleanup close. Fleet red-before verification follows on this commit.

* fix: wait for late Cloud workspace and terminal starts

Use the existing workspace-with-terminal creation path, which preserves one workspace and terminal mutation identity through delayed replies. A busy Cloud daemon no longer makes the toggle fail and offer a Retry that opens a second workspace. Regression: CloudNewWorkspaceLateStartTests exercises the stored toggle opener on the real JSON-lines transport; exact-commit red/green fleet runs follow publication.

* test: disambiguate daemon values for late-start reproduction

The auth runtime also exports JSONValue, so qualify the daemon response type. Restore the pre-repair call in this regression-only intermediate commit to establish a behavioral red on the fleet; the next commit restores the late-start-safe production path. The earlier regression run failed compilation and is not behavioral evidence.

* fix: preserve late Cloud starts with the compiled regression

Restore the shared workspace-and-first-terminal path after the compile-corrected regression-only commit. The final production change remains the same late-start repair; the regression now uses the explicitly qualified daemon response type. Fleet red/green results will be recorded on the PR.

* chore: regenerate Cloud workspace settings exports on the fleet

Generated without hand edits by scripts/cmux-next/regenerate-settings-exports.sh at 073d770, fleet job fe17b3f4da0aa8b91f678813; patch sha256:02a6bba85fcaec7018dc98e0602129c9ab02453917e9bea8411b17fc56662cd7. All four managed-preference tests and six schema-export tests passed. The 606 schema rows preserve every base key and add only the two Cloud workspace keys; newChatsIn privacy metadata catches up to its unchanged base policy. Excluded the bot-owned defaults snapshot as the exporter instructs.

* test: serve complete workspace replies in late-start regression

Include the required replayed field and complete cleanup/list-agents replies so the production toggle reaches the delayed terminal. The prior fixture stopped at workspace decoding and proved no late-start behavior. This regression-only intermediate commit uses the pre-fix terminal deadline; the following commit restores the repair.

* fix: retain Cloud starts through delayed daemon replies

Use the shared late-start-safe workspace and first-terminal operations after the complete-wire regression commit. Final production behavior matches the reviewed repair. Fleet verification will exercise this exact head and its regression-only parent with the same CloudNewWorkspaceLateStartTests command.

* Regenerate Cloud settings on the merged base

Fleet step ea1838456e1c98cae6aae885 ran scripts/cmux-next/regenerate-settings-exports.sh at 11a38dc: all package/test targets compiled; 4 managed-preference and 6 schema-export tests passed. Applied the generated artifact directly, excluding the bot-owned defaults snapshot. The preservation audit confirms all 605 base schema rows plus the two Cloud settings (607 total), unchanged base web/MDM rows and metadata, and correct Cloud defaults and agent privacy refusals.

* test: keep attributed user origins out of Cloud workspace routing

* fix: reserve Cloud workspace toggle for native user actions

Use ActionInvocation.isPersonsOwnRun so socket claims and app, agent or terminal attribution cannot provision a Cloud workspace through the toggle. The preceding regression covers all four claims; red and green execution is queued through cmux-ci on the published commits.

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: cmux-bot[bot] <348531757+cmux-bot[bot]@users.noreply.github.com>

This branch was previously deployed

1 inactive deployment
ci-routing-agent — 4f7825db Deployed Oct 30, 2026 by teamleaderleo via wait for same-key tree publisher #79112
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:normal Risk tier (docs/ci/risk-tiers.md)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant